Moep Library  2.0-nc
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
module.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013, 2014 Maurice Leclaire <leclaire@in.tum.de>
3  * Stephan M. Guenther <moepi@moepi.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * See COPYING for more details.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
41 #ifndef __MOEP80211_MODULE_H
42 #define __MOEP80211_MODULE_H
43 
44 #include <stddef.h>
45 
46 #include <moep/types.h>
47 #include <moep/frame.h>
48 #include <moep/dev.h>
49 
50 
58 
69  void *(* create)(void);
70 
86  void *(* parse)(u8 **raw, size_t *maxlen);
87 
100  int (* build_len)(void *hdr);
101 
116  int (* build)(void *hdr, u8 *raw, size_t maxlen);
117 
126  void (* destroy)(void *hdr);
127 };
128 
129 
148  struct moep_frame_ops *l2_ops);
149 
163 void moep_frame_convert(moep_frame_t frame, struct moep_frame_ops *l1_ops,
164  struct moep_frame_ops *l2_ops);
165 
186 void *moep_frame_l1_hdr(moep_frame_t frame, struct moep_frame_ops *l1_ops);
187 
208 void *moep_frame_l2_hdr(moep_frame_t frame, struct moep_frame_ops *l2_ops);
209 
210 
217 struct moep_dev_ops {
218 
231  int (* close)(int fd, void *priv);
232 };
233 
234 
262 moep_dev_t moep_dev_open(int fd, int mtu, struct moep_dev_ops *ops, void *priv,
263  struct moep_frame_ops *l1_ops,
264  struct moep_frame_ops *l2_ops);
265 
285 void *moep_dev_get_priv(moep_dev_t dev, struct moep_dev_ops *ops);
286 
288 #endif /* __MOEP80211_MODULE_H */
struct moep_frame * moep_frame_t
a moep frame
Definition: frame.h:45
void * moep_dev_get_priv(moep_dev_t dev, struct moep_dev_ops *ops)
return the private data of a moep device
void moep_frame_convert(moep_frame_t frame, struct moep_frame_ops *l1_ops, struct moep_frame_ops *l2_ops)
convert a frame
moep device operations
Definition: module.h:217
int(* close)(int fd, void *priv)
close a device
Definition: module.h:231
void * moep_frame_l2_hdr(moep_frame_t frame, struct moep_frame_ops *l2_ops)
layer 2 header
void * moep_frame_l1_hdr(moep_frame_t frame, struct moep_frame_ops *l1_ops)
layer 1 header
void(* destroy)(void *hdr)
destroy a header
Definition: module.h:126
int(* build_len)(void *hdr)
length of the built header
Definition: module.h:100
frame header operations
Definition: module.h:57
struct moep_dev * moep_dev_t
a moep device
Definition: dev.h:46
moep_frame_t moep_frame_create(struct moep_frame_ops *l1_ops, struct moep_frame_ops *l2_ops)
create a frame
int(* build)(void *hdr, u8 *raw, size_t maxlen)
build a header
Definition: module.h:116
moep_dev_t moep_dev_open(int fd, int mtu, struct moep_dev_ops *ops, void *priv, struct moep_frame_ops *l1_ops, struct moep_frame_ops *l2_ops)
open a moep device