]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netgraph/ng_source.h
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / sys / netgraph / ng_source.h
1 /*
2  * ng_source.h
3  */
4
5 /*-
6  * Copyright 2002 Sandvine Inc.
7  * All rights reserved.
8  *
9  * Subject to the following obligations and disclaimer of warranty, use and
10  * redistribution of this software, in source or object code forms, with or
11  * without modifications are expressly permitted by Sandvine Inc.; provided,
12  * however, that:
13  * 1. Any and all reproductions of the source or object code must include the
14  *    copyright notice above and the following disclaimer of warranties; and
15  * 2. No rights are granted, in any manner or form, to use Sandvine Inc.
16  *    trademarks, including the mark "SANDVINE" on advertising, endorsements,
17  *    or otherwise except as such appears in the above copyright notice or in
18  *    the software.
19  *
20  * THIS SOFTWARE IS BEING PROVIDED BY SANDVINE "AS IS", AND TO THE MAXIMUM
21  * EXTENT PERMITTED BY LAW, SANDVINE MAKES NO REPRESENTATIONS OR WARRANTIES,
22  * EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, INCLUDING WITHOUT LIMITATION,
23  * ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
24  * PURPOSE, OR NON-INFRINGEMENT.  SANDVINE DOES NOT WARRANT, GUARANTEE, OR
25  * MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE
26  * USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY
27  * OR OTHERWISE.  IN NO EVENT SHALL SANDVINE BE LIABLE FOR ANY DAMAGES
28  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
29  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34  * THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH
35  * DAMAGE.
36  *
37  * Author: Dave Chapeskie <dchapeskie@sandvine.com>
38  *
39  * $FreeBSD$
40  */
41
42 #ifndef _NETGRAPH_NG_SOURCE_H_
43 #define _NETGRAPH_NG_SOURCE_H_
44
45 /* Node type name and magic cookie */
46 #define NG_SOURCE_NODE_TYPE     "source"
47 #define NGM_SOURCE_COOKIE       1110646684
48
49 /* Hook names */
50 #define NG_SOURCE_HOOK_INPUT    "input"
51 #define NG_SOURCE_HOOK_OUTPUT   "output"
52
53 /* Statistics structure returned by NGM_SOURCE_GET_STATS */
54 struct ng_source_stats {
55         uint64_t        outOctets;
56         uint64_t        outFrames;
57         uint32_t        queueOctets;
58         uint32_t        queueFrames;
59         uint32_t        maxPps;
60         struct timeval  startTime;
61         struct timeval  endTime;
62         struct timeval  elapsedTime;
63         struct timeval  lastTime;
64 };
65
66 extern const struct ng_parse_type ng_source_timeval_type;
67 /* Keep this in sync with the above structure definition */
68 #define NG_SOURCE_STATS_TYPE_INFO       {                       \
69           { "outOctets",        &ng_parse_uint64_type   },      \
70           { "outFrames",        &ng_parse_uint64_type   },      \
71           { "queueOctets",      &ng_parse_uint32_type   },      \
72           { "queueFrames",      &ng_parse_uint32_type   },      \
73           { "maxPps",           &ng_parse_uint32_type   },      \
74           { "startTime",        &ng_source_timeval_type },      \
75           { "endTime",          &ng_source_timeval_type },      \
76           { "elapsedTime",      &ng_source_timeval_type },      \
77           { "lastTime",         &ng_source_timeval_type },      \
78           { NULL }                                              \
79 }
80
81 /* Netgraph commands */
82 enum {
83         NGM_SOURCE_GET_STATS = 1,       /* get stats */
84         NGM_SOURCE_CLR_STATS,           /* clear stats */
85         NGM_SOURCE_GETCLR_STATS,        /* atomically get and clear stats */
86         NGM_SOURCE_START,               /* start sending queued data */
87         NGM_SOURCE_STOP,                /* stop sending queued data */
88         NGM_SOURCE_CLR_DATA,            /* clear the queued data */
89         NGM_SOURCE_SETIFACE,            /* configure downstream iface */
90         NGM_SOURCE_SETPPS,              /* rate-limiting packets per second */
91 };
92
93 #endif /* _NETGRAPH_NG_SOURCE_H_ */