LCOV - code coverage report
Current view: top level - netinet - ip_divert.h (source / functions) Hit Total Coverage
Test: 6.4 Lines: 0 3 0.0 %
Date: 2018-10-19 03:25:38 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*      $OpenBSD: ip_divert.h,v 1.11 2017/11/02 14:01:18 florian Exp $ */
       2             : 
       3             : /*
       4             :  * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
       5             :  *
       6             :  * Permission to use, copy, modify, and distribute this software for any
       7             :  * purpose with or without fee is hereby granted, provided that the above
       8             :  * copyright notice and this permission notice appear in all copies.
       9             :  *
      10             :  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      11             :  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
      12             :  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
      13             :  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
      14             :  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
      15             :  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      16             :  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      17             :  */
      18             : 
      19             : #ifndef _IP_DIVERT_H_
      20             : #define _IP_DIVERT_H_
      21             : 
      22             : struct divstat {
      23             :         u_long  divs_ipackets;  /* total input packets */
      24             :         u_long  divs_noport;    /* no socket on port */
      25             :         u_long  divs_fullsock;  /* not delivered, input socket full */
      26             :         u_long  divs_opackets;  /* total output packets */
      27             :         u_long  divs_errors;    /* generic errors */
      28             : };
      29             : 
      30             : /*
      31             :  * Names for divert sysctl objects
      32             :  */
      33             : #define DIVERTCTL_RECVSPACE     1       /* receive buffer space */
      34             : #define DIVERTCTL_SENDSPACE     2       /* send buffer space */
      35             : #define DIVERTCTL_STATS         3       /* divert statistics */
      36             : #define DIVERTCTL_MAXID         4
      37             : 
      38             : #define DIVERTCTL_NAMES { \
      39             :         { 0, 0 }, \
      40             :         { "recvspace",        CTLTYPE_INT }, \
      41             :         { "sendspace",        CTLTYPE_INT }, \
      42             :         { "stats",    CTLTYPE_STRUCT } \
      43             : }
      44             : 
      45             : #define DIVERTCTL_VARS { \
      46             :         NULL, \
      47             :         &divert_recvspace, \
      48             :         &divert_sendspace, \
      49             :         NULL \
      50             : }
      51             : 
      52             : #ifdef _KERNEL
      53             : 
      54             : #include <sys/percpu.h>
      55             : 
      56             : enum divstat_counters {
      57             :         divs_ipackets,
      58             :         divs_noport,
      59             :         divs_fullsock,
      60             :         divs_opackets,
      61             :         divs_errors,
      62             :         divs_ncounters,
      63             : };
      64             : 
      65             : extern struct cpumem *divcounters;
      66             : 
      67             : static inline void
      68           0 : divstat_inc(enum divstat_counters c)
      69             : {
      70           0 :         counters_inc(divcounters, c);
      71           0 : }
      72             : 
      73             : extern struct   inpcbtable      divbtable;
      74             : 
      75             : void     divert_init(void);
      76             : int      divert_packet(struct mbuf *, int, u_int16_t);
      77             : int      divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
      78             : int      divert_usrreq(struct socket *,
      79             :             int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
      80             : int      divert_attach(struct socket *, int);
      81             : int      divert_detach(struct socket *);
      82             : #endif /* _KERNEL */
      83             : #endif /* _IP_DIVERT_H_ */

Generated by: LCOV version 1.13