File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / coova-chilli / src / system.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:48:25 2012 UTC (13 years, 1 month ago) by misho
Branches: coova-chilli, MAIN
CVS tags: v1_0_12, HEAD
coova-chilli

    1: /*
    2:  * Copyright (c) 2006-2007 David Bird <david@coova.com>
    3:  *
    4:  */
    5: 
    6: #ifndef _SYSTEM_H
    7: #define _SYSTEM_H
    8: 
    9: #include "../config.h"
   10: 
   11: /*
   12:  *   I do not like this here, but otherwise
   13:  *   __u64 is not defined. Set by -ansi
   14:  */
   15: 
   16: #undef __STRICT_ANSI__
   17: 
   18: #include <stdio.h>
   19: #include <string.h>
   20: #include <time.h>
   21: #include <ctype.h>
   22: #include <stdarg.h>
   23: 
   24: #ifdef HAVE_STDLIB_H
   25: #include <stdlib.h>
   26: #endif
   27: 
   28: #ifdef HAVE_SYSLOG_H
   29: #include <syslog.h>
   30: #endif
   31: 
   32: #ifdef HAVE_UNISTD_H
   33: #include <unistd.h>
   34: #endif
   35: 
   36: #ifdef HAVE_ERRNO_H
   37: #include <errno.h>
   38: #endif
   39: 
   40: #ifdef HAVE_NETDB_H
   41: #include <netdb.h>
   42: #endif
   43: 
   44: #ifdef HAVE_FCNTL_H
   45: #include <fcntl.h>
   46: #endif
   47: 
   48: #ifdef HAVE_ARPA_INET_H
   49: #include <arpa/inet.h>
   50: #endif
   51: 
   52: #ifdef HAVE_SYS_TYPES_H
   53: #include <sys/types.h>
   54: #endif
   55: 
   56: #ifdef HAVE_SYS_SOCKET_H
   57: #include <sys/socket.h>
   58: #endif
   59: 
   60: #ifdef HAVE_SYS_STAT_H
   61: #include <sys/stat.h>
   62: #endif
   63: 
   64: #ifdef HAVE_SYS_TIME_H
   65: #include <sys/time.h>
   66: #endif
   67: 
   68: #ifdef HAVE_SYS_IOCTL_H
   69: #include <sys/ioctl.h>
   70: #endif
   71: 
   72: #ifdef HAVE_SYS_IPC_H
   73: #include <sys/ipc.h>
   74: #endif
   75: 
   76: #ifdef HAVE_SYS_MSG_H
   77: #include <sys/msg.h>
   78: #endif
   79: 
   80: #ifdef HAVE_SYS_WAIT_H
   81: #include <sys/wait.h>
   82: #endif
   83: 
   84: #ifdef HAVE_SYS_UN_H
   85: #include <sys/un.h>
   86: #endif
   87: 
   88: #if defined(__linux__)
   89: #include <asm/types.h>
   90: #include <linux/if.h>
   91: #include <linux/if_packet.h>
   92: #include <linux/if_ether.h>
   93: #include <linux/if_tun.h>
   94: #include <linux/netlink.h>
   95: #include <linux/rtnetlink.h>
   96: 
   97: #elif defined (__FreeBSD__)  || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) 
   98: #include <net/if.h>
   99: #include <net/bpf.h>
  100: #include <net/if_dl.h>
  101: #include <net/if_types.h>
  102: #include <ifaddrs.h>
  103: #endif
  104: 
  105: #ifndef EIDRM
  106: #define EIDRM   EINVAL
  107: #endif
  108: #ifndef ENOMSG
  109: #define ENOMSG  EAGAIN
  110: #endif
  111: 
  112: #ifdef HAVE_NETINET_IN_H
  113: #include <netinet/in.h>
  114: #endif
  115: 
  116: #if defined(HAVE_NET_IF_H) && !defined(__linux__)
  117: #include <net/if.h>
  118: #endif
  119: 
  120: #ifdef HAVE_NET_IF_TUN_H
  121: #include <net/if_tun.h>
  122: #endif
  123: 
  124: #ifdef HAVE_NET_ETHERNET_H
  125: #include <net/ethernet.h>
  126: #endif
  127: 
  128: #ifdef HAVE_ASM_TYPES_H
  129: #include <asm/types.h>
  130: #endif
  131: 
  132: #ifdef HAVE_NET_ROUTE_H
  133: #include <net/route.h>
  134: #endif
  135: 
  136: #ifdef HAVE_RESOLV_H
  137: #include <resolv.h>
  138: #endif
  139: 
  140: #ifdef HAVE_NET_IF_ARP_H
  141: #include <net/if_arp.h>
  142: #endif
  143: 
  144: #ifdef MTRACE
  145: #include <mcheck.h> 
  146: #endif
  147: 
  148: #ifdef DMALLOC
  149: #include <dmalloc.h>
  150: #endif
  151: 
  152: #ifdef HAVE_STDINT_H
  153: #include <stdint.h>
  154: #endif
  155: 
  156: #ifdef HAVE_SYS_PARAM_H
  157: #include <sys/param.h>
  158: #endif
  159: 
  160: #ifdef HAVE_ENDIAN_H
  161: #include <endian.h>
  162: #endif
  163: 
  164: #undef LITTLE_ENDIAN
  165: #undef BIG_ENDIAN
  166: 
  167: #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
  168:     (defined(i386) || defined(__i386__) || defined(__i486__) || \
  169:      defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
  170: # define LITTLE_ENDIAN 1
  171: # define BIG_ENDIAN 0
  172: #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN) || \
  173:       (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
  174: # define LITTLE_ENDIAN 0
  175: # define BIG_ENDIAN 1
  176: #else
  177: # define LITTLE_ENDIAN 0
  178: # define BIG_ENDIAN 0
  179: #endif
  180: 
  181: #include <unistd.h>
  182: #include <errno.h>
  183: 
  184: #ifndef TEMP_FAILURE_RETRY
  185: #define TEMP_FAILURE_RETRY(expression) \
  186:     ({ \
  187:         long int _result; \
  188:         do _result = (long int) (expression); \
  189:         while (_result == -1L && errno == EINTR); \
  190:         _result; \
  191:     })
  192: #endif
  193: 
  194: #include "bstrlib.h"
  195: 
  196: #endif

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