def message_type(self, val=None): """Get or set the SPA message type. If no argument is given, the current value is returned. Otherwise, message type will be set to the given value. The message type parameter is an integer value. Constants have been defined to represent this values. Currently, the supported digest types are: FKO_COMMAND_MSG A request to have the fwknop server execute the given command. The format for this type is: "<ip of requestor>:<command text>" For example: "192.168.1.2:uname -a" FKO_ACCESS_MSG A basic access request. This is the most common type in use. The format for this type is: "<ip of requestor>:<protocol>/<port>". For example: "192.168.1.2:tcp/22" FKO_NAT_ACCESS_MSG An access request that also provide information for the fwknop server to create a Network Address Translation (NAT to an internal address. The format for this string is: "<internal ip>,<ext nat port>". For example: "10.10.1.2,9922" FKO_CLIENT_TIMEOUT_ACCESS_MSG This is an "FKO_ACCESS_REQUEST" with a timeout parameter for the fwknop server. The timeout value is provided via the "client_timeout" data field. FKO_CLIENT_TIMEOUT_NAT_ACCESS_MSG This is an "FKO_NAT_ACCESS_REQUEST" with a timeout parameter for the fwknop server. The timeout value is provided via the "client_timeout" data field. FKO_LOCAL_NAT_ACCESS_MSG This is similar to the "FKO_NAT_ACCESS" request exept the NAT is to the local to the server (i.e. a service listening on 127.0.0.1). FKO_CLIENT_TIMEOUT_LOCAL_NAT_ACCES_MSG This is an "FKO_LOCAL_NAT_ACCESS_REQUEST" with a timeout parameter for the fwknop server. The timeout value is provided via the "client_timeout" data field. """ if val != None: _fko.set_spa_message_type(self.ctx, val) else: return _fko.get_spa_message_type(self.ctx)
def message_type_str(self, val=None): """Returns the message type string for the given value. """ if val == None: val = _fko.get_spa_message_type(self.ctx) if val == FKO_COMMAND_MSG: mts = "Command Message" elif val == FKO_ACCESS_MSG: mts = "Access Message" elif val == FKO_NAT_ACCESS_MSG: mts = "NAT Access Message" elif val == FKO_CLIENT_TIMEOUT_ACCESS_MSG: mts = "Access Message with timeout" elif val == FKO_CLIENT_TIMEOUT_NAT_ACCESS_MSG: mts = "NAT access Message with timeout" elif val == FKO_LOCAL_NAT_ACCESS_MSG: mts = "Local NAT Access Message" elif val == FKO_CLIENT_TIMEOUT_LOCAL_NAT_ACCESS_MSG: mts = "Local NAT Access Message with timeout" else: mts = "Unknown SPA message type" return mts