stun_internal.h

Go to the documentation of this file.
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 extern char const STUN_DEBUG[]; /* dummy declaration for Doxygen */
00075 
00076 /* XXX -- mela: note that this are 100 times too small */
00077 #if 1
00078 #define STUN_LIFETIME_EST 3500      
00079 #define STUN_LIFETIME_MAX 18000     
00080 #define STUN_LIFETIME_CI  50        
00081 #else
00082 #define STUN_LIFETIME_EST 350      
00083 #define STUN_LIFETIME_MAX 1800     
00084 #define STUN_LIFETIME_CI  5        
00085 #endif
00086 
00087 #define STUN_ERROR(err, what) \
00088   SU_DEBUG_5(("%s: %s: %s\n", __func__, #what, su_strerror(err))), \
00089     -1                                                             \
00090 
00091 int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
00092 
00093 /* internal functions declaration */
00094 int stun_make_sharedsecret_req(stun_msg_t *msg);
00095 
00096 int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
00097                       stun_msg_t *msg, stun_buffer_t *pwd);
00098 
00099 int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
00100                           stun_msg_t *msg, 
00101                           tag_type_t, tag_value_t, ...);
00102 int stun_process_response(stun_msg_t *msg);
00103 
00104 int stun_process_binding_response(stun_msg_t *msg);
00105 int stun_process_error_response(stun_msg_t *msg);
00106 
00107 int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in);
00108 int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr);
00109 
00110 SOFIA_END_DECLS
00111 
00112 #endif /* !defined(STUN_INTERNAL_H) */

Sofia-SIP 1.12.6 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.