Home | Trees | Indices | Help |
---|
|
Network APIs for ROS-based systems, including IP address and ROS TCP header libraries. Because ROS-based runtimes must respect the ROS_IP and ROS_HOSTNAME environment variables, ROS-specific APIs are necessary for correctly retrieving local IP address information.
Classes | |
ROSHandshakeException Exception to represent errors decoding handshake |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
python3 = 0
|
|
SIOCGIFADDR = 35093
|
|
SIOCGIFCONF = 35090
|
|
logger = logging.getLogger('rosgraph.network')
|
|
__package__ =
|
Function Details |
Convenience routine to handle parsing and validation of HTTP URL port due to the fact that Python only provides easy accessors in Python 2.5 and later. Validation checks that the protocol and host are set. :param url: URL to parse, ``str`` :returns: hostname and port number in URL or 80 (default), ``(str, int)`` :raises: :exc:`ValueError` If the url does not validate |
:param hostname: host name/address, ``str`` :returns True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames. |
:returns: default local IP address (e.g. eth0). May be overriden by ROS_IP/ROS_HOSTNAME/__ip/__hostname, ``str`` |
:returns: known local addresses. Not affected by ROS_IP/ROS_HOSTNAME, ``[str]`` |
:param address: (optional) address to compare against, ``str`` :returns: address TCP/IP sockets should use for binding. This is generally 0.0.0.0, but if address or ROS_IP/ROS_HOSTNAME is set to localhost it will return 127.0.0.1, ``str`` |
Determine host-name for use in host-name-based addressing (e.g. XML-RPC URIs):
|
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, ``int`` :returns: XMLRPC URI, ``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, ``str`` :returns: key value pairs encoded in header_str, ``{str: str}`` |
Read in tcpros header off the socket sock using buffer b. :param sock: socket must be in blocking mode, ``socket`` :param b: buffer to use, ``StringIO`` for Python2, ``BytesIO`` for Python 3 :param buff_size: incoming buffer size to use, ``int`` :returns: key value pairs encoded in handshake, ``{str: str}`` :raises: :exc:`ROSHandshakeException` If header format does not match expected |
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, ``dict`` :returns: header encoded as byte string, ``bytes`` |
Write ROS handshake header header to socket sock :param sock: socket to write to (must be in blocking mode), ``socket.socket`` :param header: header field keys/values, ``{str : str}`` :returns: Number of bytes sent (for statistics), ``int`` |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Mar 7 03:44:33 2017 | http://epydoc.sourceforge.net |