diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-18 03:34:12 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-18 03:34:12 +0100 |
commit | 77199be682daa1797a4518b3958d58c133dd88f2 (patch) | |
tree | 60737630a303d0127fdf9db062228289311152fa /include | |
parent | cdf537c71c29c05fd3d77637a3731de80019d2be (diff) | |
download | gmrf-77199be682daa1797a4518b3958d58c133dd88f2.tar gmrf-77199be682daa1797a4518b3958d58c133dd88f2.zip |
Rename context data structures, define more of the module API
Diffstat (limited to 'include')
-rw-r--r-- | include/gmrf/gmrf.h | 17 | ||||
-rw-r--r-- | include/mmss/protocol.h | 3 |
2 files changed, 9 insertions, 11 deletions
diff --git a/include/gmrf/gmrf.h b/include/gmrf/gmrf.h index d2ecdf5..3634b29 100644 --- a/include/gmrf/gmrf.h +++ b/include/gmrf/gmrf.h @@ -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_ */ diff --git a/include/mmss/protocol.h b/include/mmss/protocol.h index 4030ef0..502a923 100644 --- a/include/mmss/protocol.h +++ b/include/mmss/protocol.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_ */ |