libamsip  4.8.0
Functions
amsip network interface
Network configuration API.

Functions

int am_network_guess_ip (int family, char *address, int size)
int am_network_masquerade (const char *ip, int port)
int am_network_start (const char *transport, int port)
int am_network_connection_tests (struct stun_test *stuntest, char *stun_server, int srcport)
int am_network_add_local_candidates (struct SdpCandidate *_candidates, int srcport)
int am_network_add_stun_candidates (struct SdpCandidate *candidates, struct SdpCandidate *localcandidates, char *stun_server, int srcport)
int am_network_add_turn_candidates (struct SdpCandidate *candidates, char *turn_server, int srcport)
int am_network_add_relay_candidates (struct SdpCandidate *candidates, char *relay_server, int srcport)
char * am_network_test_nat (const char *stun_server, int port, const char *proxy)
char * am_network_get_nat_info (const char *stun_server, int srcport)
int am_network_get_nat (char *stun_server, int srcport)
int am_network_get_stun_socket (const char *stun_server, int srcport, char *firewall, int *port)

Detailed Description

Function Documentation

int am_network_guess_ip ( int  family,
char *  address,
int  size 
)

Find default address of interface to reach the defined gateway.

Parameters
familyAF_INET or AF_INET6
addressa string containing the local IP address.
sizeThe size of the string
int am_network_masquerade ( const char *  ip,
int  port 
)

Configure amsip to do masquerading on SIP Contact address. at run time.

PLEASE DO NOT USE UNLESS YOU REALLY UNDERSTAND THIS OPTION! THIS OPTIONS CANNOT BE USED IF YOU CONFIGURED THE STACK WITH STUN or ICE SUPPORT.

Parameters
ipIP to appear in Contact.
portport to appear in Contact.
int am_network_start ( const char *  transport,
int  port 
)

Configure amsip to listen on a specific transport layer.

Parameters
transportTransport Protocol to use ("UDP", "TCP", "TLS")
portLocal port to use for socket. (0 for random port)
int am_network_connection_tests ( struct stun_test *  stuntest,
char *  stun_server,
int  srcport 
)

Test NAT type.

Parameters
stuntestelement to receive all stun test.
stun_serverStun server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
int am_network_add_local_candidates ( struct SdpCandidate *  _candidates,
int  srcport 
)

Add local candidates.

Parameters
_candidatesTable for 10 local candidates.
srcportLocal port to use for socket. (0 for random port)
int am_network_add_stun_candidates ( struct SdpCandidate *  candidates,
struct SdpCandidate *  localcandidates,
char *  stun_server,
int  srcport 
)

Add Stun candidate.

Parameters
candidatescandidates to receive all stun candidates.
localcandidatescandidates with all local candidates. (used to remove duplicates)
stun_serverStun server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
int am_network_add_turn_candidates ( struct SdpCandidate *  candidates,
char *  turn_server,
int  srcport 
)

Add TURN candidate.

Parameters
candidatescandidates to receive all turn candidates.
turn_serverTURN server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
int am_network_add_relay_candidates ( struct SdpCandidate *  candidates,
char *  relay_server,
int  srcport 
)

Add RELAY candidate.

Parameters
candidatescandidates to receive all turn candidates.
relay_serverSTUN server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
char* am_network_test_nat ( const char *  stun_server,
int  port,
const char *  proxy 
)

Test NAT type.

Parameters
stun_serverStun server to use for NAT traversal solution.
portLocal port to use for socket. (0 for random port)
proxySIP Proxy Address (used to determine which interface to test)
char* am_network_get_nat_info ( const char *  stun_server,
int  srcport 
)

Return text information on NAT type.

Parameters
stun_serverStun server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
int am_network_get_nat ( char *  stun_server,
int  srcport 
)

Return binary information on NAT type.

Parameters
stun_serverStun server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
int am_network_get_stun_socket ( const char *  stun_server,
int  srcport,
char *  firewall,
int *  port 
)

Return IP/port and socket for a STUN server test.

Parameters
stun_serverStun server to use for NAT traversal solution.
srcportLocal port to use for socket. (0 for random port)
firewallOUT: firewall IP detected.
portOUT: firewall port detected.