1/*-
2 * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB
3 * All rights reserved.
4 *
5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer,
13 *    without modification.
14 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15 *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
16 *    redistribution must be conditioned upon including a substantially
17 *    similar Disclaimer requirement for further binary redistribution.
18 *
19 * NO WARRANTY
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
23 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
24 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
25 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGES.
31 *
32 * $FreeBSD$
33 */
34
35#ifndef	__DEV_WTAP_MEDIUM_H__
36#define	__DEV_WTAP_MEDIUM_H__
37
38#include "if_wtapvar.h"
39#include "wtap_hal/handler.h"
40
41struct packet {
42	STAILQ_ENTRY(packet)	pf_list;
43	struct mbuf *		m;
44	int			id;
45};
46typedef STAILQ_HEAD(, packet) md_pkthead;
47
48struct wtap_medium {
49	struct mtx 			md_mtx;
50#if 0
51	int				visibility[MAX_NBR_WTAP];
52	struct stailhead 		*headp;
53	packet_head			pktbuf;
54	STAILQ_HEAD(stailhead, packet) pktbuf;
55	STAILQ_HEAD(stailhead, packet) pktbuf;
56	/* = STAILQ_HEAD_INITIALIZER(head); */
57#endif
58	/* 0 means we drop packets, 1 we queue them */
59	int				open;
60	md_pkthead			md_pktbuf;	/* master queue */
61	struct eventhandler		*tx_handler;
62	struct timehandler		*bc_handler;
63};
64
65extern	void init_medium(struct wtap_medium *);
66extern	void deinit_medium(struct wtap_medium *);
67extern	void medium_open(struct wtap_medium *);
68extern	void medium_close(struct wtap_medium *);
69extern	int medium_transmit(struct wtap_medium *, int id, struct mbuf*);
70extern	struct packet *medium_get_next_packet(struct wtap_medium *);
71
72#endif	/* __DEV_WTAP_MEDIUM_H__ */
73