added config
[nao-ulib.git] / mod / naonet.h
blob43ec4e64ff41c22d268343fe17a02578b58117cc
1 /*
2 * Naonet communication protocol
4 * Copyright (C) 2010 Daniel Borkmann <daniel@netsniff-ng.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
21 #ifndef __NAONET_H__
22 #define __NAONET_H__
24 #include <linux/types.h>
25 #include <linux/wait.h>
26 #include <linux/kfifo.h>
28 /* Our Nao Ethernet type */
29 #define ETH_P_NAO 0xACDC
31 struct naohdr {
32 __be16 len;
33 __be32 src_id;
34 __be16 opts;
37 /* Nao control structure */
38 struct naonet {
39 rwlock_t ctl_lock;
40 __be32 src_id;
41 char dev_name[IFNAMSIZ];
42 size_t rx_queue_elems;
43 spinlock_t rx_queue_lock;
44 struct kfifo * rx_queue;
45 wait_queue_head_t rx_queue_wait;
46 rwlock_t rx_hook_lock;
47 void (*rx_hook)(struct naohdr *head, char *payload);
48 atomic_t rx_frames_bq;
49 atomic_t rx_frames_aq;
50 atomic_t rx_frames_drop;
51 atomic_t tx_frames;
54 #endif /* __NAONET_H__ */