00001 /* 00002 * Host Identity Protocol 00003 * 00004 * STUN client based on the code provided by Vovida Networks, Inc. 00005 * (see end of file) 00006 * Translated from C++ code to C code by Vivien Schmitt 00007 * 00008 * hip_stun_udp.h 00009 * 00010 * Author : Vivien Schmitt, <schmitt@netlab.nec.de> 00011 * 00012 * STUN client used for NAT detection 00013 * 00014 */ 00015 00016 00017 00018 00019 00020 #ifndef stun_udp_h 00021 #define stun_udp_h 00022 00023 #define TRUE 1 00024 #define FALSE 0 00025 00026 #include <errno.h> 00027 00028 #ifndef __WIN32__ 00029 static const int INVALID_SOCKET = -1; 00030 static const int SOCKET_ERROR = -1; 00031 00032 int closesocket( int fd ); 00033 00034 int getErrno(); 00035 00036 #define WSANOTINITIALISED EPROTONOSUPPORT 00037 #endif /* __WIN32__ */ 00038 00039 /* 00043 int 00044 openPort( unsigned short port, unsigned int interfaceIp, 00045 int verbose); 00046 00047 00048 /*/ recive a UDP message */ 00049 int 00050 getMessage( int fd, char* buf, int* len, 00051 unsigned int* srcIp, unsigned short* srcPort, 00052 int verbose); 00053 00054 00055 /*/ send a UDP message */ 00056 int 00057 sendMessage( int fd, char* msg, int len, 00058 unsigned int dstIp, unsigned short dstPort, 00059 int verbose); 00060 00061 00062 00063 /* ==================================================================== 00064 * The Vovida Software License, Version 1.0 00065 * 00066 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00067 * 00068 * Redistribution and use in source and binary forms, with or without 00069 * modification, are permitted provided that the following conditions 00070 * are met: 00071 * 00072 * 1. Redistributions of source code must retain the above copyright 00073 * notice, this list of conditions and the following disclaimer. 00074 * 00075 * 2. Redistributions in binary form must reproduce the above copyright 00076 * notice, this list of conditions and the following disclaimer in 00077 * the documentation and/or other materials provided with the 00078 * distribution. 00079 * 00080 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00081 * and "Vovida Open Communication Application Library (VOCAL)" must 00082 * not be used to endorse or promote products derived from this 00083 * software without prior written permission. For written 00084 * permission, please contact vocal@vovida.org. 00085 * 00086 * 4. Products derived from this software may not be called "VOCAL", nor 00087 * may "VOCAL" appear in their name, without prior written 00088 * permission of Vovida Networks, Inc. 00089 * 00090 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00091 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00092 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00093 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00094 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00095 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00096 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00097 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00098 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00099 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00100 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00101 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00102 * DAMAGE. 00103 * 00104 * ==================================================================== 00105 * 00106 * This software consists of voluntary contributions made by Vovida 00107 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00108 * Inc. For more information on Vovida Networks, Inc., please see 00109 * <http://www.vovida.org/>. 00110 * 00111 */ 00112 00113 00114 #endif
1.5.1