]> rtime.felk.cvut.cz Git - frescor/fwp.git/blob - fwp/lib/mngt/fwp_msg.h
ede4948e8428adc1d6e0d28cd8835ed84bce6e5b
[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_RESERVE         = 1<<2,
13         FWP_MSG_COMMIT          = 1<<3
14 } fwp_msg_type_t;
15
16 struct fwp_msg_header{
17         uint16_t type;
18         uint32_t node_id;       
19         uint32_t app_id;        /**< application id */
20 }__attribute__((packed));
21
22 struct fwp_msg_contracthdr{     
23         uint32_t id;            
24         uint8_t  status;
25 }__attribute__((packed));
26
27 struct fwp_msg_contract{        
28         uint16_t budget;        /**< bits per second */
29         uint32_t period_usec;   /**< all time units are in microseconds */
30 }__attribute__((packed));
31
32 struct fwp_msg_vres_params{
33         uint16_t budget;        /**< bits per second */
34         uint32_t period_usec;   /**< all time units are in microseconds */
35         uint8_t  ac_id;         /**< AC id ~ priority of vres */ 
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_in(unsigned char *data, fwp_msg_type_t type, 
45                         fwp_participant_id_t participant_id);
46 void fwp_msg_header_out(unsigned char *data, fwp_msg_type_t *type, 
47                         fwp_participant_id_t *participant_id);
48
49 void fwp_msg_contracthdr_in(unsigned char *data, fwp_contract_id_t id, 
50                                 fwp_contract_status_t status);
51 void fwp_msg_contracthdr_out(unsigned char *data, fwp_contract_id_t *id, 
52                                 fwp_contract_status_t *status);
53
54 void fwp_msg_contract_in(unsigned char *data, fwp_contract_t *cont);
55 void fwp_msg_contract_out(unsigned char *data, fwp_contract_t *cont);
56
57 void fwp_msg_vres_params_in(unsigned char *data, fwp_vres_params_t *vparams);
58 void fwp_msg_vres_params_out(unsigned char *data, fwp_vres_params_t *vparams);
59
60 void fwp_msg_hello_in(unsigned char *data, 
61                         fwp_participant_info_t *participant_info);
62 void fwp_msg_hello_out(unsigned char *data,
63                         fwp_participant_info_t *participant_info);
64
65 #endif /* _FWP_MSG_H */