]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua: Rename set_{tos, mark} to set_fc_{tos, mark}
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 15 Jan 2024 15:33:04 +0000 (16:33 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 1 Feb 2024 09:58:30 +0000 (10:58 +0100)
This is a complementary patch to "MINOR: tcp-act: Rename "set-{mark,tos}"
to "set-fc-{mark,tos}"", but for the Lua API.

set_mark and set_tos were kept as aliases for set_fc_mark and set_fc_tos
but they were marked as deprecated.

Using this opportunity to reorder set_mark and set_tos by alphabetical
order.

doc/lua-api/index.rst
src/hlua.c

index a48afd2bb12c016f41b4a7114bc6def957ee9466..05b0c636b9108d6a4626765bf89da3d504f99f35 100644 (file)
@@ -2870,6 +2870,22 @@ TXN class
 
   :see: :js:func:`TXN.reply`, :js:class:`Reply`
 
+.. js:function:: TXN.set_fc_tos(txn, tos)
+
+  Is used to set the TOS or DSCP field value of packets sent to the client to
+  the value passed in "tos" on platforms which support this.
+
+  :param class_txn txn: The class txn object containing the data.
+  :param integer tos: The new TOS os DSCP.
+
+.. js:function:: TXN.set_fc_mark(txn, mark)
+
+  Is used to set the Netfilter MARK on all packets sent to the client to the
+  value passed in "mark" on platforms which support it.
+
+  :param class_txn txn: The class txn object containing the data.
+  :param integer mark: The mark value.
+
 .. js:function:: TXN.set_loglevel(txn, loglevel)
 
   Is used to change the log level of the current request. The "loglevel" must
@@ -2881,21 +2897,21 @@ TXN class
     :js:attr:`core.err`, :js:attr:`core.warning`, :js:attr:`core.notice`,
     :js:attr:`core.info`, :js:attr:`core.debug` (log level definitions)
 
-.. js:function:: TXN.set_tos(txn, tos)
+.. js:function:: TXN.set_mark(txn, mark)
 
-  Is used to set the TOS or DSCP field value of packets sent to the client to
-  the value passed in "tos" on platforms which support this.
+  Alias for :js:func:`TXN.set_fc_mark()`.
 
-  :param class_txn txn: The class txn object containing the data.
-  :param integer tos: The new TOS os DSCP.
+  .. warning::
+     This function is deprecated. :js:func:`TXN.set_fc_mark()` must be used
+     instead.
 
-.. js:function:: TXN.set_mark(txn, mark)
+.. js:function:: TXN.set_tos(txn, tos)
 
-  Is used to set the Netfilter MARK on all packets sent to the client to the
-  value passed in "mark" on platforms which support it.
+  Alias for :js:func:`TXN.set_fc_tos()`.
 
-  :param class_txn txn: The class txn object containing the data.
-  :param integer mark: The mark value.
+  .. warning::
+     This function is deprecated. :js:func:`TXN.set_fc_tos()` must be used
+     instead.
 
 .. js:function:: TXN.set_priority_class(txn, prio)
 
index 78004313126029b458c930c57889a08b82d32ce7..b0abf5fa5a13e7b97062d2bc6ed42f059519b4e9 100644 (file)
@@ -8192,28 +8192,25 @@ __LJMP static int hlua_txn_log_alert(lua_State *L)
        return 0;
 }
 
-__LJMP static int hlua_txn_set_loglevel(lua_State *L)
+__LJMP static int hlua_txn_set_fc_mark(lua_State *L)
 {
        struct hlua_txn *htxn;
-       int ll;
+       int mark;
 
-       MAY_LJMP(check_args(L, 2, "set_loglevel"));
+       MAY_LJMP(check_args(L, 2, "set_fc_mark"));
        htxn = MAY_LJMP(hlua_checktxn(L, 1));
-       ll = MAY_LJMP(luaL_checkinteger(L, 2));
-
-       if (ll < 0 || ll > 7)
-               WILL_LJMP(luaL_argerror(L, 2, "Bad log level. It must be between 0 and 7"));
+       mark = MAY_LJMP(luaL_checkinteger(L, 2));
 
-       htxn->s->logs.level = ll;
+       conn_set_mark(objt_conn(htxn->s->sess->origin), mark);
        return 0;
 }
 
-__LJMP static int hlua_txn_set_tos(lua_State *L)
+__LJMP static int hlua_txn_set_fc_tos(lua_State *L)
 {
        struct hlua_txn *htxn;
        int tos;
 
-       MAY_LJMP(check_args(L, 2, "set_tos"));
+       MAY_LJMP(check_args(L, 2, "set_fc_tos"));
        htxn = MAY_LJMP(hlua_checktxn(L, 1));
        tos = MAY_LJMP(luaL_checkinteger(L, 2));
 
@@ -8221,16 +8218,19 @@ __LJMP static int hlua_txn_set_tos(lua_State *L)
        return 0;
 }
 
-__LJMP static int hlua_txn_set_mark(lua_State *L)
+__LJMP static int hlua_txn_set_loglevel(lua_State *L)
 {
        struct hlua_txn *htxn;
-       int mark;
+       int ll;
 
-       MAY_LJMP(check_args(L, 2, "set_mark"));
+       MAY_LJMP(check_args(L, 2, "set_loglevel"));
        htxn = MAY_LJMP(hlua_checktxn(L, 1));
-       mark = MAY_LJMP(luaL_checkinteger(L, 2));
+       ll = MAY_LJMP(luaL_checkinteger(L, 2));
 
-       conn_set_mark(objt_conn(htxn->s->sess->origin), mark);
+       if (ll < 0 || ll > 7)
+               WILL_LJMP(luaL_argerror(L, 2, "Bad log level. It must be between 0 and 7"));
+
+       htxn->s->logs.level = ll;
        return 0;
 }
 
@@ -13776,9 +13776,11 @@ lua_State *hlua_init_state(int thread_num)
        hlua_class_function(L, "get_var",             hlua_get_var);
        hlua_class_function(L, "done",                hlua_txn_done);
        hlua_class_function(L, "reply",               hlua_txn_reply_new);
+       hlua_class_function(L, "set_fc_mark",         hlua_txn_set_fc_mark);
+       hlua_class_function(L, "set_fc_tos",          hlua_txn_set_fc_tos);
        hlua_class_function(L, "set_loglevel",        hlua_txn_set_loglevel);
-       hlua_class_function(L, "set_tos",             hlua_txn_set_tos);
-       hlua_class_function(L, "set_mark",            hlua_txn_set_mark);
+       hlua_class_function(L, "set_mark",            hlua_txn_set_fc_mark); // DEPRECATED, use set_fc_mark
+       hlua_class_function(L, "set_tos",             hlua_txn_set_fc_tos);  // DEPRECATED, use set_fc_tos
        hlua_class_function(L, "set_priority_class",  hlua_txn_set_priority_class);
        hlua_class_function(L, "set_priority_offset", hlua_txn_set_priority_offset);
        hlua_class_function(L, "deflog",              hlua_txn_deflog);