#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) |
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.
| #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
| enum qos_type |
Quality of Service criteria
| int _count_nodes | ( | ) |
Debugging function
| int* _getQoSMatrix | ( | ) |
Debugging function
| struct rev_rt* _getReverseTable | ( | ) | [read] |
Debugging function
| int* _getRoutingMatrix | ( | ) |
Debugging function
| struct rt_entry* _getRoutingTable | ( | ) | [read] |
Debugging function
| struct in6_addr _mk_in6_addr | ( | char * | str | ) | [read] |
Transforms a string into an IPv6 address
| [in] | str | String describing the IP |
| int TBXcastAddMember | ( | struct in6_addr | addr, | |
| int | gid | |||
| ) |
Adds a member to a TBXcast group
| [in] | addr | IPv6 address of the member |
| [in] | gid | ID of the group |
| int TBXcastAddRoute | ( | int | source, | |
| int | dest, | |||
| struct in6_addr | dest_int, | |||
| struct q_o_s | qos | |||
| ) |
Adds a connection to the routing table.
| [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 |
| 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.
| [in] | groupid | ID of the group |
| [in] | tree | The routing tree to use |
| int TBXcastCountMembers | ( | int | gid | ) |
Counts members of a TBXcast group
| [in] | gid | ID of the group |
| int TBXcastCreateGroup | ( | int | flags, | |
| struct sockaddr * | src, | |||
| unsigned short | maxmbrs | |||
| ) |
Creates a new TBXcast group.
| [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. |
| 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.
| [in] | qos_param | QoS criterium selected to calculate the routing tree |
| 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.
| [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 |
| int TBXcastInitTopology | ( | ) |
Initializes the topology. Routing table, node count and the reverse table are reset.
| 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.
| [out] | lmem | List of addresses of all members in given group |
| [in] | nb | Number of members to return |
| [in] | gid | ID of the group |
| int TBXcastReadTopology | ( | char * | file | ) |
Reads the topology from a file
| 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.
| [out] | tree | The routing tree |
| [in] | file | Path to the file containing the routing tree |
| [in] | nbnodes | Number of the nodes to read |
| int TBXcastRemoveMember | ( | struct in6_addr | addr, | |
| int | gid | |||
| ) |
Removes a member from a TBXcast group
| [in] | addr | IPv6 address of the member |
| [in] | gid | ID of the group |
| int TBXcastRemoveNode | ( | int | node | ) |
Removes a node from the routing table.
| [in] | node | ID of the node |
| int TBXcastRemoveRoute | ( | int | source, | |
| int | dest | |||
| ) |
Removes a connection from the routing table.
| [in] | source | ID of the source node |
| [in] | dest | ID of the destination node |
| int TBXcastSend | ( | int | groupid, | |
| char * | datap, | |||
| int | datalen | |||
| ) |
Transmit data over TBXcast socket to a group of users.
| [in] | groupid | ID of the group. |
| [in] | datap | Data to transmit |
| [in] | datalen | Length of data |
| 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.
| [in] | groupid | Unique group identifier |
| [in] | optlev | Socket level |
| [in] | optname | Option Name |
| [in] | optval | Option Value |
| [in] | optlen | Option Length |
1.5.5