XSocket API  2.0
XIA Socket Library
Functions
XdefaultInterface.c File Reference
#include <errno.h>
#include "Xsocket.h"
#include "Xinit.h"
#include "Xutil.h"
#include "dagaddr.hpp"

Functions

int XupdateDefaultInterface (int sockfd, int interface)
 Change the default interface for this host. More...
 
int XdefaultInterface (int sockfd)
 Identify the default interface for this system. More...
 

Function Documentation

int XdefaultInterface ( int  sockfd)

An application can call XdefaultInterface() to identify the network interface that is the default interface for this system.

Parameters
sockfdan Xsocket previously created.
Returns
the current default interface or -1 on error.
int XupdateDefaultInterface ( int  sockfd,
int  interface 
)

The XupdateDefaultInterface allows an application to change the default interface used by the system. The address accociated with the default interface is used as source address in outgoing packets. The response packets from a peer would then arrive on the default interface for all applications unless they choose to bind to another interface.

Note that this API changes the default interface for the system and will be a protected API in the future.

If an application needs to just change the source address for itself and not the entire system, it should bind() to an address associated with the intented interface and not use this API.

Parameters
sockfdan Xsocket previously created.
interfacethe new default interface.
Returns
0 on success or -1 on failure.