Robot Agent
1.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
TDDD07_lab_release_2013-11-07
robot_agent
src
protocol.h
Go to the documentation of this file.
1
12
#ifndef __PROTOCOL_H
13
#define __PROTOCOL_H
14
15
/* -- Includes -- */
16
17
/* -- Types -- */
18
22
typedef
struct
s_PROTOCOL_STRUCT
23
{
24
int
recv_id
;
// Receiver ID
25
int
send_id
;
// Sender ID
26
int
send_team
;
// Sender Team
27
char
type
;
// Packet type
28
int
send_time
;
29
int
pkt_seqno
;
//Sequence number of the packet
30
int
pkt_seqid
;
//Sequence id of the packet.
31
int
seq_last_id
;
//The last id of the sequence
32
char
data_type
;
// Data type
33
void
*
data
;
// Pointer to data structure
34
35
}
protocol_t
;
36
37
/* -- Constants -- */
38
39
/* Protocol Addresses */
40
#define s_PROTOCOL_ADDR_SERVER 0
41
#define s_PROTOCOL_ADDR_BROADCAST 99
42
43
/* Packet types */
44
#define s_PROTOCOL_TYPE_ACK 'a'
45
#define s_PROTOCOL_TYPE_DATA 'd'
46
#define s_PROTOCOL_TYPE_GO_AHEAD 'g'
47
48
/* -- Function Prototypes -- */
49
int
protocol_encode
(
char
*udp_packet,
50
int
*len,
51
int
recv_id,
52
int
send_id,
53
int
send_team,
54
char
type,
55
int
seqno,
56
int
seqid,
57
int
seq_lid,
58
int
data_type,
59
void
*data);
// Encode data structure into string to be sent through UDP
60
61
/* Decode the data structure contanied in the udp packet */
62
int
protocol_decode
(
protocol_t
*packet,
char
*udp_packet,
int
len,
int
robot_id,
int
robot_team);
63
64
65
66
#endif
/* __PROTOCOL_H */
s_PROTOCOL_STRUCT::pkt_seqno
int pkt_seqno
Definition:
protocol.h:29
s_PROTOCOL_STRUCT::recv_id
int recv_id
Definition:
protocol.h:24
s_PROTOCOL_STRUCT::pkt_seqid
int pkt_seqid
Definition:
protocol.h:30
s_PROTOCOL_STRUCT::data
void * data
Definition:
protocol.h:33
s_PROTOCOL_STRUCT::type
char type
Definition:
protocol.h:27
s_PROTOCOL_STRUCT::seq_last_id
int seq_last_id
Definition:
protocol.h:31
s_PROTOCOL_STRUCT::send_team
int send_team
Definition:
protocol.h:26
protocol_decode
int protocol_decode(protocol_t *packet, char *udp_packet, int len, int robot_id, int robot_team)
Definition:
protocol.c:169
s_PROTOCOL_STRUCT::data_type
char data_type
Definition:
protocol.h:32
protocol_t
struct s_PROTOCOL_STRUCT protocol_t
UDP structure.
s_PROTOCOL_STRUCT::send_time
int send_time
Definition:
protocol.h:28
s_PROTOCOL_STRUCT
UDP structure.
Definition:
protocol.h:22
s_PROTOCOL_STRUCT::send_id
int send_id
Definition:
protocol.h:25
protocol_encode
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)
Definition:
protocol.c:43
Generated on Wed Nov 13 2013 14:02:31 for Robot Agent by
1.8.5