Commit 5552b2a3 authored by Martti Mela's avatar Martti Mela

DON'T APPLY THIS: does not work. I need this for syncing.

darcs-hash:20051208184342-1b897-796a803b940a0974156246427f0fb0dc46adc0fa.gz
parent 1ef59bf0
This diff is collapsed.
......@@ -51,18 +51,30 @@ typedef STUN_MAGIC_T stun_magic_t;
extern char const stun_version[]; /**< Name and version of STUN software */
typedef enum stun_event_e {
stun_connect_error,
stun_connect_success,
stun_no_shared_secret_obtained,
stun_ready,
} stun_event_t;
int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
typedef int (stun_event_f) (stun_magic_t *magic, stun_engine_t *se);
typedef void (*stun_event_f)(stun_magic_t *magic,
stun_engine_t *se,
stun_event_t event);
su_root_t *stun_root(stun_engine_t *self);
stun_engine_t *stun_engine_tcreate(stun_magic_t *context,
su_root_t *root,
stun_event_f *cb,
stun_event_f cb,
tag_type_t tag, tag_value_t value, ...);
stun_engine_t *stun_engine_create(stun_magic_t *context,
su_root_t *root,
stun_event_f *cb,
stun_event_f cb,
char const *server,
int use_msgint);
......
......@@ -59,7 +59,7 @@ int stun_set_uname_pwd(stun_engine_t *se, const char *uname, int len_uname,
const char *pwd, int len_pwd);
/* internal functions declaration */
int stun_get_sharedsecret(stun_engine_t *se);
int stun_connect_start(stun_engine_t *se, su_addrinfo_t *ai);
int stun_make_sharedsecret_req(stun_msg_t *msg);
int stun_bind_test(stun_socket_t *ss, struct sockaddr_in *srvr, struct sockaddr_in *cli,
......
......@@ -56,13 +56,15 @@ struct stunc_s {
};
int stunc_callback(stunc_t *stunc, stun_engine_t *en);
void stunc_callback(stunc_t *stunc, stun_engine_t *en, stun_event_t event);
int stunc_callback(stunc_t *stunc, stun_engine_t *en)
void stunc_callback(stunc_t *stunc, stun_engine_t *en, stun_event_t event)
{
return 0;
printf("event: %d\n", event); fflush(stdout);
su_root_break(stun_root(root));
return;
}
......@@ -87,6 +89,8 @@ int main(int argc, char *argv[])
stunc_callback,
argv[1], argv[2] != NULL);
su_root_run(root);
if (se == NULL) { perror("stun_engine_create"); exit(1); }
s = socket(AF_INET, SOCK_DGRAM, 0);
......
......@@ -141,16 +141,16 @@ int main(int argc, char *argv[])
stun_engine_t *se;
int torture_callback(torture_t *torturer, stun_engine_t *en);
void torture_callback(torture_t *torturer, stun_engine_t *en, stun_event_t ev);
int torture_callback(torture_t *torturer, stun_engine_t *en)
void torture_callback(torture_t *torturer, stun_engine_t *en, stun_event_t ev)
{
SU_DEBUG_3(("%s: called\n", __func__));
//su_root_break(en->st_root);
su_root_break(stun_root(en));
return 0;
return;
}
int test_init(su_root_t *root, char *server)
......
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