libtbxcast.h File Reference

Application library for the TBXcast IPv6 routing extension. More...

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet6/tbxcast6.h>
#include "libtbxcast_priv.h"

Go to the source code of this file.

Data Structures

struct  tbxcast_member
struct  q_o_s
struct  rt_entry
struct  rev_rt

Defines

#define TBXCAST_SUCCESS   0
#define TBXCAST_FAILURE   (-1)
#define TBXC_PORT   0x01
#define TBXCAST6_TREE_SIZE(ndest)   (((ndest * 17 + 7) & ~7) >> 3)
#define DEFAULT_PORT   2048

Typedefs

typedef struct q_o_s q_o_s_t
typedef struct rt_entry rt_entry_t
typedef struct rev_rt rev_rt_t

Enumerations

enum  qos_type { NO_QOS, BANDWIDTH }

Functions

int TBXcastReadTree (struct tbxcast6_node *tree, char *file, int nbnodes)
int TBXcastAddTree (int groupid, struct tbxcast6_node *tree)
struct rt_entry_getRoutingTable ()
struct rev_rt_getReverseTable ()
int * _getRoutingMatrix ()
int * _getQoSMatrix ()
int _count_nodes ()
struct in6_addr _mk_in6_addr (char *str)
int TBXcastInitTopology ()
int TBXcastReadTopology (char *file)
int TBXcastAddRoute (int source, int dest, struct in6_addr dest_int, struct q_o_s qos)
int TBXcastRemoveRoute (int source, int dest)
int TBXcastRemoveNode (int node)
int TBXcastCreateRoutingMatrix (qos_type qos_param)
int TBXcastCreateTree (struct in6_addr src, int groupid, struct tbxcast6_node **gtree, int del_nodes)
int TBXcastCreateGroup (int flags, struct sockaddr *src, unsigned short maxmbrs)
int TBXcastSend (int groupid, char *datap, int datalen)
int TBXcastSetSockOpt (int groupid, int optlev, int optname, void *optval, size_t optlen)
int TBXcastAddMember (struct in6_addr addr, int gid)
int TBXcastRemoveMember (struct in6_addr addr, int gid)
int TBXcastCountMembers (int gid)
int TBXcastListMembers (struct in6_addr *lmem, int nb, int gid)


Detailed Description

Application library for the TBXcast IPv6 routing extension.

This library provides necessary functions for applications which want to use the TBXcast IPv6 routing extension. Included functions provide means to generate groups, calculate the routing trees and send packages to these groups.

Author:
TBXcrew
Version:
3.4

Define Documentation

#define TBXCAST6_TREE_SIZE ( ndest   )     (((ndest * 17 + 7) & ~7) >> 3)

Calculates the size of a TBXcast tree in units of 8bytes.

#define TBXCAST_FAILURE   (-1)

Error code for Failure

#define TBXCAST_SUCCESS   0

Error code for Success


Enumeration Type Documentation

enum qos_type

Quality of Service criteria


Function Documentation

int _count_nodes (  ) 

Debugging function

Returns:
Count of the nodes in the routing table.

int* _getQoSMatrix (  ) 

Debugging function

Warning:
You should'n manipulate the structures directly
Returns:
The QoS matrix

struct rev_rt* _getReverseTable (  )  [read]

Debugging function

Warning:
You should'n manipulate the structures directly
Returns:
The structure containing the reverse routing table

int* _getRoutingMatrix (  ) 

Debugging function

Warning:
You should'n manipulate the structures directly
Returns:
The routing matrix

struct rt_entry* _getRoutingTable (  )  [read]

Debugging function

Warning:
You should'n manipulate the structures directly
Returns:
The structure containing the routing table

struct in6_addr _mk_in6_addr ( char *  str  )  [read]

Transforms a string into an IPv6 address

Parameters:
[in] str String describing the IP
Returns:
Corresponding in6_addr structure

int TBXcastAddMember ( struct in6_addr  addr,
int  gid 
)

Adds a member to a TBXcast group

Parameters:
[in] addr IPv6 address of the member
[in] gid ID of the group
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastAddRoute ( int  source,
int  dest,
struct in6_addr  dest_int,
struct q_o_s  qos 
)

Adds a connection to the routing table.

Parameters:
[in] source ID of the source node
[in] dest ID of the destination node
[in] dest_int IPv6 address of the destination interface
[in] qos Quality of Service of the connection
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastAddTree ( int  groupid,
struct tbxcast6_node tree 
)

Associates a group with a routing tree.

If the group already had a tree associated with it it will be overwritten.

Parameters:
[in] groupid ID of the group
[in] tree The routing tree to use
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastCountMembers ( int  gid  ) 

Counts members of a TBXcast group

Parameters:
[in] gid ID of the group
Returns:
Number of members in the group

int TBXcastCreateGroup ( int  flags,
struct sockaddr *  src,
unsigned short  maxmbrs 
)

Creates a new TBXcast group.

Parameters:
[in] flags TBXcast group flags
[in] src (optional) Source IP address and/or source UDP port default source address is the first IP address of the outgoing interface default UDP port is 0
[in] maxmbrs Maximum members per TBXcast header. If more members are added into the group the tree will be segmented.
Returns:
Unique ID of the newly created group or -1 on failure.

int TBXcastCreateRoutingMatrix ( qos_type  qos_param  ) 

Calculates the routing matrix from the current topology. This function must be caller prior to any routing tree calculations. And should be called after any update to the topology.

Parameters:
[in] qos_param QoS criterium selected to calculate the routing tree
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastCreateTree ( struct in6_addr  src,
int  groupid,
struct tbxcast6_node **  gtree,
int  del_nodes 
)

Creates a routing tree.

A pointer to the calculated tree is put into the gtree parameter.

Parameters:
[in] src IPv6 address of the source.
[in] groupid ID of the group. Members of this group will be considered as destinations.
[out] gtree A pointer to the tree stucture.
[in] del_nodes If set to 1 non-significant nodes in the tree will be deleted
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastInitTopology (  ) 

Initializes the topology. Routing table, node count and the reverse table are reset.

Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastListMembers ( struct in6_addr *  lmem,
int  nb,
int  gid 
)

Returns a list of members in a group

Array for the list of members must be allocated prior to the call.

Parameters:
[out] lmem List of addresses of all members in given group
[in] nb Number of members to return
[in] gid ID of the group
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastReadTopology ( char *  file  ) 

Reads the topology from a file

Returns:
Number of successfuly read connections or -1 on failure

int TBXcastReadTree ( struct tbxcast6_node tree,
char *  file,
int  nbnodes 
)

Reads a routing tree from a file.

The tree is read into a provided buffer which must be allocated prior to calling this function.

Parameters:
[out] tree The routing tree
[in] file Path to the file containing the routing tree
[in] nbnodes Number of the nodes to read
Returns:
TBXCAST_SUCCESS upon successful reading of the file

int TBXcastRemoveMember ( struct in6_addr  addr,
int  gid 
)

Removes a member from a TBXcast group

Parameters:
[in] addr IPv6 address of the member
[in] gid ID of the group
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastRemoveNode ( int  node  ) 

Removes a node from the routing table.

Parameters:
[in] node ID of the node
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastRemoveRoute ( int  source,
int  dest 
)

Removes a connection from the routing table.

Parameters:
[in] source ID of the source node
[in] dest ID of the destination node
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastSend ( int  groupid,
char *  datap,
int  datalen 
)

Transmit data over TBXcast socket to a group of users.

Parameters:
[in] groupid ID of the group.
[in] datap Data to transmit
[in] datalen Length of data
Returns:
TBXCAST_SUCCESS in case of success or TBXCAST_FAILURE on error

int TBXcastSetSockOpt ( int  groupid,
int  optlev,
int  optname,
void *  optval,
size_t  optlen 
)

Set the socket option on the XCAST socket, as defined by setsockopt(), for the given group.

Parameters:
[in] groupid Unique group identifier
[in] optlev Socket level
[in] optname Option Name
[in] optval Option Value
[in] optlen Option Length
Returns:
-1 on failure


Generated on Fri May 29 17:07:12 2009 for LibTBXcast by  doxygen 1.5.5