Commit 919e7e25 authored by Pekka Pessi's avatar Pekka Pessi

Added SOFIAPUBFUN/SOFIAPUBVAR to stun module, too.

darcs-hash:20060511163757-65a35-26314df1d2a432f3fa3f415e6cf6f12b743dcf3f.gz
parent 834157f3
......@@ -65,7 +65,8 @@ typedef STUN_MAGIC_T stun_magic_t;
/** STUN discovery_ context */
typedef STUN_DISCOVERY_MAGIC_T stun_discovery_magic_t;
extern char const stun_version[]; /**< Name and version of STUN software */
/** Name and version of STUN software */
SOFIAPUBVAR char const stun_version[];
/**
* STUN Action types. These define the current discovery process.
......@@ -188,19 +189,21 @@ typedef void (*stun_dns_lookup_f)(stun_dns_lookup_t *self,
/* -------------------------------------------------------------------
* Functions for managing STUN handles. */
stun_handle_t *stun_handle_init(su_root_t *root,
tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN stun_handle_t *stun_handle_init(su_root_t *root,
tag_type_t, tag_value_t, ...);
void stun_handle_destroy(stun_handle_t *sh);
SOFIAPUBFUN void stun_handle_destroy(stun_handle_t *sh);
su_root_t *stun_root(stun_handle_t *sh);
int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
char const *stun_str_state(stun_state_t state);
su_addrinfo_t const *stun_server_address(stun_handle_t *sh);
SOFIAPUBFUN su_root_t *stun_root(stun_handle_t *sh);
SOFIAPUBFUN int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN char const *stun_str_state(stun_state_t state);
SOFIAPUBFUN su_addrinfo_t const *stun_server_address(stun_handle_t *sh);
SOFIAPUBFUN
int stun_process_message(stun_handle_t *sh, su_socket_t s,
su_sockaddr_t *sa, socklen_t salen,
void *data, int len);
SOFIAPUBFUN
int stun_process_request(su_socket_t s, stun_msg_t *req,
int sid, su_sockaddr_t *from_addr,
int from_len);
......@@ -208,50 +211,57 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
/* -------------------------------------------------------------------
* Functions for 'Binding Discovery' usage (RFC3489/3489bis) */
SOFIAPUBFUN
int stun_obtain_shared_secret(stun_handle_t *sh, stun_discovery_f,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN
int stun_bind(stun_handle_t *sh,
stun_discovery_f, stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN
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);
SOFIAPUBFUN su_socket_t stun_discovery_get_socket(stun_discovery_t *sd);
SOFIAPUBFUN int stun_discovery_release_socket(stun_discovery_t *sd);
SOFIAPUBFUN
int stun_test_nattype(stun_handle_t *sh,
stun_discovery_f, stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value, ...);
char const *stun_nattype_str(stun_discovery_t *sd);
stun_nattype_t stun_nattype(stun_discovery_t *sd);
SOFIAPUBFUN char const *stun_nattype_str(stun_discovery_t *sd);
SOFIAPUBFUN stun_nattype_t stun_nattype(stun_discovery_t *sd);
SOFIAPUBFUN
int stun_test_lifetime(stun_handle_t *sh,
stun_discovery_f, stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value, ...);
int stun_lifetime(stun_discovery_t *sd);
SOFIAPUBFUN int stun_lifetime(stun_discovery_t *sd);
/* -------------------------------------------------------------------
* Functions for 'Connectivity Check' and 'NAT Keepalives' usages (RFC3489bis) */
SOFIAPUBFUN
int stun_set_uname_pwd(stun_handle_t *sh,
const char *uname,
int len_uname,
const char *pwd,
int len_pwd);
int stun_msg_is_keepalive(uint16_t data);
int stun_message_length(void *data, int len, int end_of_message);
SOFIAPUBFUN int stun_msg_is_keepalive(uint16_t data);
SOFIAPUBFUN int stun_message_length(void *data, int len, int end_of_message);
/* Create a keepalive dispatcher for bound SIP sockets */
SOFIAPUBFUN
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);
SOFIAPUBFUN int stun_keepalive_destroy(stun_handle_t *sh, su_socket_t s);
/* -------------------------------------------------------------------
* Functions for 'Short-Term password' usage (RFC3489bis) */
......@@ -261,28 +271,32 @@ int stun_keepalive_destroy(stun_handle_t *sh, su_socket_t s);
/* -------------------------------------------------------------------
* Functions for STUN server discovery using DNS (RFC3489/3489bis) */
SOFIAPUBFUN
stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic,
su_root_t *root,
stun_dns_lookup_f func,
const char *domain);
void stun_dns_lookup_destroy(stun_dns_lookup_t *self);
SOFIAPUBFUN void stun_dns_lookup_destroy(stun_dns_lookup_t *self);
int stun_dns_lookup_udp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port);
int stun_dns_lookup_tcp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port);
int stun_dns_lookup_stp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port);
SOFIAPUBFUN int stun_dns_lookup_udp_addr(stun_dns_lookup_t *,
const char **target, uint16_t *port);
SOFIAPUBFUN int stun_dns_lookup_tcp_addr(stun_dns_lookup_t *self,
const char **target, uint16_t *port);
SOFIAPUBFUN int stun_dns_lookup_stp_addr(stun_dns_lookup_t *self,
const char **target, uint16_t *port);
/* -------------------------------------------------------------------
* Functions for minimal STUN server */
stun_mini_t *stun_mini_create(void);
void stun_mini_destroy(stun_mini_t *);
SOFIAPUBFUN stun_mini_t *stun_mini_create(void);
SOFIAPUBFUN void stun_mini_destroy(stun_mini_t *);
int stun_mini_add_socket(stun_mini_t *server, int socket);
int stun_mini_remove_socket(stun_mini_t *server, int socket);
SOFIAPUBFUN int stun_mini_add_socket(stun_mini_t *server, int socket);
SOFIAPUBFUN int stun_mini_remove_socket(stun_mini_t *server, int socket);
void stun_mini_request(stun_mini_t *server, int socket,
void *msg, ssize_t msglen,
void *addr, socklen_t addrlen);
SOFIAPUBFUN void stun_mini_request(stun_mini_t *server, int socket,
void *msg, ssize_t msglen,
void *addr, socklen_t addrlen);
SOFIA_END_DECLS
......
......@@ -44,57 +44,57 @@ SOFIA_BEGIN_DECLS
*****************************************/
#define STUNTAG_ANY() stuntag_any, ((tag_value_t)0)
extern tag_typedef_t stuntag_any;
SOFIAPUBVAR tag_typedef_t stuntag_any;
#define STUNTAG_DOMAIN(x) stuntag_domain, tag_str_v(x)
extern tag_typedef_t stuntag_domain;
SOFIAPUBVAR tag_typedef_t stuntag_domain;
#define STUNTAG_DOMAIN_REF(x) stuntag_domain_ref, tag_str_vr(&(x))
extern tag_typedef_t stuntag_domain_ref;
SOFIAPUBVAR tag_typedef_t stuntag_domain_ref;
#define STUNTAG_SERVER(x) stuntag_server, tag_str_v(x)
extern tag_typedef_t stuntag_server;
SOFIAPUBVAR tag_typedef_t stuntag_server;
#define STUNTAG_SERVER_REF(x) stuntag_server_ref, tag_str_vr(&(x))
extern tag_typedef_t stuntag_server_ref;
SOFIAPUBVAR tag_typedef_t stuntag_server_ref;
#define STUNTAG_REQUIRE_INTEGRITY(x) stuntag_require_integrity, tag_int_v(x)
extern tag_typedef_t stuntag_require_integrity;
SOFIAPUBVAR tag_typedef_t stuntag_require_integrity;
#define STUNTAG_REQUIRE_INTEGRITY_REF(x) stuntag_require_integrity_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_require_integrity_ref;
SOFIAPUBVAR tag_typedef_t stuntag_require_integrity_ref;
#define STUNTAG_INTEGRITY(x) stuntag_integrity, tag_int_v(x)
extern tag_typedef_t stuntag_integrity;
SOFIAPUBVAR tag_typedef_t stuntag_integrity;
#define STUNTAG_INTEGRITY_REF(x) stuntag_integrity_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_integrity_ref;
SOFIAPUBVAR tag_typedef_t stuntag_integrity_ref;
#define STUNTAG_SOCKET(x) stuntag_socket, tag_int_v(x)
extern tag_typedef_t stuntag_socket;
SOFIAPUBVAR tag_typedef_t stuntag_socket;
#define STUNTAG_SOCKET_REF(x) stuntag_socket_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_socket_ref;
SOFIAPUBVAR tag_typedef_t stuntag_socket_ref;
#define STUNTAG_REGISTER_EVENTS(x) stuntag_register_events, tag_int_v(x)
extern tag_typedef_t stuntag_register_events;
SOFIAPUBVAR tag_typedef_t stuntag_register_events;
#define STUNTAG_REGISTER_EVENTS_REF(x) stuntag_register_events_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_register_events_ref;
SOFIAPUBVAR tag_typedef_t stuntag_register_events_ref;
#define STUNTAG_ACTION(x) stuntag_action, tag_int_v(x)
extern tag_typedef_t stuntag_action;
SOFIAPUBVAR tag_typedef_t stuntag_action;
#define STUNTAG_ACTION_REF(x) stuntag_action_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_action_ref;
SOFIAPUBVAR tag_typedef_t stuntag_action_ref;
#define STUNTAG_CHANGE_IP(x) stuntag_change_ip, tag_bool_v(x)
extern tag_typedef_t stuntag_change_ip;
SOFIAPUBVAR tag_typedef_t stuntag_change_ip;
#define STUNTAG_CHANGE_IP_REF(x) stuntag_change_ip_ref, tag_bool_vr(&(x))
extern tag_typedef_t stuntag_change_ip_ref;
SOFIAPUBVAR tag_typedef_t stuntag_change_ip_ref;
#define STUNTAG_CHANGE_PORT(x) stuntag_change_port, tag_bool_v(x)
extern tag_typedef_t stuntag_change_port;
SOFIAPUBVAR tag_typedef_t stuntag_change_port;
#define STUNTAG_CHANGE_PORT_REF(x) stuntag_change_port_ref, tag_bool_vr(&(x))
extern tag_typedef_t stuntag_change_port_ref;
SOFIAPUBVAR tag_typedef_t stuntag_change_port_ref;
#define STUNTAG_TIMEOUT(x) stuntag_timeout, tag_uint_v((x))
extern tag_typedef_t stuntag_timeout;
SOFIAPUBVAR tag_typedef_t stuntag_timeout;
#define STUNTAG_TIMEOUT_REF(x) stuntag_timeout_ref, tag_uint_vr(&(x))
extern tag_typedef_t stuntag_timeout_ref;
SOFIAPUBVAR tag_typedef_t stuntag_timeout_ref;
SOFIA_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment