📄 flitvec.h
字号:
/** @file flitvec.h Define the basic structure for message passing. */#ifndef FLITVEC_H#define FLITVEC_H#include <netinet/in.h>#include "simple_list.h"#include "vtypes.h"/** a piece of message. */typedef struct flit{ int size; /**< final size of the flit */ // int currentsize; /**< actual size of useable data */ char *data; /**< the data */ void (*oncomplete)(struct flit *,void*); /**< fontion called when the send of the flit is complete */ // void (*onstarve)(struct flit *,void*); /**< fontion called when we want to send more data but currentsize is too low */} flit;/** structure for sending and receiving message composed of multiple flit. */typedef struct flitvec{ int cflitindex; /**< num of the current flit */ int cflitpos; /**< number of bytes already sent for current flit */ int nbflit; /**< total number of flit for this flitvec (pkt_header include) */ void *parameter; /**< parameter bound to callback functions */ struct flit flittab[0]; /**< tab of all the flits */} flitvec;/** malloc and assign a new flit. * @param flittofullfill : flit to fullfill, if NULL then calloc * @param part : data of the flit * @param size : total size of the data * @param oncomplete : function called when flit is completely sent or received * @return the new flit. */void newflit(flit * flittofullfill, void *part, int size, void (*oncomplete)(flit*, void*));/** malloc a new flitvec * @param nbflit : number of flit in the flitvec * @return pointer to a new flitvec */flitvec * newflitvec(int nbflit);/** frees a flitvec allocated with newflitvec * @param fv: the flitvec */void release_flitvec(flitvec *fv);#endif /* FLITVEC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -