XSocket API
2.0
XIA Socket Library
|
This document describes the eXpressive Internet Architecture (XIA) network socket user interface.
For the most part, the Xsocket APIs use the same parameters as their Berkley socket counterparts. The main difference is that XIA has introduced a new address family (AF_INET) and the addresses passed between functions use a new sockaddr type (sockaddr_x). This documentation describes the APIs and the differences between XIA and Berkley sockets. The man pages for the Berkley calls can be referred to more more detailed information on the function calls.
In XIA, addresses are represented as directed acyclic graphs (DAGs). The XIA socket API manipulates DAGs as strings in a particular format; creating and working with DAGs in this string format can be tedious. This library provides an object-oriented API (in C++ and Python) for creating and manipulating DAGs.
DAGs are managed using 2 C++ classes:
Here we describe building a DAG from the ground up. Most simple DAGs can be seen one or more possible paths for reaching the final intent; that is, most DAGs you work with will consist of and handful of paths from source to sink. Consider this simple example: we are constructing a DAG for retrieving a piece of content with ID "CID". We want to make a DAG that offers the network three possible paths to the content, each more specific than the last:
In the subsections that follow, we show how to construct a DAG for each of these paths and then how to combine those three DAGs into a single DAG, where paths 2 and 3 are fallbacks.
A DAG is represented by a Graph object in our library. Graphs are composed of Node objects, so we begin by instantiating the nodes we'll need:
C++
Python
The simplest way to combine Nodes to make a Graph is to append them using the * operator:
C++
Python
Paths can be combined into a single DAG using the + operator. The easiest way to make a DAG with a fallback route from one node to another is to combine paths that share the same source and sink; in our case, we are combining three paths with source node n_src and sink node n_cid:
C++
Python
To use a DAG constructed with this library in an XSocket API call, use the Graph::dag_string() method:
C++
Python
In this example, dag_string will have the value:
DAG 2 0 - AD:0606060606060606060606060606060606060606 2 1 - HID:0101010101010101010101010101010101010101 2 - CID:0202020202020202020202020202020202020202
At times, you may want to create a Graph object from a DAG string you get from an XSocket API call (like XrecvFrom()) to make it easier to manipulate. This is easy to do, as the Graph class has a constructor that takes in a DAG string:
C++
Python
It is not always easy to tell if the DAG you created is really what you wanted; inspecting the DAG string to make sure there are edges in the right places can be tedious. To help with this, we created a web-based tool for displaying DAGs. Simply paste the DAG string (like the one we obtained