stun 1.12.11devel
Loading...
Searching...
No Matches
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
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
72SOFIA_BEGIN_DECLS
73
74#ifdef DOXYGEN
75extern 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 -1 \
92
93int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
94
95/* internal functions declaration */
96int stun_make_sharedsecret_req(stun_msg_t *msg);
97
98int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
99 stun_msg_t *msg, stun_buffer_t *pwd);
100
101void stun_free_message_data(stun_msg_t *msg);
102
103int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
104 stun_msg_t *msg,
105 tag_type_t, tag_value_t, ...);
106int stun_process_response(stun_msg_t *msg);
107
108int stun_process_binding_response(stun_msg_t *msg);
109int stun_process_error_response(stun_msg_t *msg);
110
111int stun_atoaddr(su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in);
112int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr);
113
114SOFIA_END_DECLS
115
116#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:2593
int stun_process_error_response(stun_msg_t *msg)
process binding error response Report error and return
Definition stun.c:2535
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:2403
int stun_process_binding_response(stun_msg_t *msg)
process binding response
Definition stun.c:2526
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:1577
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.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.