Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Typedefs | Functions
protocol.h File Reference

Go to the source code of this file.

Data Structures

struct  s_PROTOCOL_STRUCT
 UDP structure. More...
 

Macros

#define s_PROTOCOL_ADDR_SERVER   0
 
#define s_PROTOCOL_ADDR_BROADCAST   99
 
#define s_PROTOCOL_TYPE_ACK   'a'
 
#define s_PROTOCOL_TYPE_DATA   'd'
 
#define s_PROTOCOL_TYPE_GO_AHEAD   'g'
 

Typedefs

typedef struct s_PROTOCOL_STRUCT protocol_t
 UDP structure. More...
 

Functions

int protocol_encode (char *udp_packet, int *len, int recv_id, int send_id, int send_team, char type, int seqno, int seqid, int seq_lid, int data_type, void *data)
 
int protocol_decode (protocol_t *packet, char *udp_packet, int len, int robot_id, int robot_team)
 

Detailed Description

Author
Eriks Zaharans
Date
5 Jul 2013

DESCRIPTION

Functions to decode communication packets header file.

Definition in file protocol.h.

Macro Definition Documentation

#define s_PROTOCOL_ADDR_BROADCAST   99

Definition at line 41 of file protocol.h.

#define s_PROTOCOL_ADDR_SERVER   0

Definition at line 40 of file protocol.h.

#define s_PROTOCOL_TYPE_ACK   'a'

Definition at line 44 of file protocol.h.

#define s_PROTOCOL_TYPE_DATA   'd'

Definition at line 45 of file protocol.h.

#define s_PROTOCOL_TYPE_GO_AHEAD   'g'

Definition at line 46 of file protocol.h.

Typedef Documentation

typedef struct s_PROTOCOL_STRUCT protocol_t

UDP structure.

Function Documentation

int protocol_decode ( protocol_t packet,
char *  udp_packet,
int  len,
int  robot_id,
int  robot_team 
)

Decode string received from UDP into interpretable data

Parameters
packet
udp_packet
len
robot_id
robot_team
Returns
Pointer to protocol packet containing data

Definition at line 169 of file protocol.c.

int protocol_encode ( char *  udp_packet,
int *  len,
int  recv_id,
int  send_id,
int  send_team,
char  type,
int  seqno,
int  seqid,
int  seq_lid,
int  data_type,
void *  data 
)

Encode data structure into string to be sent through UDP

Parameters
udp_packet
len
recv_id
send_id
send_team
type
data_type
data
Returns
s_OK if successful, s_ERROR if failed

Definition at line 43 of file protocol.c.