-#ifndef _FWP_CONTRACT_H
-#define _FWP_CONTRACT_H
+#ifndef _FWP_CNT_H
+#define _FWP_CNT_H
#include "fwp_msgb.h"
} cnt_status_t;
/**
- * FWP contract info
+ * FWP contract
* It is internal representation of the contract used inside
* protocol.
*
*/
-struct fwp_cnt_info { /* BETTER name ??*/
+struct fwp_cnt { /* BETTER name ??*/
int budget; /**< bytes per period */
int period_usec; /**< all time units are in microseconds */
request */
};
-#endif /*_FWP_CONTRACT_H */
+#endif /*_FWP_CNT_H */
-#ifndef _FWP_CTABLE_H
-#define _FWP_CTABLE_H
+#ifndef _FWP_CNTABLE_H
+#define _FWP_CNTABLE_H
#include "fwp_conf.h"
#include "fwp_cnt.h"
#include <sys/un.h>
struct fwp_cntable {
- struct fwp_cnt_info entry[FWP_CONTRACT_MAX];
+ struct fwp_cnt entry[FWP_CONTRACT_MAX];
unsigned int nr_contract;
/*pthread_mutex_t lock; */
};
void fwp_cntable_init(struct fwp_cntable *cntable);
-int fwp_cntable_insert(struct fwp_cntable *cntable, struct fwp_cnt_info *cnt);
+int fwp_cntable_insert(struct fwp_cntable *cntable, struct fwp_cnt *cnt);
int fwp_cntable_delete(struct fwp_cntable *cntable, unsigned int id);
-struct fwp_cnt_info* fwp_cntable_get(struct fwp_cntable* cntable,
- unsigned int id);
+struct fwp_cnt* fwp_cntable_get(struct fwp_cntable* cntable, unsigned int id);
-#endif /* _FWP_CTABLE_H */
+#endif /* _FWP_CNTABLE_H */
void fwp_msg_header_parse(unsigned char *data, unsigned int *code, unsigned int *hid);
-void fwp_msg_contract_insert(unsigned char *data, struct fwp_cnt_info *cnt);
-void fwp_msg_contract_parse(unsigned char *data, struct fwp_cnt_info *cnt);
+void fwp_msg_contract_insert(unsigned char *data, struct fwp_cnt *cnt);
+void fwp_msg_contract_parse(unsigned char *data, struct fwp_cnt *cnt);
#endif /* _FWP_MSG_H */
void fwp_vres_table_init();
-int fwp_vres_open(struct fwp_cnt_info *cnt);
+int fwp_vres_open(struct fwp_cnt *cnt);
int fwp_vres_close(unsigned int id);
inline int fwp_vres_send(unsigned int id, struct fwp_msgb* msgb);
cntable->nr_contract = 0;
}
-int fwp_cntable_insert(struct fwp_cntable* cntable,
- struct fwp_cnt_info *cnt)
+int fwp_cntable_insert(struct fwp_cntable* cntable, struct fwp_cnt *cnt)
{
unsigned int id;
/* obtain fwp ctable mutex */
return -1;
}
- memcpy(&cntable->entry[id], cnt, sizeof(struct fwp_cnt_info));
+ memcpy(&cntable->entry[id], cnt, sizeof(struct fwp_cnt));
cntable->nr_contract++;
/* release fwp_contract_table mutex */
return id;
}
-struct fwp_cnt_info* fwp_cntable_get(struct fwp_cntable* cntable,
+struct fwp_cnt* fwp_cntable_get(struct fwp_cntable* cntable,
unsigned int id)
{
return (&cntable->entry[id]);
*hid = ntohs(header->hid);
}
-void fwp_msg_contract_insert(unsigned char *data, struct fwp_cnt_info *cnt)
+void fwp_msg_contract_insert(unsigned char *data, struct fwp_cnt *cnt)
{
struct fwp_msg_contract* msgcnt;
msgcnt->period_usec = htonl(cnt->period_usec);
}
-void fwp_msg_contract_parse(unsigned char *data, struct fwp_cnt_info *cnt)
+void fwp_msg_contract_parse(unsigned char *data, struct fwp_cnt *cnt)
{
struct fwp_msg_contract* msgcnt;
*
*/
struct fwp_vres{
- struct fwp_cnt_info contract;
+ struct fwp_cnt contract;
/* consideration: move tx_queue to endpoint */
/**< queue for messages to send */
struct fwp_msgq tx_queue;
fwp_vres_table[id].status = FWP_VRES_CLOSED;
}
-int fwp_vres_open(struct fwp_cnt_info *cnt)
+int fwp_vres_open(struct fwp_cnt *cnt)
{
int id,rc;
struct fwp_vres *vres;
vres->status = FWP_VRES_OPENED;
/* release fwp_vres_table mutex */
pthread_mutex_unlock(&vres_table_lock);
- memcpy(&vres->contract, cnt, sizeof(struct fwp_cnt_info));
+ memcpy(&vres->contract, cnt, sizeof(struct fwp_cnt));
fwp_msgq_init(&vres->tx_queue);
if ((rc = fwp_ac_open(vres->contract.ac_id)) < 0) {
{
struct fwp_msgq msgq;
struct fwp_msgb *msgb;
- struct fwp_cnt_info cnt_a, cnt_b, cnt_c, cnt_d;
+ struct fwp_cnt cnt_a, cnt_b, cnt_c, cnt_d;
fwp_msgq_init(&msgq);
printf("in=%d out=%d pending=%d \n",msgq.in,msgq.out,msgq.nr_pending);
ssize_t len;
int vres_id1, vres_id2;
int i;
- struct fwp_cnt_info cnt1;
- struct fwp_cnt_info cnt2;
+ struct fwp_cnt cnt1, cnt2;
char msg1[] = "Hello1";
char msg2[] = "Hello2";
char buffer[30];