LTP GCOV extension - code coverage report
Current view: directory - trunk/libtun6 - tun6.h
Test: lcov.info
Date: 2007-05-09 Instrumented lines: 4
Code covered: 0.0 % Executed lines: 0

       1                 : /*
       2                 :  * tun6.h - IPv6 tunnel interface declaration
       3                 :  * $Id: tun6.h 1552 2006-07-04 15:38:38Z remi $
       4                 :  */
       5                 : 
       6                 : /***********************************************************************
       7                 :  *  Copyright © 2004-2006 Rémi Denis-Courmont.                         *
       8                 :  *  This program is free software; you can redistribute and/or modify  *
       9                 :  *  it under the terms of the GNU General Public License as published  *
      10                 :  *  by the Free Software Foundation; version 2 of the license.         *
      11                 :  *                                                                     *
      12                 :  *  This program is distributed in the hope that it will be useful,    *
      13                 :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
      14                 :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               *
      15                 :  *  See the GNU General Public License for more details.               *
      16                 :  *                                                                     *
      17                 :  *  You should have received a copy of the GNU General Public License  *
      18                 :  *  along with this program; if not, you can get it from:              *
      19                 :  *  http://www.gnu.org/copyleft/gpl.html                               *
      20                 :  ***********************************************************************/
      21                 : 
      22                 : #ifndef LIBTUN6_TUN6_H
      23                 : # define LIBTUN6_TUN6_H
      24                 : 
      25                 : # include <stddef.h> /* NULL */
      26                 : # include <stdbool.h>
      27                 : # include <sys/types.h>
      28                 : # include <sys/select.h>
      29                 : 
      30                 : # define LIBTUN6_ERRBUF_SIZE 4096
      31                 : 
      32                 : # if __STDC_VERSION__ < 199901L
      33                 : #  ifndef inline
      34                 : #   define inline
      35                 : #  endif
      36                 : #  ifndef restrict
      37                 : #   define restrict
      38                 : #  endif
      39                 : # endif
      40                 : 
      41                 : # ifdef __GNUC__
      42                 : #  define LIBTUN6_NONNULL __attribute__ ((nonnull))
      43                 : #  if __GNUC__ >= 3
      44                 : #   define LIBTUN6_PURE __attribute__ ((pure))
      45                 : #  else
      46                 : #   define LIBTUN6_PURE
      47                 : #  endif
      48                 : #  if __GNUC__ >= 4
      49                 : #   define LIBTUN6_WARN_UNUSED __attribute__ ((warn_unused_result))
      50                 : #  else
      51                 : #   define LIBTUN6_WARN_UNUSED
      52                 : #  endif
      53                 : # else
      54                 : #  define LIBTUN6_NONNULL
      55                 : #  define LIBTUN6_WARN_UNUSED
      56                 : #  define LIBTUN6_PURE
      57                 : # endif
      58                 : 
      59                 : struct ip6_hdr;
      60                 : struct in6_addr;
      61                 : 
      62                 : typedef struct tun6 tun6;
      63                 : 
      64                 : # ifdef __cplusplus
      65                 : extern "C" {
      66                 : # endif
      67                 : int tun6_driver_diagnose (char *errbuf) LIBTUN6_NONNULL;
      68                 : 
      69                 : /*
      70                 :  * All functions are thread-safe.
      71                 :  *
      72                 :  * All functions reports error messages via syslog(). You should hence call
      73                 :  * openlog() before you create a tunnel.
      74                 :  */
      75                 : 
      76                 : tun6 *tun6_create (const char *req_name) LIBTUN6_WARN_UNUSED;
      77                 : void tun6_destroy (tun6 *t) LIBTUN6_NONNULL;
      78                 : 
      79                 : int tun6_getId (const tun6 *t) LIBTUN6_NONNULL;
      80                 : 
      81                 : int tun6_setState (tun6 *t, bool up) LIBTUN6_NONNULL;
      82                 : static inline int tun6_bringUp (tun6 *t)
      83               0 : {
      84               0 :         return tun6_setState (t, true);
      85                 : }
      86                 : 
      87                 : static inline int tun6_bringDown (tun6 *t)
      88               0 : {
      89               0 :         return tun6_setState (t, false);
      90                 : }
      91                 : 
      92                 : int tun6_addAddress (tun6 *restrict t, const struct in6_addr *restrict addr,
      93                 :                      unsigned prefix_len) LIBTUN6_NONNULL;
      94                 : int tun6_delAddress (tun6 *restrict t, const struct in6_addr *restrict addr,
      95                 :                      unsigned prefix_len) LIBTUN6_NONNULL;
      96                 : 
      97                 : int tun6_setMTU (tun6 *t, unsigned mtu) LIBTUN6_NONNULL;
      98                 : 
      99                 : int tun6_addRoute (tun6 *restrict t, const struct in6_addr *restrict addr,
     100                 :                    unsigned prefix_len, int relative_metric) LIBTUN6_NONNULL;
     101                 : int tun6_delRoute (tun6 *restrict t, const struct in6_addr *restrict addr,
     102                 :                    unsigned prefix_len, int relative_metric) LIBTUN6_NONNULL;
     103                 : 
     104                 : int tun6_registerReadSet (const tun6 *restrict t, fd_set *restrict readset)
     105                 :         LIBTUN6_NONNULL LIBTUN6_PURE;
     106                 : 
     107                 : int tun6_recv (tun6 *restrict t, const fd_set *restrict readset,
     108                 :                void *buf, size_t len) LIBTUN6_NONNULL;
     109                 : int tun6_wait_recv (tun6 *restrict t, void *buf, size_t len) LIBTUN6_NONNULL;
     110                 : int tun6_send (tun6 *restrict t, const void *packet, size_t len)
     111                 :         LIBTUN6_NONNULL;
     112                 : 
     113                 : # ifdef __cplusplus
     114                 : }
     115                 : # endif /* C++ */
     116                 : 
     117                 : #endif /* ifndef LIBTUN6_TUN6_H */

Generated by: LTP GCOV extension version 1.5