Преглед изворни кода

ncd: modules: sys_request_server: implement _caller in request handler

ambrop7 пре 13 година
родитељ
комит
797a2c9e6a
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7 1
      ncd/modules/sys_request_server.c

+ 7 - 1
ncd/modules/sys_request_server.c

@@ -51,7 +51,9 @@
  *   - {"tcp", {"ipv6", ipv6_address, port_number}},
  *   - {"unix", socket_path}.
  * 
- * Predefined variables in request_handler_template:
+ * Predefined objects and variables in request_handler_template:
+ *   _caller - provides access to objects as seen from the sys.request_server()
+ *     command
  *   _request.data - the request payload as sent by the client
  *   string _request.client_addr - the address of the client. The form is
  *     like the second part of the sys.request_server() address format, e.g.
@@ -487,6 +489,10 @@ static int request_process_func_getspecialobj (NCDModuleProcess *process, NCD_st
         return 1;
     }
     
+    if (name == NCD_STRING_CALLER) {
+        return NCDModuleInst_Backend_GetObj(r->con->inst->i, name, out_object);
+    }
+    
     return 0;
 }