Commit 131492f4 authored by Pekka Pessi's avatar Pekka Pessi

Added tport integration functions to stun API.

Renamed some internal functions.

darcs-hash:20060110183241-65a35-292a265651841fbd2ea70700c6307160acd8cd3b.gz
parent 89f4782f
This diff is collapsed.
......@@ -120,6 +120,14 @@ typedef void (*stun_event_f)(stun_magic_t *magic,
stun_action_t action,
stun_state_t event);
/** Callback invoked by stun handle when it has a message to send. */
typedef int (*stun_send_callback)(stun_magic_t *magic,
stun_handle_t *se,
int socket,
void *data,
unsigned len,
int only_a_keepalive);
/* Return the associated socket */
int stun_handle_get_bind_socket(stun_handle_t *se);
......@@ -142,7 +150,6 @@ int stun_handle_request_shared_secret(stun_handle_t *se);
/** Bind a socket using STUN. */
int stun_handle_bind(stun_handle_t *se,
/* su_localinfo_t *my_addr, */
int *return_lifetime,
tag_type_t tag, tag_value_t value,
...);
......@@ -167,6 +174,11 @@ int stun_handle_set_uname_pwd(stun_handle_t *se,
su_localinfo_t *stun_request_get_localinfo(stun_request_t *req);
/** Determine length of STUN message (0 if not stun). */
int stun_message_length(void *data, int len, int end_of_message);
/** Process incoming message */
int stun_handle_process_message(stun_handle_t *se, void *data, int len);
SOFIA_END_DECLS
......
......@@ -84,7 +84,8 @@ int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
stun_msg_t *msg, stun_buffer_t *pwd);
int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
stun_msg_t *msg, int chg_ip, int chg_port);
stun_msg_t *msg,
tag_type_t, tag_value_t, ...);
int stun_process_response(stun_msg_t *msg);
int stun_process_binding_response(stun_msg_t *msg);
......
......@@ -113,3 +113,33 @@ tag_typedef_t stuntag_socket = INTTAG_TYPEDEF(socket);
* Corresponding tag taking reference parameter is STUNTAG_ACTION_REF()
*/
tag_typedef_t stuntag_action = INTTAG_TYPEDEF(action);
/* ---------------------------------------------------------------------- */
/**@def STUNTAG_CHANGE_IP(x)
*
* Add CHANGE-REQUEST attribute with "change IP" flag to the request.
*
* @par Used with
* stun_make_binding_req() \n
*
* @par Parameter type
* bool
*
* Corresponding tag taking reference parameter is STUNTAG_CHANGE_IP_REF()
*/
tag_typedef_t stuntag_change_ip = BOOLTAG_TYPEDEF(change_ip);
/**@def STUNTAG_CHANGE_PORT(x)
*
* Add CHANGE-REQUEST attribute with "change port" flag to the request.
*
* @par Used with
* stun_make_binding_req() \n
*
* @par Parameter type
* bool
*
* Corresponding tag taking reference parameter is STUNTAG_CHANGE_PORT_REF()
*/
tag_typedef_t stuntag_change_port = BOOLTAG_TYPEDEF(change_port);
......@@ -60,6 +60,16 @@ extern tag_typedef_t stuntag_action;
#define STUNTAG_ACTION_REF(x) stuntag_action_ref, tag_int_vr(&(x))
extern 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;
#define STUNTAG_CHANGE_IP_REF(x) stuntag_change_ip_ref, tag_bool_vr(&(x))
extern 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;
#define STUNTAG_CHANGE_PORT_REF(x) stuntag_change_port_ref, tag_bool_vr(&(x))
extern tag_typedef_t stuntag_change_port_ref;
SOFIA_END_DECLS
#endif /* STUN_TAG_H */
......@@ -122,7 +122,7 @@ void stunc_callback(stunc_t *stunc, stun_handle_t *sh,
int main(int argc, char *argv[])
{
int s, lifetime;
int s;
int msg_integrity;
stunc_t stunc[1];
su_root_t *root = su_root_create(stunc);
......@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
}
if (stun_handle_bind(se, &lifetime, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
if (stun_handle_bind(se, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_bind()"));
return -1;
}
......
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