File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libnet / win32 / libnet.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Sep 27 11:11:37 2023 UTC (18 months, 1 week ago) by misho
Branches: libnet, MAIN
CVS tags: v1_2p1, HEAD
Version 1.2p1

    1: /*
    2:  *  $Id: libnet.h,v 1.1.1.1 2023/09/27 11:11:37 misho Exp $
    3:  *
    4:  *  libnet.h - Network routine library header file for Win32 VC++
    5:  *
    6:  *  Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
    7:  *  All rights reserved.
    8:  *
    9:  * Redistribution and use in source and binary forms, with or without
   10:  * modification, are permitted provided that the following conditions
   11:  * are met:
   12:  * 1. Redistributions of source code must retain the above copyright
   13:  *    notice, this list of conditions and the following disclaimer.
   14:  * 2. Redistributions in binary form must reproduce the above copyright
   15:  *    notice, this list of conditions and the following disclaimer in the
   16:  *    documentation and/or other materials provided with the distribution.
   17:  *
   18:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28:  * SUCH DAMAGE.
   29:  *
   30:  */
   31: 
   32: #ifdef _WIN32
   33: 
   34: #ifndef __LIBNET_H
   35: #define __LIBNET_H
   36: 
   37: #include <winsock2.h>
   38: #include <windows.h>
   39: #include <time.h>
   40: #include "pcap.h"
   41: 
   42: 
   43: #ifdef __cplusplus
   44: extern "C" {
   45: #endif

   46: 
   47: /* __WIN32__ is NOT a predefined MACRO, use _WIN32
   48:  * __CYGWIN__ is defined within the cygwin environment.
   49:  */ 
   50: #ifndef __WIN32__
   51: #define __WIN32__ _WIN32
   52: #endif

   53: 
   54: #define LIBNET_LIL_ENDIAN 1
   55: #define HAVE_CONFIG_H 1
   56: 
   57: /* TODO Definitions and includes below should be in a private header, libnet src needs them, libnet
   58:    library users don't (and they have negative side effects).
   59:    */
   60: /* Some UNIX to Win32 conversions */
   61: #define snprintf _snprintf 
   62: #define strdup _strdup
   63: #define write _write
   64: #define open _open
   65: #define random rand
   66: #define close closesocket
   67: #define __func__ __FUNCTION__
   68: #ifndef _CRT_SECURE_NO_WARNINGS
   69: #define _CRT_SECURE_NO_WARNINGS
   70: #endif

   71: 
   72: /* __FUNCTION__ available in VC ++ 7.0 (.NET) and greater */
   73: #if _MSC_VER < 1300
   74: #define __FUNCTION__ __FILE__
   75: #endif

   76: 
   77: /* the following is only supported by MSVC and not by MinGW/MSys environments */
   78: #ifdef _MSC_VER
   79: #pragma comment (lib,"ws2_32")    /* Winsock 2 */
   80: #pragma comment (lib,"iphlpapi")  /* IP Helper */
   81: #pragma comment (lib,"wpcap")     /* Winpcap   */
   82: #pragma comment (lib,"packet")   
   83: #endif

   84: 
   85: /* FIXME this needs manual update during release packaging. */
   86: #define LIBNET_VERSION  "1.1.6"
   87: 
   88: /* To use Win32 native versions */
   89: #define WPCAP 1
   90: #ifndef _GNU_SOURCE
   91: #define _GNU_SOURCE
   92: #endif

   93: #include <stdio.h>
   94: #include <string.h>
   95: #include <fcntl.h>
   96: #include <signal.h>
   97: #include <stdlib.h>
   98: #include <sys/stat.h>
   99: #include <sys/types.h>
  100: #include <ctype.h>
  101: #include <errno.h>
  102: #include <stdarg.h>
  103: 
  104: #define LIBNET_API __declspec(dllexport)
  105: 
  106: #include "libnet/stdint.h"
  107: #include "libnet/libnet-macros.h"
  108: #include "libnet/libnet-headers.h"
  109: #include "libnet/libnet-structures.h"
  110: #include "libnet/libnet-asn1.h"
  111: #include "libnet/libnet-functions.h"
  112: 
  113: #ifdef __cplusplus
  114: }
  115: #endif

  116: 
  117: #endif  /* __LIBNET_H */
  118: 
  119: #endif


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>