server.
:returns: a key/value table containing stats
+.. js:function:: Server.get_proxy(sv)
+
+ Returns the parent proxy to which the server belongs.
+
+ :param class_server sv: A :ref:`server_class` which indicates the manipulated
+ server.
+ :returns: a :ref:`proxy_class` or nil if not available
+
.. js:function:: Server.shut_sess(sv)
Shutdown all the sessions attached to the server. See the management socket
int hlua_register_metatable(struct lua_State *L, char *name);
void hlua_fcn_reg_core_fcn(lua_State *L);
int hlua_dump_object(lua_State *L);
+int hlua_fcn_new_proxy(lua_State *L, struct proxy *px);
int hlua_fcn_new_server(lua_State *L, struct server *srv);
int hlua_fcn_new_event_sub(lua_State *L, struct event_hdl_sub *sub);
}
+int hlua_server_get_proxy(lua_State *L)
+{
+ struct server *srv;
+
+ srv = hlua_check_server(L, 1);
+ if (srv == NULL) {
+ lua_pushnil(L);
+ return 1;
+ }
+
+ if (!srv->proxy) {
+ lua_pushnil(L);
+ return 1;
+ }
+
+ hlua_fcn_new_proxy(L, srv->proxy);
+ return 1;
+}
+
int hlua_server_get_addr(lua_State *L)
{
struct server *srv;
hlua_class_function(L, "set_addr", hlua_server_set_addr);
hlua_class_function(L, "get_addr", hlua_server_get_addr);
hlua_class_function(L, "get_stats", hlua_server_get_stats);
+ hlua_class_function(L, "get_proxy", hlua_server_get_proxy);
hlua_class_function(L, "shut_sess", hlua_server_shut_sess);
hlua_class_function(L, "set_drain", hlua_server_set_drain);
hlua_class_function(L, "set_maint", hlua_server_set_maint);