Rename context data structures, define more of the module API
This commit is contained in:
parent
cdf537c71c
commit
77199be682
8 changed files with 55 additions and 47 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <string.h>
|
||||
|
||||
|
||||
typedef struct gmrf gmrf_t;
|
||||
typedef struct gmrf_context gmrf_context_t;
|
||||
typedef struct gmrf_iface gmrf_iface_t;
|
||||
|
||||
|
@ -52,17 +53,13 @@ static inline bool gmrf_addr_equal(const gmrf_addr_t *addr1, const gmrf_addr_t *
|
|||
}
|
||||
|
||||
|
||||
gmrf_addr_t gmrf_iface_get_addr(gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
size_t gmrf_iface_get_mtu(gmrf_context_t *ctx, gmrf_iface_t *iface);
|
||||
gmrf_addr_t gmrf_iface_get_addr(gmrf_t *gmrf, gmrf_iface_t *iface);
|
||||
size_t gmrf_iface_get_mtu(gmrf_t *gmrf, gmrf_iface_t *iface);
|
||||
|
||||
bool gmrf_iface_send(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len, const gmrf_addr_t *dest);
|
||||
bool gmrf_iface_send_bc(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len);
|
||||
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_handle_packet_func)(gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
|
||||
typedef struct gmrf_protocol {
|
||||
gmrf_handle_packet_func handle_packet;
|
||||
} gmrf_protocol_t;
|
||||
gmrf_context_t* gmrf_init(gmrf_t *gmrf);
|
||||
void gmrf_handle_packet(gmrf_t *gmrf, gmrf_context_t *ctx, gmrf_iface_t *iface, const gmrf_addr_t *source, const void *data, size_t len);
|
||||
|
||||
#endif /* _GMRF_GMRF_H_ */
|
||||
|
|
|
@ -34,7 +34,8 @@ typedef struct mmss_protocol {
|
|||
const char *name;
|
||||
const char *version;
|
||||
|
||||
gmrf_protocol_t* (*init)(gmrf_context_t *ctx);
|
||||
gmrf_context_t* (*init)(gmrf_t *gmrf);
|
||||
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);
|
||||
} mmss_protocol_t;
|
||||
|
||||
#endif /* _GMRF_MMSS_PROTOCOL_H_ */
|
||||
|
|
Reference in a new issue