ltm rule command MQTT return codeΒΆ

iRule(1)					  BIG-IP TMSH Manual					     iRule(1)

MQTT::return_code
       Get or set return-code field of MQTT CONNACK message.

SYNOPSIS
       MQTT::return_code (RETURN_CODE)?

DESCRIPTION
       This command can be used to get or set return-code field of MQTT message.  This command is valid only for
       following MQTT message types:

	   CONNACK

       Syntax

       MQTT::return_code [  ]

       MQTT::return_code
	   * Get the return-code field of MQTT CONNACK message.

       MQTT::return_code 
	   * Set the return-code field of MQTT CONNACK message to specified number.
	     The number must be smaller than 256.
	     0	   : Connection Accepted.
	     1	   : Connection Refused. Protocol level not supported.
	     2	   : Connection Refused. The client-identifier is not allowed by the server.
	     3	   : Connection Refused. The MQTT service is not available.
	     4	   : Connection Refused. The data in the username or password is malformed.
	     5	   : Connection Refused. The client is not authorized to connect.
	     6-255 : Reserved for future use.

RETURN VALUE
       When called without an argument, this command returns the return-code field of MQTT CONNACK message.

VALID DURING
       MQTT_CLIENT_INGRESS MQTT_SERVER_INGRESS MQTT_CLIENT_DATA MQTT_SERVER_DATA MQTT_CLIENT_EGRESS
       MQTT_SERVER_EGRESS

EXAMPLES
	# For security reasons convert all refused reasons to 5
	when MQTT_SERVER_INGRESS {
	   set type [MQTT::type]
	   switch $type {
	       "CONNACK" {
		  if { [MQTT::return_code] != 0 } {
		     MQTT::return_code 5
		  }
	       }
	   }
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-13.0.0 --First introduced the command.

BIG-IP						      2020-06-23					     iRule(1)