Move protocol-specific interface state into iface_t
This commit is contained in:
parent
37c2167874
commit
b15c16f12c
7 changed files with 22 additions and 15 deletions
|
@ -37,6 +37,7 @@
|
|||
typedef struct gmrf gmrf_t;
|
||||
typedef struct gmrf_context gmrf_context_t;
|
||||
typedef struct gmrf_iface gmrf_iface_t;
|
||||
typedef struct gmrf_iface_state gmrf_iface_state_t;
|
||||
|
||||
|
||||
#define GMRF_ADDR_LEN 8
|
||||
|
@ -68,7 +69,7 @@ size_t gmrf_iface_get_mtu(gmrf_t *gmrf, gmrf_iface_t *iface);
|
|||
bool gmrf_iface_send(gmrf_t *gmrf, gmrf_iface_t *iface, const void *data, size_t len, const gmrf_addr_t *dest);
|
||||
bool gmrf_iface_send_bc(gmrf_t *gmrf, gmrf_iface_t *iface, const void *data, size_t len);
|
||||
|
||||
typedef void (*gmrf_scheduled_func)(gmrf_t *gmrf, gmrf_context_t *ctx, void *arg);
|
||||
typedef void (*gmrf_scheduled_func)(gmrf_context_t *ctx, void *arg);
|
||||
|
||||
void gmrf_schedule(gmrf_t *gmrf, gmrf_scheduled_func f, void *arg, unsigned delay);
|
||||
|
||||
|
@ -77,7 +78,7 @@ extern const char *gmrf_protocol_name;
|
|||
extern const char *gmrf_protocol_version;
|
||||
|
||||
gmrf_context_t* gmrf_protocol_init(gmrf_t *gmrf);
|
||||
void gmrf_protocol_add_iface(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
void gmrf_protocol_handle_packet(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
gmrf_iface_state_t* gmrf_protocol_add_iface(gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
void gmrf_protocol_handle_packet(gmrf_context_t *ctx, gmrf_iface_state_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
|
||||
#endif /* _GMRF_GMRF_H_ */
|
||||
|
|
|
@ -35,8 +35,8 @@ typedef struct mmss_protocol {
|
|||
const char* (*get_version)(void);
|
||||
|
||||
gmrf_context_t* (*init)(gmrf_t *gmrf);
|
||||
void (*add_iface)(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
void (*handle_packet)(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
gmrf_iface_state_t* (*add_iface)(gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
void (*handle_packet)(gmrf_context_t *ctx, gmrf_iface_state_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
} mmss_protocol_t;
|
||||
|
||||
#endif /* _GMRF_MMSS_PROTOCOL_H_ */
|
||||
|
|
Reference in a new issue