stun  1.13.17
stun_internal.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef STUN_INTERNAL_H
27 #define STUN_INTERNAL_H
36 #ifndef SU_DEBUG
37 #define SU_DEBUG 0
38 #endif
39 
40 #ifndef SU_WAIT_H
41 #include <sofia-sip/su_wait.h>
42 #endif
43 
44 #ifndef SU_TAG_H
45 #include <sofia-sip/su_tag.h>
46 #endif
47 
48 #ifndef STUN_H
49 #include "sofia-sip/stun.h"
50 #endif
51 
52 #if defined(HAVE_OPENSSL)
53 /* avoid krb5-related build failures */
54 #define OPENSSL_NO_KRB5
55 #include <openssl/sha.h>
56 #include <openssl/hmac.h>
57 #include <openssl/ssl.h>
58 #include <openssl/x509.h>
59 #endif
60 
61 #ifndef STUN_COMMON_H
62 #include "sofia-sip/stun_common.h"
63 #endif
64 
65 
66 
67 #define SU_LOG (stun_log)
68 #include <sofia-sip/su_debug.h>
69 
70 #define enter (void)SU_DEBUG_9(("%s: entering.\n", __func__))
71 
72 SOFIA_BEGIN_DECLS
73 
74 #ifdef DOXYGEN
75 extern char const STUN_DEBUG[]; /* dummy declaration for Doxygen */
76 #endif
77 
78 /* XXX -- mela: note that this are 100 times too small */
79 #if 1
80 #define STUN_LIFETIME_EST 3500
81 #define STUN_LIFETIME_MAX 18000
82 #define STUN_LIFETIME_CI 50
83 #else
84 #define STUN_LIFETIME_EST 350
85 #define STUN_LIFETIME_MAX 1800
86 #define STUN_LIFETIME_CI 5
87 #endif
88 
89 #define STUN_ERROR(err, what) \
90  SU_DEBUG_5(("%s: %s: %s\n", __func__, #what, su_strerror(err)))
91 
92 int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
93 
94 /* internal functions declaration */
95 int stun_make_sharedsecret_req(stun_msg_t *msg);
96 
97 int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
98  stun_msg_t *msg, stun_buffer_t *pwd);
99 
100 int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
101  stun_msg_t *msg,
102  tag_type_t, tag_value_t, ...);
103 int stun_process_response(stun_msg_t *msg);
104 
105 int stun_process_binding_response(stun_msg_t *msg);
106 int stun_process_error_response(stun_msg_t *msg);
107 
108 int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in);
109 int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr);
110 
111 SOFIA_END_DECLS
112 
113 #endif /* !defined(STUN_INTERNAL_H) */
STUN module public interface.
int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in)
Converts character address format to sockaddr_in.
Definition: stun.c:2608
int stun_process_error_response(stun_msg_t *msg)
process binding error response Report error and return
Definition: stun.c:2550
int stun_make_binding_req(stun_handle_t *se, stun_request_t *req, stun_msg_t *msg, tag_type_t, tag_value_t,...)
Compose a STUN message of the format defined by stun_msg_t.
Definition: stun.c:2418
int stun_process_binding_response(stun_msg_t *msg)
process binding response
Definition: stun.c:2541
int stun_make_sharedsecret_req(stun_msg_t *msg)
Compose a STUN message of the format defined by stun_msg_t result encoded in enc_buf ready for sendin...
Definition: stun.c:1592
int stun_is_requested(tag_type_t tag, tag_value_t value,...)
Check if a STUN handle should be created.
Definition: stun.c:400
int su_socket_t
struct addrinfo su_addrinfo_t
SU_HOME_T su_home_t
intptr_t tag_value_t
struct tag_type_s const * tag_type_t

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