module documentation

Warning: do not use this library. It is unstable and most of the routines here have been superseded by other libraries (e.g. rosgraph). These routines will likely be deleted in future releases.

Exception ROSHandshakeException Exception to represent errors decoding handshake
Function create_local_xmlrpc_uri Determine the XMLRPC URI for local servers. This handles the search logic of checking ROS environment variables, the known hostname, and local interface IP addresses to determine the best possible URI.
Function decode_ros_handshake_header Decode serialized ROS handshake header into a Python dictionary
Function encode_ros_handshake_header Encode ROS handshake header as a byte string. Each header field is a string key value pair. The encoded header is prefixed by a length field, as is each field key/value pair. key/value pairs a separated by a '=' equals sign.
Function get_address_override @return: ROS_IP/ROS_HOSTNAME override or None @rtype: str @raise ValueError: if ROS_IP/ROS_HOSTNAME/__ip/__hostname are invalidly specified
Function get_bind_address @param address: (optional) address to compare against @type address: str @return: address TCP/IP sockets should use for binding. This is generally 0.0.0.0, but if \x07 address or ROS_IP/ROS_HOSTNAME is set to localhost it will return 127...
Function get_host_name if ROS_IP/ROS_HOSTNAME is set, use that address
Function get_local_address @return: default local IP address (e.g. eth0). May be overridden by ROS_IP/ROS_HOSTNAME/__ip/__hostname @rtype: str
Function get_local_addresses @return: known local addresses. Not affected by ROS_IP/ROS_HOSTNAME @rtype: [str]
Function is_local_address @param hostname: host name/address @type hostname: str @return True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames.
Function read_ros_handshake_header Read in tcpros header off the socket \x07 sock using buffer \x07 b.
Function write_ros_handshake_header Write ROS handshake header header to socket sock @param sock: socket to write to (must be in blocking mode) @type sock: socket.socket @param header: header field keys/values @type header: {str : str} @return: Number of bytes sent (for statistics) @rtype: int...
Constant ROS_HOSTNAME Undocumented
Constant ROS_IP Undocumented
Variable python3 Undocumented
Variable SIOCGIFADDR Undocumented
Variable SIOCGIFCONF Undocumented
Function _is_unix_like_platform @return: true if the platform conforms to UNIX/POSIX-style APIs @rtype: bool
Variable _local_addrs Undocumented
Variable _use_netifaces Undocumented
def create_local_xmlrpc_uri(port):

Determine the XMLRPC URI for local servers. This handles the search logic of checking ROS environment variables, the known hostname, and local interface IP addresses to determine the best possible URI.

@param port: port that server is running on @type port: int @return: XMLRPC URI @rtype: str

def decode_ros_handshake_header(header_str):

Decode serialized ROS handshake header into a Python dictionary

header is a list of string key=value pairs, each prefixed by a 4-byte length field. It is preceeded by a 4-byte length field for the entire header.

@param header_str: encoded header string. May contain extra data at the end. @type header_str: str @return: key value pairs encoded in \x07 header_str @rtype: {str: str}

def encode_ros_handshake_header(header):

Encode ROS handshake header as a byte string. Each header field is a string key value pair. The encoded header is prefixed by a length field, as is each field key/value pair. key/value pairs a separated by a '=' equals sign.

FORMAT: (4-byte length + [4-byte field length + field=value ]*)

@param header: header field keys/values @type header: dict @return: header encoded as byte string @rtype: str

def get_address_override():

@return: ROS_IP/ROS_HOSTNAME override or None @rtype: str @raise ValueError: if ROS_IP/ROS_HOSTNAME/__ip/__hostname are invalidly specified

def get_bind_address(address=None):

@param address: (optional) address to compare against @type address: str @return: address TCP/IP sockets should use for binding. This is generally 0.0.0.0, but if \x07 address or ROS_IP/ROS_HOSTNAME is set to localhost it will return 127.0.0.1 @rtype: str

def get_host_name():

Determine host-name for use in host-name-based addressing (e.g. XML-RPC URIs):
  • if ROS_IP/ROS_HOSTNAME is set, use that address
  • if the hostname returns a non-localhost value, use that
  • use whatever L{get_local_address()} returns

def get_local_address():

@return: default local IP address (e.g. eth0). May be overridden by ROS_IP/ROS_HOSTNAME/__ip/__hostname @rtype: str

def get_local_addresses():

@return: known local addresses. Not affected by ROS_IP/ROS_HOSTNAME @rtype: [str]

def is_local_address(hostname):

@param hostname: host name/address @type hostname: str @return True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames.

def read_ros_handshake_header(sock, b, buff_size):

Read in tcpros header off the socket \x07 sock using buffer \x07 b.

@param sock: socket must be in blocking mode @type sock: socket @param b: buffer to use @type b: StringIO for Python2, BytesIO for Python 3 @param buff_size: incoming buffer size to use @type buff_size: int @return: key value pairs encoded in handshake @rtype: {str: str} @raise ROSHandshakeException: If header format does not match expected

def write_ros_handshake_header(sock, header):

Write ROS handshake header header to socket sock @param sock: socket to write to (must be in blocking mode) @type sock: socket.socket @param header: header field keys/values @type header: {str : str} @return: Number of bytes sent (for statistics) @rtype: int

ROS_HOSTNAME: str =

Undocumented

Value
'ROS_HOSTNAME'
ROS_IP: str =

Undocumented

Value
'ROS_IP'
python3: int =

Undocumented

SIOCGIFADDR: int =

Undocumented

SIOCGIFCONF: int =

Undocumented

def _is_unix_like_platform():

@return: true if the platform conforms to UNIX/POSIX-style APIs @rtype: bool

_local_addrs =

Undocumented

_use_netifaces: bool =

Undocumented