/home/tomh/openhip/hip-0.5/src/include/hip/hip_usermode.h

Go to the documentation of this file.
00001 /*
00002  * Host Identity Protocol
00003  * Copyright (C) 2002-04 the Boeing Company
00004  * 
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  *  hip_service.h
00016  *
00017  *  Authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
00018  * 
00019  * Definition of HIP Windows service thread functions.
00020  *
00021  */
00022 #ifdef __WIN32__
00023 #include <winsock2.h>
00024 #include <ws2tcpip.h>
00025 #else
00026 #include <sys/socket.h> /* struct sockaddr */
00027 #endif
00028 
00029 /*
00030  * Globally-accessible functions
00031  */
00032 /* Windows _beghinthread() uses different type than pthread_create() */
00033 #ifdef __WIN32__
00034 void hip_esp_output(void *arg);
00035 void hip_esp_input(void *arg);
00036 void hip_pfkey(void *arg);
00037 void tunreader(void *arg);
00038 void hip_dns(void *arg);
00039 void hipd_main(void *arg);
00040 void hip_netlink(void *arg);
00041 void hip_status(void *arg);
00042 extern int socketpair(int, int, int, int sv[2]);
00043 #define RETNULL ;
00044 #else
00045 void *hip_esp_output(void *arg);
00046 void *hip_esp_input(void *arg);
00047 void *hip_pfkey(void *arg);
00048 void *tunreader(void *arg);
00049 void *hip_dns(void *arg);
00050 void *hipd_main(void *arg);
00051 void *hip_netlink(void *arg);
00052 void *hip_status(void *arg);
00053 #define RETNULL NULL;
00054 #endif
00055 
00056 int init_esp_input(int family, int proto);
00057 int main_loop(int argc, char **argv);
00058 int str_to_addr(unsigned char *data, struct sockaddr *addr);
00059 
00060 int pfkey_send_acquire(struct sockaddr *target);
00061 
00062 /*
00063  * Global definitions
00064  */
00065 #ifndef CONFIG_HIP
00066 #define CONFIG_HIP
00067 #endif
00068 
00069 #define DNS_PORT 53
00070 #define HIP_DNS_SUFFIX ".hip"
00071 extern __u64 g_tap_mac;
00072 extern int g_state;
00073 
00074 /*
00075  * Macros from hip.h and elsewhere
00076  */
00077 /* get pointer to IP from a sockaddr 
00078  *    useful for inet_ntop calls     */
00079 #define SA2IP(x) (((struct sockaddr*)x)->sa_family==AF_INET) ? \
00080         (void*)&((struct sockaddr_in*)x)->sin_addr : \
00081         (void*)&((struct sockaddr_in6*)x)->sin6_addr
00082 /* get socket address length in bytes */
00083 #define SALEN(x) (((struct sockaddr*)x)->sa_family==AF_INET) ? \
00084         sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)
00085 /* get IP address length in bytes */
00086 #define SAIPLEN(x) (((struct sockaddr*)x)->sa_family==AF_INET) ? 4 : 16
00087 #define IS_LSI32(a) ((a & 0xFF) == 0x01)
00088 
00089 /* from linux/include/linux/kernel.h */
00090 #define NIPQUAD(addr) \
00091         ((unsigned char *)&addr)[0], \
00092         ((unsigned char *)&addr)[1], \
00093         ((unsigned char *)&addr)[2], \
00094         ((unsigned char *)&addr)[3]
00095 
00096 #define NIP6(addr) \
00097         ntohs((addr).s6_addr16[0]), \
00098         ntohs((addr).s6_addr16[1]), \
00099         ntohs((addr).s6_addr16[2]), \
00100         ntohs((addr).s6_addr16[3]), \
00101         ntohs((addr).s6_addr16[4]), \
00102         ntohs((addr).s6_addr16[5]), \
00103         ntohs((addr).s6_addr16[6]), \
00104         ntohs((addr).s6_addr16[7])
00105 
00106 #define TRUE 1
00107 #define FALSE 0
00108 

Generated on Mon Oct 22 11:43:43 2007 for OpenHIP by  doxygen 1.5.1