Commit 43cfda9d authored by Martti Mela's avatar Martti Mela

stun transaction engine, first impressions

darcs-hash:20051225132407-1b897-8fa2443754caa2ad64d4373215f45e44bdc8de99.gz
parent a8d3f445
......@@ -147,7 +147,7 @@ nua_handle_t *nh_create_handle(nua_t *nua, nua_hmagic_t *hmagic,
p_to = (void *)-1;
}
#if HAVE_PTHREAD_H
#if defined(HAVE_PTHREAD_H) && defined(SU_HAVE_PTHREADS)
#if __CYGWIN__
SU_PORT_INITREF(nh);
#else
......
......@@ -244,7 +244,7 @@ int ua_init(su_root_t *root, nua_t *nua)
nua->nua_handles_tail = &nua->nua_handles;
nh_append(nua, dnh);
#if SU_HAVE_PTHREADS
#if defined(HAVE_PTHREAD_H) && defined(SU_HAVE_PTHREADS)
#if __CYGWIN__
SU_PORT_INITREF(dnh);
#else
......
......@@ -50,7 +50,7 @@
#include "soa.h"
#if __CYGWIN__
#if defined(SU_HAVE_PTHREADS) && defined(HAVE_PTHREAD_H)
/* Debugging versions */
#define SU_PORT_INITREF(p) (pthread_mutex_init((p)->sup_reflock, NULL), printf("initref(%p)\n", (p)))
#define SU_PORT_INCREF(p, f) (pthread_mutex_lock(p->sup_reflock), p->sup_ref++, pthread_mutex_unlock(p->sup_reflock), printf("incref(%p) by %s\n", (p), f))
......@@ -76,6 +76,7 @@
#define SU_PORT_UNLOCK(p, f) \
(pthread_mutex_unlock((p)->sup_mutex), printf(" ...%ld at %s unlocked(%p)\n", pthread_self(), f, p))
#endif /* defined(SU_HAVE_PTHREAD) && defined(HAVE_PTHREAD_H) */
#endif /* __CYGWIN__ */
......
This diff is collapsed.
......@@ -73,3 +73,20 @@ tag_typedef_t stuntag_server = STRTAG_TYPEDEF(server);
* Corresponding tag taking reference parameter is STUNTAG_INTEGRITY_REF()
*/
tag_typedef_t stuntag_integrity = BOOLTAG_TYPEDEF(srtp_integrity);
/**@def STUNTAG_SOCKET(x)
*
* Bind socket for STUN.
*
* @par Used with
* stun_handle_bind() \n
*
* @par Parameter type
* int (su_socket_t)
*
* @par Values
* IPv4 (AF_INET) socket
*
* Corresponding tag taking reference parameter is STUNTAG_SOCKET_REF()
*/
tag_typedef_t stuntag_socket = INTTAG_TYPEDEF(socket);
......@@ -45,4 +45,9 @@ extern tag_typedef_t stuntag_integrity;
#define STUNTAG_INTEGRITY_REF(x) stuntag_integrity_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_integrity_ref;
#define STUNTAG_SOCKET(x) stuntag_socket, tag_int_v(x)
extern tag_typedef_t stuntag_socket;
#define STUNTAG_SOCKET_REF(x) stuntag_socket_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_socket_ref;
#endif /* STUN_TAG_H */
......@@ -315,6 +315,7 @@ struct su_port_s {
#define SU_PORT_INITLOCK(p) (void)(p)
#define SU_PORT_LOCK(p, f) (void)(p)
#define SU_PORT_UNLOCK(p, f) (void)(p)
#define SU_PORT_ZAPREF(p, f) ((p)->sup_ref--)
#define SU_PORT_INITREF(p) ((p)->sup_ref = 1)
#define SU_PORT_INCREF(p, f) ((p)->sup_ref++)
......
......@@ -411,7 +411,11 @@ su_root_t *su_root_create_with_port(su_root_magic_t *magic,
if (self) {
self->sur_magic = magic;
#if SU_HAVE_PTHREADS
self->sur_threading = SU_HAVE_PTHREADS;
#else
self->sur_threading = 0;
#endif
su_task_new(self->sur_task, self, port);
} else {
su_port_decref(port, "su_root_create");
......
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