Refactoring ...
FossilOrigin-Name: 0e582e687c5fe1fc78b2f5a0545c6be8633bbbe011d8ac04dae76866e3347c48
This commit is contained in:
15
src/cw/cw.h
15
src/cw/cw.h
@ -114,7 +114,11 @@ typedef struct {
|
||||
int id;
|
||||
int min_len;
|
||||
int max_len;
|
||||
}cw_msgelemdef_t;
|
||||
|
||||
int (*start_in)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
||||
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
||||
|
||||
}cw_elem_handler_t;
|
||||
|
||||
typedef struct {
|
||||
mavl_t messages;
|
||||
@ -122,8 +126,9 @@ typedef struct {
|
||||
}cw_message_set_t;
|
||||
|
||||
typedef struct{
|
||||
cw_msgelemdef_t * elem;
|
||||
cw_elem_handler_t * elem;
|
||||
int mand;
|
||||
int op;
|
||||
}cw_msgelemprops_t;
|
||||
|
||||
typedef struct {
|
||||
@ -467,6 +472,12 @@ struct cw_descriptor_subelem_def {
|
||||
int mand;
|
||||
};
|
||||
|
||||
#define CW_DELETE 1
|
||||
#define CW_APPEND 2
|
||||
#define CW_PREPEND 3
|
||||
#define CW_REPLACE 4
|
||||
|
||||
|
||||
|
||||
extern int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
||||
struct cw_descriptor_subelem_def *elems);
|
||||
|
@ -14,8 +14,8 @@ typedef struct {
|
||||
}message2_t;
|
||||
|
||||
static inline int cmp_cw_msgelemprops(const void *elem1, const void *elem2){
|
||||
cw_msgelemdef_t * e1 = ((cw_msgelemprops_t*)elem1)->elem;
|
||||
cw_msgelemdef_t * e2 = ((cw_msgelemprops_t*)elem2)->elem;
|
||||
cw_elem_handler_t * e1 = ((cw_msgelemprops_t*)elem1)->elem;
|
||||
cw_elem_handler_t * e2 = ((cw_msgelemprops_t*)elem2)->elem;
|
||||
int r;
|
||||
r = e1->id - e2->id;
|
||||
if (r!=0)
|
||||
@ -141,9 +141,9 @@ void cw_message_set_add(cw_message_set_t * set,
|
||||
|
||||
}
|
||||
|
||||
cw_msgelemdef_t * cw_message_set_find_element(
|
||||
cw_elem_handler_t * cw_message_set_find_element(
|
||||
cw_message_set_t * set,
|
||||
cw_msgelemdef_t * element){
|
||||
cw_elem_handler_t * element){
|
||||
return mavl_find(set->all_elems,element);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,13 @@ struct mlist_elem * mlist_append(mlist_t l, void *data)
|
||||
return *n;
|
||||
}
|
||||
|
||||
struct mlist_elem * mlist_prepend(mlist_t l, void *data){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct mlist_elem *mlist_find(mlist_t l, struct mlist_elem *start, void *data)
|
||||
{
|
||||
struct mlist_elem *e;
|
||||
|
Reference in New Issue
Block a user