]> rtime.felk.cvut.cz Git - frescor/fwp.git/blob - fwp/lib/mngt/fwp_msg.h
BugFix is endpoint port assigment, added fwp_msg_type_t
[frescor/fwp.git] / fwp / lib / mngt / fwp_msg.h
1 #ifndef _FWP_MSG_H
2 #define _FWP_MSG_H
3
4 #include <stdint.h>
5
6 #include "fwp_contract.h"
7 #include "fwp_vres.h"
8 #include "fwp_participant.h"
9
10 typedef enum {
11         FWP_MSG_HELLO   = 1<<1,
12         FWP_MSG_NEGREQ  = 1<<2,
13         FWP_MSG_NEGRES  = 1<<3,
14         FWP_MSG_RESERVE = 1<<4,
15         FWP_MSG_COMMIT  = 1<<5
16 } fwp_msg_type_t;
17
18
19 struct fwp_msg_header{
20         uint16_t type;
21         uint32_t node_id;       
22         uint32_t app_id;        /**< application id */
23 }__attribute__((packed));
24
25 struct fwp_msg_contract{
26         uint16_t budget;        /**< bits per second */
27         uint32_t period_usec;   /**< all time units are in microseconds */
28 }__attribute__((packed));
29
30 struct fwp_msg_vres_params{
31         uint16_t id;            /**< STA-unique vres param id */ 
32         uint16_t budget;        /**< bits per second */
33         uint32_t period_usec;   /**< all time units are in microseconds */
34         uint8_t  ac_id;         /**< AC id ~ priority of vres */ 
35         uint8_t  status;
36 }__attribute__((packed));
37
38 struct fwp_msg_hello {
39         int32_t  node_id;
40         int32_t  app_id;
41         uint16_t stream_id;
42 }__attribute__((packed));
43
44 void fwp_msg_header_deflate(unsigned char *data, fwp_msg_type_t type, 
45                                 fwp_participant_id_t participant_id);
46 void fwp_msg_header_inflate(unsigned char *data, fwp_msg_type_t *type, 
47                                 fwp_participant_id_t *participant_id);
48
49 void fwp_msg_contract_deflate(unsigned char *data, struct fwp_contract *cont);
50 void fwp_msg_contract_inflate(unsigned char *data, struct fwp_contract *cont);
51
52 void fwp_msg_vres_params_deflate(unsigned char *data, unsigned int status,
53                                  fwp_vres_params_t *vparams);
54 void fwp_msg_vres_params_inflate(unsigned char *data, unsigned int *status,
55                                  fwp_vres_params_t *vparams);
56
57 void fwp_msg_hello_deflate(unsigned char *data, 
58                                 fwp_participant_info_t *participant_info);
59 void fwp_msg_hello_inflate(unsigned char *data,
60                                  fwp_participant_info_t *participant_info);
61
62 #endif /* _FWP_MSG_H */