stun 1.12.11devel
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef STUN_INTERNAL_H 00026 00027 #define STUN_INTERNAL_H 00028 00036 #ifndef SU_DEBUG 00037 #define SU_DEBUG 0 00038 #endif 00039 00040 #ifndef SU_WAIT_H 00041 #include <sofia-sip/su_wait.h> 00042 #endif 00043 00044 #ifndef SU_TAG_H 00045 #include <sofia-sip/su_tag.h> 00046 #endif 00047 00048 #ifndef STUN_H 00049 #include "sofia-sip/stun.h" 00050 #endif 00051 00052 #if defined(HAVE_OPENSSL) 00053 /* avoid krb5-related build failures */ 00054 #define OPENSSL_NO_KRB5 00055 #include <openssl/sha.h> 00056 #include <openssl/hmac.h> 00057 #include <openssl/ssl.h> 00058 #include <openssl/x509.h> 00059 #endif 00060 00061 #ifndef STUN_COMMON_H 00062 #include "sofia-sip/stun_common.h" 00063 #endif 00064 00065 00066 00067 #define SU_LOG (stun_log) 00068 #include <sofia-sip/su_debug.h> 00069 00070 #define enter (void)SU_DEBUG_9(("%s: entering.\n", __func__)) 00071 00072 SOFIA_BEGIN_DECLS 00073 00074 #ifdef DOXYGEN 00075 extern char const STUN_DEBUG[]; /* dummy declaration for Doxygen */ 00076 #endif 00077 00078 /* XXX -- mela: note that this are 100 times too small */ 00079 #if 1 00080 #define STUN_LIFETIME_EST 3500 00081 #define STUN_LIFETIME_MAX 18000 00082 #define STUN_LIFETIME_CI 50 00083 #else 00084 #define STUN_LIFETIME_EST 350 00085 #define STUN_LIFETIME_MAX 1800 00086 #define STUN_LIFETIME_CI 5 00087 #endif 00088 00089 #define STUN_ERROR(err, what) \ 00090 SU_DEBUG_5(("%s: %s: %s\n", __func__, #what, su_strerror(err))), \ 00091 -1 \ 00092 00093 int stun_is_requested(tag_type_t tag, tag_value_t value, ...); 00094 00095 /* internal functions declaration */ 00096 int stun_make_sharedsecret_req(stun_msg_t *msg); 00097 00098 int stun_send_message(su_socket_t s, su_sockaddr_t *srvr, 00099 stun_msg_t *msg, stun_buffer_t *pwd); 00100 00101 void stun_free_message_data(stun_msg_t *msg); 00102 00103 int stun_make_binding_req(stun_handle_t *se, stun_request_t *req, 00104 stun_msg_t *msg, 00105 tag_type_t, tag_value_t, ...); 00106 int stun_process_response(stun_msg_t *msg); 00107 00108 int stun_process_binding_response(stun_msg_t *msg); 00109 int stun_process_error_response(stun_msg_t *msg); 00110 00111 int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in); 00112 int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr); 00113 00114 SOFIA_END_DECLS 00115 00116 #endif /* !defined(STUN_INTERNAL_H) */