Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

Classes | Defines | Typedefs | Enumerations | Functions | Variables

stun.c File Reference

#include "config.h"
#include <assert.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <sofia-sip/stun.h>
#include "stun_internal.h"
#include <sofia-sip/stun_tag.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/su_log.h>
#include <sofia-sip/su.h>
#include <sofia-sip/su_localinfo.h>
Include dependency graph for stun.c:

Go to the source code of this file.

Classes

struct  stun_discovery_s
struct  stun_handle_s
struct  stun_request_s

Defines

#define CHG_IP   0x001
#define CHG_PORT   0x004
#define SOL_TCP   IPPROTO_TCP
#define STUN_STATE_STR(x)   case x: return #x
#define SU_DEBUG   3
#define SU_ROOT_MAGIC_T   struct stun_magic_t
#define x_insert(l, n, x)
#define x_is_inserted(n, x)   ((n)->x##_prev != NULL)
#define x_remove(n, x)

Typedefs

typedef enum stun_req_state_e stun_req_state_t

Enumerations

enum  { STUN_SENDTO_TIMEOUT = 1000, STUN_TLS_CONNECT_TIMEOUT = 8000 }
enum  stun_req_state_e {
  stun_req_no_assigned_event, stun_req_dispose_me, stun_req_discovery_init, stun_req_discovery_processing,
  stun_req_error, stun_req_timeout
}

Functions

static int action_bind (stun_request_t *req, stun_msg_t *binding_response)
static int action_determine_nattype (stun_request_t *req, stun_msg_t *binding_response)
static int assign_socket (stun_discovery_t *sd, su_socket_t s, int register_socket)
static int do_action (stun_handle_t *sh, stun_msg_t *binding_response)
su_inline stun_request_tfind_request (stun_handle_t *self, void *id)
su_inline stun_action_t get_action (stun_request_t *req)
static int priv_dns_queue_action (stun_handle_t *sh, stun_action_t action, stun_discovery_f sdf, stun_discovery_magic_t *magic, tag_type_t tag, tag_value_t value,...)
static int priv_find_matching_localadress (su_sockaddr_t *su)
static void priv_lookup_cb (stun_dns_lookup_t *self, stun_magic_t *magic)
static void priv_mark_discovery_done (stun_discovery_t *sd, stun_handle_t *sh, stun_action_t action, stun_request_t *req)
static int priv_stun_bind_send (stun_handle_t *sh, stun_request_t *req, stun_discovery_t *sd)
static int process_binding_request (stun_request_t *req, stun_msg_t *binding_response)
static int process_test_lifetime (stun_request_t *req, stun_msg_t *binding_response)
int stun_add_response_address (stun_msg_t *req, struct sockaddr_in *mapped_addr)
int stun_atoaddr (su_home_t *home, int ai_family, su_addrinfo_t *info, char const *in)
int stun_bind (stun_handle_t *sh, stun_discovery_f sdf, stun_discovery_magic_t *magic, tag_type_t tag, tag_value_t value,...)
static int stun_bind_callback (stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
static stun_discovery_tstun_discovery_create (stun_handle_t *sh, stun_action_t action, stun_discovery_f sdf, stun_discovery_magic_t *magic)
static int stun_discovery_destroy (stun_discovery_t *sd)
int stun_discovery_get_address (stun_discovery_t *sd, void *addr, socklen_t *return_addrlen)
su_socket_t stun_discovery_get_socket (stun_discovery_t *sd)
int stun_discovery_release_socket (stun_discovery_t *sd)
void stun_handle_destroy (stun_handle_t *sh)
stun_handle_t * stun_handle_init (su_root_t *root, tag_type_t tag, tag_value_t value,...)
int stun_is_requested (tag_type_t tag, tag_value_t value,...)
int stun_keepalive (stun_handle_t *sh, su_sockaddr_t *sa, tag_type_t tag, tag_value_t value,...)
int stun_keepalive_destroy (stun_handle_t *sh, su_socket_t s)
static void stun_keepalive_timer_cb (su_root_magic_t *magic, su_timer_t *t, su_timer_arg_t *arg)
int stun_lifetime (stun_discovery_t *sd)
int stun_make_binding_req (stun_handle_t *sh, stun_request_t *req, stun_msg_t *msg, tag_type_t tag, tag_value_t value,...)
int stun_make_sharedsecret_req (stun_msg_t *msg)
int stun_message_length (void *data, isize_t len, int end_of_message)
int stun_msg_is_keepalive (uint16_t data)
stun_nattype_t stun_nattype (stun_discovery_t *sd)
char const * stun_nattype_str (stun_discovery_t *sd)
int stun_obtain_shared_secret (stun_handle_t *sh, stun_discovery_f sdf, stun_discovery_magic_t *magic, tag_type_t tag, tag_value_t value,...)
int stun_process_binding_response (stun_msg_t *msg)
int stun_process_error_response (stun_msg_t *msg)
int stun_process_message (stun_handle_t *sh, su_socket_t s, su_sockaddr_t *sa, socklen_t salen, void *data, isize_t len)
int stun_process_request (su_socket_t s, stun_msg_t *req, int sid, su_sockaddr_t *from_addr, socklen_t from_len)
int stun_process_response (stun_msg_t *msg)
static stun_request_tstun_request_create (stun_discovery_t *sd)
void stun_request_destroy (stun_request_t *req)
su_root_tstun_root (stun_handle_t *self)
static int stun_send_binding_request (stun_request_t *req, su_sockaddr_t *srvr_addr)
static void stun_sendto_timer_cb (su_root_magic_t *magic, su_timer_t *t, su_timer_arg_t *arg)
su_addrinfo_t const * stun_server_address (stun_handle_t *sh)
int stun_set_uname_pwd (stun_handle_t *sh, const char *uname, isize_t len_uname, const char *pwd, isize_t len_pwd)
char const * stun_str_state (stun_state_t state)
int stun_test_lifetime (stun_handle_t *sh, stun_discovery_f sdf, stun_discovery_magic_t *magic, tag_type_t tag, tag_value_t value,...)
static void stun_test_lifetime_timer_cb (su_root_magic_t *magic, su_timer_t *t, su_timer_arg_t *arg)
int stun_test_nattype (stun_handle_t *sh, stun_discovery_f sdf, stun_discovery_magic_t *magic, tag_type_t tag, tag_value_t value,...)

Variables

static char const __func__ [] = "stun"
char const STUN_DEBUG []
su_log_t stun_log [] = { SU_LOG_INIT("stun", "STUN_DEBUG", SU_DEBUG) }
char const stun_version [] = "sofia-sip-stun"

Detailed Description

STUN client module

See RFC 3489/3489bis for further information.

Author:
Martti Mela <Martti.Mela@nokia.com>
Tat Chan <Tat.Chan@nokia.com>
Pekka Pessi <Pekka.Pessi@nokia.com>
Kai Vehmanen <Kai.Vehmanen@nokia.com>
Date:
Created: Thu Jul 24 17:21:00 2003 ppessi

Definition in file stun.c.


Generated by  Doxygen 1.6.0   Back to index