lwes_net_functions.h File Reference


Detailed Description

Functions for dealing with multicast channels.

Go to the source code of this file.

Data Structures

struct  lwes_net_connection
 IP Multicast Channel object. More...

Functions

int lwes_net_open (struct lwes_net_connection *conn, const char *address, const char *iface, int port)
 Open a multicast channel.
int lwes_net_close (struct lwes_net_connection *conn)
 Close a multicast channel.
int lwes_net_get_ttl (struct lwes_net_connection *conn)
 Get the current Time-To-Live on a multicast channel.
int lwes_net_set_ttl (struct lwes_net_connection *conn, int new_ttl)
 Set a new Time-To-Live on a multicast channel.
int lwes_net_get_sock_fd (struct lwes_net_connection *conn)
 Get the socket file descriptor for the multicast channel.
int lwes_net_send_bytes (struct lwes_net_connection *conn, LWES_BYTE_P bytes, size_t len)
 Send bytes to the multicast channel.
int lwes_net_sendto_bytes (struct lwes_net_connection *conn, char *address, char *iface, int port, LWES_BYTE_P bytes, size_t len)
 Send bytes to a different multicast channel.
int lwes_net_recv_bind (struct lwes_net_connection *conn)
 Bind to the multicast channel.
int lwes_net_recv_bytes (struct lwes_net_connection *conn, LWES_BYTE_P bytes, size_t len)
 Receive bytes from the multicast channel in blocking mode.
int lwes_net_recv_bytes_by (struct lwes_net_connection *conn, LWES_BYTE_P bytes, size_t len, unsigned int timeout_ms)
 Receive bytes from the multicast channel with a timeout.


Function Documentation

int lwes_net_open struct lwes_net_connection conn,
const char *  address,
const char *  iface,
int  port
 

Open a multicast channel.

Parameters:
[in] conn the multicast channel object to hole this connection
[in] address the multicast IP address of the channel to connect to
[in] iface the IP address of the network interface this channel shoul be connected to
[in] port the multicast port of the channel to connect to
Returns:
0 on success, a negative number on error

int lwes_net_close struct lwes_net_connection conn  ) 
 

Close a multicast channel.

Parameters:
[in] conn the multicast channel object containing the connection to close
Returns:
0 on success, a negative number on error

int lwes_net_get_ttl struct lwes_net_connection conn  ) 
 

Get the current Time-To-Live on a multicast channel.

Parameters:
[in] conn the multicast channel to get the ttl for
Returns:
the current ttl value on success, a negative number on error

int lwes_net_set_ttl struct lwes_net_connection conn,
int  new_ttl
 

Set a new Time-To-Live on a multicast channel.

Parameters:
[in] conn the multicast channel to get the ttl for
[in] new_ttl the new ttl to set for outgoing packets
Returns:
0 on success, a negative number on error

int lwes_net_get_sock_fd struct lwes_net_connection conn  ) 
 

Get the socket file descriptor for the multicast channel.

Parameters:
[in] conn the multicast channel to get the socket file descriptor for
Returns:
the file descriptor on success, a negative number on error

int lwes_net_send_bytes struct lwes_net_connection conn,
LWES_BYTE_P  bytes,
size_t  len
 

Send bytes to the multicast channel.

Parameters:
[in] conn the multicast channel to send bytes to
[in] bytes an array of bytes to send out on the channel
[in] len the number of bytes from bytes to send out on the channel
Returns:
the number of bytes sent on success, a negative number on failure

int lwes_net_sendto_bytes struct lwes_net_connection conn,
char *  address,
char *  iface,
int  port,
LWES_BYTE_P  bytes,
size_t  len
 

Send bytes to a different multicast channel.

This can be used to send bytes out over an alternate channel, this will result in the creation and destruction of a struct lwes_net_connection internally.

Parameters:
[in] conn the multicast channel to ignore since it's not used in this call
[in] address the multicast IP address of the channel to connect to
[in] iface the IP address of the network interface this channel shoul be connected to
[in] port the multicast port of the channel to connect to
[in] bytes the bytes to send to the alternate channel
[in] len the number of bytes to send to the alternate channel
Returns:
the number of bytes sent on success, a negative number on failure

int lwes_net_recv_bind struct lwes_net_connection conn  ) 
 

Bind to the multicast channel.

Used to actually bind to a channel, this should only be called if one plans to receive bytes from the channel

Parameters:
[in] conn the multicast channel to bind to
Returns:
0 on success, a negative number on failure

int lwes_net_recv_bytes struct lwes_net_connection conn,
LWES_BYTE_P  bytes,
size_t  len
 

Receive bytes from the multicast channel in blocking mode.

This calls lwes_net_recv_bind internally.

Parameters:
[in] conn the multicast channel to receive bytes from
[out] bytes the byte array to fill out
[in] len the size of the byte array to fill out
Returns:
the number of bytes received on success, a negative number on failure

int lwes_net_recv_bytes_by struct lwes_net_connection conn,
LWES_BYTE_P  bytes,
size_t  len,
unsigned int  timeout_ms
 

Receive bytes from the multicast channel with a timeout.

This calls lwes_net_recv_bind internally.

Parameters:
[in] conn the multicast channel to receive bytes from
[out] bytes the byte array to fill out
[in] len the size of the byte array to fill out
[in] timeout_ms the maximum time to block on this call
Returns:
the number of bytes received on success, a negative number on failure


Generated on Thu Aug 21 07:18:55 2008 for lwes by  doxygen 1.4.6