adtn
index
/home/marc/gitProjects/aDTN-platform/libPython/adtn.py

aDTN python wrapper.
 
This module is a wrapper of the aDTN API.

 
Modules
       
ConfigParser
ctypes

 
Classes
       
__builtin__.object
adtnSocket
_ctypes.Structure(_ctypes._CData)
adtnSocketAddress

 
class adtnSocket(__builtin__.object)
    This class holds an aDTN socket and functions to interact with it.
 
  Methods defined here:
__del__(self)
Close the open aDTN socket.
__init__(self, config)
aDTN socket.
 
This will fill the node name, and the RIT path from the configuration
file.
 
Args:
    config (str): Path to the configuration file.
bind(self, port)
Bind the socket to the given port.
 
Args:
    port (int): Port to bind the aDTN socket.
 
Returns:
    bool: True if successful, False otherwise.
recv(self, size=2048)
Recive a message.
 
Args:
    size (int): Size of the message to recive, default 2048 (Change
        only if the entire message is not received)
 
Returns:
    str: The received message.
recvFrom(self, size=2048)
Recive a message and the sender info.
 
Args:
    size (int): Size of the message to recive, default 2048 (Change
        only if the entire message is not received)
 
Returns:
    (str, adtnSocketAddress): The received message and the sender.
ritGetValue(self, path)
Get the value of the given path.
 
Args:
    path (str): Path to get the value.
 
Returns:
    str: Value in the path, or None if not found.
ritSet(self, path, value)
Set a value in the RIT.
 
Args:
    path (str): Path for the value.
    value (str): Value to save.
 
Returns:
    bool: True if successful, False otherwise.
ritTag(self, path, tag, value)
Add a tag with a value to the path in the RIT.
 
Args:
    path (str): Path to add the tag.
    tag (str): tag to add.
    value (str): value for the tag.
 
Returns:
    bool: True if successful, False otherwise.
ritUnset(self, path)
Unset a value in the RIT.
 
Args:
    path (str): Path to unset.
 
Returns:
    bool: True if successful, False otherwise.
ritUntag(self, path, tag)
Remoev the tag to the path in the RIT.
 
Args:
    path (str): Path to remove the tag.
    tag (str): Name of the tag to remove.
 
Returns:
   bool: True if successful, False otherwise.
send(self, message, who)
Send a message to a node.
 
Args:
    message (str): Message to send.
    who (adtnSocketAddress): aDTNSocketAddress with the destination.
 
Returns:
    bool: True if successful, False otherwise.
setCode(self, codeType, code, isFile=False, replace=False)
Set a Code to the socket.
 
This code could be a routing code(ROUTING_CODE),
a life code (LIFE_CODE) or a priority code (PRIO_CODE).
 
The routing code will be executed in each hop of the network to
determine the next hop.
 
The life code will be executed in each node of the network to decide
if the message is lapsed or not.
 
The priority code will affect only to the messages in other nodes that
pertain to same application.
 
Args:
    codeType : One value from ROUTING_CODE, LIFE_CODE or PRIO_CODE
    code (str): The string containing the code or the path to the code.
    isFile (bool): If code is a path this must be set to True.
    replace (bool): If a code has been set already, and want to change
                    it this must be True.
 
Returns:
    bool: True if successful, False otherwise.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class adtnSocketAddress(_ctypes.Structure)
    This class contains the structure used to identify a node.
 
Attributes:
    adtn_port (int): Port of the application.
    id (str): Identifier of the node.
 
 
Method resolution order:
adtnSocketAddress
_ctypes.Structure
_ctypes._CData
__builtin__.object

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
adtn_port
Structure/Union member
id
Structure/Union member

Methods inherited from _ctypes.Structure:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from _ctypes.Structure:
__new__ = <built-in method __new__ of _ctypes.PyCStructType object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from _ctypes._CData:
__ctypes_from_outparam__(...)
__hash__(...)
x.__hash__() <==> hash(x)
__reduce__(...)
__setstate__(...)

 
Data
        LIFE_CODE = 3
PRIO_CODE = 2
ROUTING_CODE = 1