Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs | Functions
udp.h File Reference
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  s_UDP_STRUCT
 UDP structure. More...
 

Typedefs

typedef struct s_UDP_STRUCT udp_t
 UDP structure. More...
 

Functions

int udp_init_broadcast (udp_t *udp)
 
int udp_init_receive (udp_t *udp)
 
udp_tudp_open (char *broadcast_ip, int port, int packet_size)
 
int udp_close (udp_t *udp)
 
int udp_broadcast (udp_t *udp, char *packet, int len)
 
int udp_receive (udp_t *udp, char *packet, int *len)
 

Detailed Description

Author
Eriks Zaharans
Date
4 Jul 2013

DESCRIPTION

UDP socket function library header file.

Definition in file udp.h.

Typedef Documentation

typedef struct s_UDP_STRUCT udp_t

UDP structure.

Function Documentation

int udp_broadcast ( udp_t udp,
char *  packet,
int  len 
)

Broadcast packet through UDP

Parameters
udpPointer to UDP structure
packetPointer to data packet to be broadcasted
lenNumber of bytes to be broadcasted
Returns
s_OK if successful, s_ERROR if failed

Definition at line 159 of file udp.c.

int udp_close ( udp_t udp)

Deinitialize UDP

Parameters
udpPointer to UDP structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 130 of file udp.c.

int udp_init_broadcast ( udp_t udp)

Initialize UDP broadcasting

Parameters
udpPointer to UDP structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 36 of file udp.c.

int udp_init_receive ( udp_t udp)

Initialize UDP recive

Parameters
udpPointer to UDP structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 72 of file udp.c.

udp_t* udp_open ( char *  broadcast_ip,
int  port,
int  packet_size 
)

Open UDP broadcast and recieve sockets

Parameters
broadcast_ipUDP broadcast IP address
portUDP port
packet_sizeUDP packet size
Returns
Pointer to UDP structure if successful, Null pointer if failed

Definition at line 105 of file udp.c.

int udp_receive ( udp_t udp,
char *  packet,
int *  len 
)

Receive packet through UDP

Parameters
udpPointer to UDP structure
packetPointer to memory where to save received packet
lenPointer to memory where to save number of received bytes
Returns
s_OK if successful, s_ERROR if failed

Definition at line 178 of file udp.c.