/* Copyright (c) 1999 by Inria Lorraine.  All Rights Reserved */

/***
   NAME
     portability.h
   PURPOSE
     
   NOTES
     
   HISTORY
     chelius - Jul 25, 1999: Created.
     $Log: portability.h,v $
     Revision 1.1  2000/04/27 15:51:27  sdalu
     mise a jour jdk[12]: phase 2

     Revision 1.1.1.1  1999/07/25 15:02:05  chelius
     First release of the ipv6 packages for java

***/
#ifndef __PORTABILITY
#define __PORTABILITY

#ifdef NODE 
#define GETIPNODEBYNAME
#else 
#define GETHOSTBYNAME2
#endif //NODE

#ifdef NODE
#define GETIPNODEBYADDR
#else
#define GETNAMEINFO
#endif //NODE

#ifndef IPV6_AUTH_TRANS_LEVEL 
#define IPV6_AUTH_TRANS_LEVEL -1
#endif 
#ifndef IPV6_AUTH_NETWORK_LEVEL 
#define IPV6_AUTH_NETWORK_LEVEL -1
#endif
#ifndef IPV6_ESP_TRANS_LEVEL 
#define IPV6_ESP_TRANS_LEVEL -1
#endif
#ifndef IPV6_ESP_NETWORK_LEVEL 
#define IPV6_ESP_NETWORK_LEVEL -1
#endif
#ifndef IPV6_ADD_MEMBERSHIP
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP 
#endif
#ifndef IPV6_DROP_MEMBERSHIP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP 
#endif
#ifndef IPV6_REUSE_ADDR
#define IPV6_REUSE_ADDR IPV6_REUSE_PORT 
#endif
#ifndef EPROTO
#define EPROTO EPROTOTYPE
#endif

#ifdef NET
#define PACKAGE_INITPROTO Java_java_net_PlainSocketImpl_initProto
#define PACKAGE_SOCKETCREATE Java_java_net_PlainSocketImpl_socketCreate
#define PACKAGE_SOCKETCONNECT Java_java_net_PlainSocketImpl_socketConnect
#define PACKAGE_SOCKETBIND Java_java_net_PlainSocketImpl_socketBind
#define PACKAGE_SOCKETLISTEN Java_java_net_PlainSocketImpl_socketListen
#define PACKAGE_SOCKETACCEPT Java_java_net_PlainSocketImpl_socketAccept
#define PACKAGE_SOCKETAVAILABLE Java_java_net_PlainSocketImpl_socketAvailable
#define PACKAGE_SOCKETCLOSE Java_java_net_PlainSocketImpl_socketClose
#define PACKAGE_SOCKETSETOPTION Java_java_net_PlainSocketImpl_socketSetOption
#define PACKAGE_SOCKETGETOPTION Java_java_net_PlainSocketImpl_socketGetOption
#define PACKAGE_SOCKETREAD Java_java_net_SocketInputStream_socketRead
#define PACKAGE_SOCKETWRITE Java_java_net_SocketOutputStream_socketWrite
#define PACKAGE_IA_GETLOCALHOSTNAME Java_java_net_InetAddressImpl_getLocalHostName
#define PACKAGE_IA_MAKEANYLOCALADDRESS  Java_java_net_InetAddressImpl_makeAnyLocalAddress
#define PACKAGE_IA_GETINETFAMILY Java_java_net_InetAddressImpl_getInetFamily
#define PACKAGE_IA_GETTEXTADDRESS Java_java_net_InetAddressImpl_gettextaddress
#define PACKAGE_IA_GETBYNAMEIPV6 Java_java_net_InetAddressImpl_getbynameipv6
#define PACKAGE_IA_LOOKUPALLHOSTADDR Java_java_net_InetAddressImpl_lookupAllHostAddr
#define PACKAGE_IA_GETHOSTBYADDR Java_java_net_InetAddressImpl_getHostByAddr
#define PACKAGE_DATAGRAMSOCKETCREATE Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate
#define PACKAGE_DATAGRAMSOCKETCLOSE Java_java_net_PlainDatagramSocketImpl_datagramSocketClose
#define PACKAGE_DATAGRAMSOCKETBIND Java_java_net_PlainDatagramSocketImpl_bind
#define PACKAGE_DATAGRAMSOCKETSEND Java_java_net_PlainDatagramSocketImpl_send
#define PACKAGE_DATAGRAMSOCKETPEEK Java_java_net_PlainDatagramSocketImpl_peek
#define PACKAGE_DATAGRAMSOCKETRECEIVE Java_java_net_PlainDatagramSocketImpl_receive
#define PACKAGE_DATAGRAMSOCKETSETOPTION Java_java_net_PlainDatagramSocketImpl_socketSetOption
#define PACKAGE_DATAGRAMSOCKETGETOPTION Java_java_net_PlainDatagramSocketImpl_socketGetOption
#define PACKAGE_DATAGRAMSOCKETSETHOPS Java_java_net_PlainDatagramSocketImpl_setHOPS
#define PACKAGE_DATAGRAMSOCKETGETHOPS Java_java_net_PlainDatagramSocketImpl_getHOPS
#define PACKAGE_DATAGRAMSOCKETJOIN Java_java_net_PlainDatagramSocketImpl_join
#define PACKAGE_DATAGRAMSOCKETLEAVE Java_java_net_PlainDatagramSocketImpl_leave
#define PACKAGE_RAWSOCKETCREATE Java_java_net_PlainRawSocketImpl_rawSocketCreate
#define PACKAGE_RAWSOCKETCLOSE Java_java_net_PlainRawSocketImpl_rawSocketClose
#define PACKAGE_RAWSOCKETBIND Java_java_net_PlainRawSocketImpl_bind
#define PACKAGE_RAWSOCKETSEND Java_java_net_PlainRawSocketImpl_send
#define PACKAGE_RAWSOCKETPEEK Java_java_net_PlainRawSocketImpl_peek
#define PACKAGE_RAWSOCKETRECEIVE Java_java_net_PlainRawSocketImpl_receive
#define PACKAGE_RAWSOCKETSETOPTION Java_java_net_PlainRawSocketImpl_socketSetOption
#define PACKAGE_RAWSOCKETGETOPTION Java_java_net_PlainRawSocketImpl_socketGetOption
#define PACKAGE_RAWSOCKETSETCHECKSUM Java_java_net_PlainRawSocketImpl_setChecksum
#define PACKAGE_RAWSOCKETGETCHECKSUM Java_java_net_PlainRawSocketImpl_getChecksum
#define PACKAGE_InetAddress "Ljava/net/InetAddress;"
#define PACKAGE_SocketImpl "Ljava/net/SocketImpl;"
#endif /* NET */



#ifdef NET6
#define PACKAGE_INITPROTO Java_fr_loria_resedas_net6_PlainSocketImpl6_initProto
#define PACKAGE_SOCKETCREATE Java_fr_loria_resedas_net6_PlainSocketImpl6_socketCreate6
#define PACKAGE_SOCKETCONNECT Java_fr_loria_resedas_net6_PlainSocketImpl6_socketConnect6
#define PACKAGE_SOCKETBIND Java_fr_loria_resedas_net6_PlainSocketImpl6_socketBind6
#define PACKAGE_SOCKETLISTEN Java_fr_loria_resedas_net6_PlainSocketImpl6_socketListen6
#define PACKAGE_SOCKETACCEPT Java_fr_loria_resedas_net6_PlainSocketImpl6_socketAccept6
#define PACKAGE_SOCKETAVAILABLE Java_fr_loria_resedas_net6_PlainSocketImpl6_socketAvailable6
#define PACKAGE_SOCKETCLOSE Java_fr_loria_resedas_net6_PlainSocketImpl6_socketClose6
#define PACKAGE_SOCKETSETOPTION Java_fr_loria_resedas_net6_PlainSocketImpl6_socketSetOption6
#define PACKAGE_SOCKETGETOPTION Java_fr_loria_resedas_net6_PlainSocketImpl6_socketGetOption6
#define PACKAGE_SOCKETREAD Java_fr_loria_resedas_net6_SocketInputStream6_socketRead
#define PACKAGE_SOCKETWRITE Java_fr_loria_resedas_net6_SocketOutputStream6_socketWrite
#define PACKAGE_IA_GETLOCALHOSTNAME Java_fr_loria_resedas_net6_InetAddressImpl6_getLocalHostName6
#define PACKAGE_IA_MAKEANYLOCALADDRESS Java_fr_loria_resedas_net6_InetAddressImpl6_makeAnyLocalAddress6
#define PACKAGE_IA_GETINETFAMILY Java_fr_loria_resedas_net6_InetAddressImpl6_getInetFamily6
#define PACKAGE_IA_GETTEXTADDRESS Java_fr_loria_resedas_net6_InetAddressImpl6_gettextaddress
#define PACKAGE_IA_GETBYNAMEIPV6 Java_fr_loria_resedas_net6_InetAddressImpl6_getbynameipv6
#define PACKAGE_IA_LOOKUPALLHOSTADDR Java_fr_loria_resedas_net6_InetAddressImpl6_lookupAllHostAddr6
#define PACKAGE_IA_GETHOSTBYADDR Java_fr_loria_resedas_net6_InetAddressImpl6_getHostByAddr6
#define PACKAGE_DATAGRAMSOCKETCREATE Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_datagramSocketCreate6
#define PACKAGE_DATAGRAMSOCKETCLOSE Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_datagramSocketClose6
#define PACKAGE_DATAGRAMSOCKETBIND Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_bind
#define PACKAGE_DATAGRAMSOCKETSEND Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_send
#define PACKAGE_DATAGRAMSOCKETPEEK Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_peek
#define PACKAGE_DATAGRAMSOCKETRECEIVE Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_receive
#define PACKAGE_DATAGRAMSOCKETSETOPTION Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_socketSetOption6
#define PACKAGE_DATAGRAMSOCKETGETOPTION Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_socketGetOption6
#define PACKAGE_DATAGRAMSOCKETSETHOPS Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_setHOPS
#define PACKAGE_DATAGRAMSOCKETGETHOPS Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_getHOPS
#define PACKAGE_DATAGRAMSOCKETJOIN Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_join
#define PACKAGE_DATAGRAMSOCKETLEAVE Java_fr_loria_resedas_net6_PlainDatagramSocketImpl6_leave 
#define PACKAGE_RAWSOCKETCREATE  Java_fr_loria_resedas_net6_PlainRawSocketImpl6_rawSocketCreate6
#define PACKAGE_RAWSOCKETCLOSE Java_fr_loria_resedas_net6_PlainRawSocketImpl6_rawSocketClose6
#define PACKAGE_RAWSOCKETBIND Java_fr_loria_resedas_net6_PlainRawSocketImpl6_bind
#define PACKAGE_RAWSOCKETSEND Java_fr_loria_resedas_net6_PlainRawSocketImpl6_send
#define PACKAGE_RAWSOCKETPEEK Java_fr_loria_resedas_net6_PlainRawSocketImpl6_peek
#define PACKAGE_RAWSOCKETRECEIVE Java_fr_loria_resedas_net6_PlainRawSocketImpl6_receive
#define PACKAGE_RAWSOCKETSETOPTION Java_fr_loria_resedas_net6_PlainRawSocketImpl6_socketSetOption6
#define PACKAGE_RAWSOCKETGETOPTION Java_fr_loria_resedas_net6_PlainRawSocketImpl6_socketGetOption6
#define PACKAGE_RAWSOCKETSETCHECKSUM Java_fr_loria_resedas_net6_PlainRawSocketImpl6_setChecksum
#define PACKAGE_RAWSOCKETGETCHECKSUM Java_fr_loria_resedas_net6_PlainRawSocketImpl6_getChecksum
#define PACKAGE_InetAddress "Lfr/loria/resedas/net6/InetAddress6;"
#define PACKAGE_SocketImpl "Lfr/loria/resedas/net6/SocketImpl6;"
#endif /* NET6 */

#ifndef IN6_IS_ADDR_ANY 
#define IN6_IS_ADDR_ANY(a)      \
        (((a)->s6_addr32[0] == 0) &&    \
         ((a)->s6_addr32[1] == 0) &&    \
         ((a)->s6_addr32[2] == 0) &&    \
         ((a)->s6_addr32[3] == 0))
#endif /* IN6_IS_ADDR_ANY */

#endif /* __PORTABILITY */

