Commit c68ed147 authored by Pekka Pessi's avatar Pekka Pessi

Using nua_owner_t instead of nua_handle_t with <nua_dialog.h>.

Prepare to move nua_dialog.[hc] to nta or to its own module.

darcs-hash:20060308225203-65a35-723e9f88e32f22d5845d59d9e2623da45264e067.gz
parent 95bda1af
This diff is collapsed.
...@@ -36,10 +36,13 @@ ...@@ -36,10 +36,13 @@
typedef struct nua_dialog_state nua_dialog_state_t; typedef struct nua_dialog_state nua_dialog_state_t;
typedef struct nua_dialog_usage nua_dialog_usage_t; typedef struct nua_dialog_usage nua_dialog_usage_t;
typedef struct nua_remote_s nua_remote_t;
#ifndef NUA_H #ifndef NUA_OWNER_T
#include <sofia-sip/nua.h> #define NUA_OWNER_T struct nua_owner_s
#endif #endif
typedef NUA_OWNER_T nua_owner_t;
#ifndef NTA_H #ifndef NTA_H
#include <sofia-sip/nta.h> #include <sofia-sip/nta.h>
#endif #endif
...@@ -79,29 +82,18 @@ struct nua_dialog_state ...@@ -79,29 +82,18 @@ struct nua_dialog_state
} ds_remote_ua[1]; } ds_remote_ua[1];
}; };
typedef void nh_pending_f(nua_handle_t *nh, typedef void nh_pending_f(nua_owner_t *,
nua_dialog_usage_t *du, nua_dialog_usage_t *du,
sip_time_t now); sip_time_t now);
enum nua_dialog_usage_e
{
nua_is_transaction_usage = 0,
nua_is_session_usage,
nua_is_notifier_usage,
nua_is_subscriber_usage,
nua_is_register_usage,
nua_is_publish_usage
};
typedef struct { typedef struct {
unsigned usage_size, usage_class_size; unsigned usage_size, usage_class_size;
int (*usage_add)(nua_handle_t *nh, int (*usage_add)(nua_owner_t *,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du);
void (*usage_remove)(nua_owner_t *,
nua_dialog_state_t *ds, nua_dialog_state_t *ds,
nua_dialog_usage_t *du); nua_dialog_usage_t *du);
void (*usage_remove)(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du);
char const *(*usage_name)(nua_dialog_usage_t const *du); char const *(*usage_name)(nua_dialog_usage_t const *du);
} nua_usage_class; } nua_usage_class;
...@@ -127,13 +119,16 @@ struct nua_dialog_usage { ...@@ -127,13 +119,16 @@ struct nua_dialog_usage {
msg_t *du_msg; /**< Template message */ msg_t *du_msg; /**< Template message */
}; };
void nua_dialog_uac_route(nua_handle_t *nh, sip_t const *sip, int rtag); void nua_dialog_uac_route(nua_owner_t *, nua_dialog_state_t *ds,
void nua_dialog_uas_route(nua_handle_t *nh, sip_t const *sip, int rtag); sip_t const *sip, int rtag);
void nua_dialog_get_peer_info(nua_handle_t *nh, sip_t const *sip); void nua_dialog_uas_route(nua_owner_t *, nua_dialog_state_t *ds,
sip_t const *sip, int rtag);
void nua_dialog_store_peer_info(nua_owner_t *, nua_dialog_state_t *ds,
sip_t const *sip);
char const *nua_dialog_usage_name(nua_dialog_usage_t const *du); char const *nua_dialog_usage_name(nua_dialog_usage_t const *du);
nua_dialog_usage_t *nua_dialog_usage_add(nua_handle_t *nh, nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *,
struct nua_dialog_state *ds, struct nua_dialog_state *ds,
nua_usage_class const *uclass, nua_usage_class const *uclass,
sip_event_t const *event); sip_event_t const *event);
...@@ -142,11 +137,11 @@ nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds, ...@@ -142,11 +137,11 @@ nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds,
nua_usage_class const *uclass, nua_usage_class const *uclass,
sip_event_t const *event); sip_event_t const *event);
void nua_dialog_usage_remove(nua_handle_t *nh, void nua_dialog_usage_remove(nua_owner_t *,
nua_dialog_state_t *ds, nua_dialog_state_t *ds,
nua_dialog_usage_t *du); nua_dialog_usage_t *du);
void nua_dialog_terminated(nua_handle_t *nh, void nua_dialog_terminated(nua_owner_t *,
struct nua_dialog_state *ds, struct nua_dialog_state *ds,
int status, int status,
char const *phrase); char const *phrase);
...@@ -170,8 +165,4 @@ void *nua_dialog_usage_private(nua_dialog_usage_t const *du) ...@@ -170,8 +165,4 @@ void *nua_dialog_usage_private(nua_dialog_usage_t const *du)
#define nua_dialog_usage_private(du) ((void*)((du) + 1)) #define nua_dialog_usage_private(du) ((void*)((du) + 1))
#endif #endif
#ifndef NUA_STACK_H
#include <nua_stack.h>
#endif
#endif /* NUA_DIALOG_H */ #endif /* NUA_DIALOG_H */
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#define NTA_LEG_MAGIC_T struct nua_handle_s #define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s #define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_dialog.h" #include "nua_stack.h"
#if HAVE_SIGCOMP #if HAVE_SIGCOMP
#include <sigcomp.h> #include <sigcomp.h>
......
...@@ -362,8 +362,8 @@ static int process_response_to_invite(nua_handle_t *nh, ...@@ -362,8 +362,8 @@ static int process_response_to_invite(nua_handle_t *nh,
/* XXX - check remote tag, handle forks */ /* XXX - check remote tag, handle forks */
/* Set route, contact, nh_ds->ds_remote_tag */ /* Set route, contact, nh_ds->ds_remote_tag */
nua_dialog_uac_route(nh, sip, 1); nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
init_session_timer(nua, nh, sip); init_session_timer(nua, nh, sip);
...@@ -550,8 +550,8 @@ process_100rel(nua_handle_t *nh, ...@@ -550,8 +550,8 @@ process_100rel(nua_handle_t *nh,
if (!nua_dialog_is_established(nh->nh_ds)) { if (!nua_dialog_is_established(nh->nh_ds)) {
/* Tag the INVITE request */ /* Tag the INVITE request */
nua_dialog_uac_route(nh, sip, 1); nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
cr_invite->cr_orq = cr_invite->cr_orq =
nta_outgoing_tagged(orq, process_response_to_invite, nh, nta_outgoing_tagged(orq, process_response_to_invite, nh,
...@@ -927,7 +927,7 @@ int process_invite2(nua_t *nua, ...@@ -927,7 +927,7 @@ int process_invite2(nua_t *nua,
/* Session Timer negotiation */ /* Session Timer negotiation */
init_session_timer(nua, nh, sip); init_session_timer(nua, nh, sip);
nua_dialog_uas_route(nh, sip, 1); /* Set route and tags */ nua_dialog_uas_route(nh, nh->nh_ds, sip, 1); /* Set route and tags */
nta_incoming_bind(irq, process_ack_or_cancel, nh); nta_incoming_bind(irq, process_ack_or_cancel, nh);
...@@ -1824,8 +1824,9 @@ static int process_response_to_update(nua_handle_t *nh, ...@@ -1824,8 +1824,9 @@ static int process_response_to_update(nua_handle_t *nh,
} }
else if (status >= 200) { else if (status >= 200) {
/* XXX - check remote tag, handle forks */ /* XXX - check remote tag, handle forks */
nua_dialog_uac_route(nh, sip, 1); /* Set (route), contact, (remote tag) */ /* Set (route), contact, (remote tag) */
nua_dialog_get_peer_info(nh, sip); nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
if (is_session_timer_set(ss)) { if (is_session_timer_set(ss)) {
init_session_timer(nua, nh, sip); init_session_timer(nua, nh, sip);
......
...@@ -1502,7 +1502,7 @@ nua_handle_t *nua_stack_incoming_handle(nua_t *nua, ...@@ -1502,7 +1502,7 @@ nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
if (nh && create_dialog) { if (nh && create_dialog) {
struct nua_dialog_state *ds = nh->nh_ds; struct nua_dialog_state *ds = nh->nh_ds;
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, ds, sip);
ds->ds_leg = nta_leg_tcreate(nua->nua_nta, nua_stack_process_request, nh, ds->ds_leg = nta_leg_tcreate(nua->nua_nta, nua_stack_process_request, nh,
SIPTAG_CALL_ID(sip->sip_call_id), SIPTAG_CALL_ID(sip->sip_call_id),
...@@ -1516,7 +1516,7 @@ nua_handle_t *nua_stack_incoming_handle(nua_t *nua, ...@@ -1516,7 +1516,7 @@ nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
} }
if (nh) if (nh)
nua_dialog_uas_route(nh, sip, 1); nua_dialog_uas_route(nh, nh->nh_ds, sip, 1);
return nh; return nh;
} }
......
...@@ -64,16 +64,17 @@ ...@@ -64,16 +64,17 @@
#define SU_LOG (nua_log) #define SU_LOG (nua_log)
#include <sofia-sip/su_debug.h> #include <sofia-sip/su_debug.h>
#ifndef NUA_DIALOG_H
#define NUA_OWNER_T struct nua_handle_s
#include <nua_dialog.h>
#endif
SOFIA_BEGIN_DECLS SOFIA_BEGIN_DECLS
#if HAVE_SIGCOMP #if HAVE_SIGCOMP
#include <sigcomp.h> #include <sigcomp.h>
#endif #endif
#ifndef NUA_DIALOG_H
#include <nua_dialog.h>
#endif
typedef struct event_s event_t; typedef struct event_s event_t;
#define NONE ((void *)-1) #define NONE ((void *)-1)
...@@ -96,7 +97,6 @@ enum nh_oa_event { ...@@ -96,7 +97,6 @@ enum nh_oa_event {
}; };
typedef struct nua_chat_s nua_chat_t; typedef struct nua_chat_s nua_chat_t;
typedef struct nua_remote_s nua_remote_t;
typedef struct nua_client_request nua_client_request_t; typedef struct nua_client_request nua_client_request_t;
typedef struct nua_server_request nua_server_request_t; typedef struct nua_server_request nua_server_request_t;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#define NTA_LEG_MAGIC_T struct nua_handle_s #define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s #define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_dialog.h" #include "nua_stack.h"
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Subcribe event usage */ /* Subcribe event usage */
...@@ -282,8 +282,8 @@ static int process_response_to_subscribe(nua_handle_t *nh, ...@@ -282,8 +282,8 @@ static int process_response_to_subscribe(nua_handle_t *nh,
/* We have not received notify. */ /* We have not received notify. */
if (!win_messenger_enable) if (!win_messenger_enable)
nua_dialog_uac_route(nh, sip, 1); nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
if (delta > 0) { if (delta > 0) {
nua_dialog_usage_set_refresh(du, delta); nua_dialog_usage_set_refresh(du, delta);
...@@ -463,8 +463,8 @@ int nua_stack_process_subsribe(nua_t *nua, ...@@ -463,8 +463,8 @@ int nua_stack_process_subsribe(nua_t *nua,
/* Refresh existing subscription */ /* Refresh existing subscription */
eu = nua_dialog_usage_private(du); assert(nh && du && eu); eu = nua_dialog_usage_private(du); assert(nh && du && eu);
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
nua_dialog_uas_route(nh, sip, 1); nua_dialog_uas_route(nh, nh->nh_ds, sip, 1);
refer_expires = NH_PGET(nh, refer_expires); refer_expires = NH_PGET(nh, refer_expires);
expires = refer_expires; expires = refer_expires;
...@@ -723,8 +723,8 @@ int nua_stack_process_notify(nua_t *nua, ...@@ -723,8 +723,8 @@ int nua_stack_process_notify(nua_t *nua,
} }
} }
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
nua_dialog_uas_route(nh, sip, 1); nua_dialog_uas_route(nh, nh->nh_ds, sip, 1);
if (strcasecmp(subs->ss_substate, what = "terminated") == 0) { if (strcasecmp(subs->ss_substate, what = "terminated") == 0) {
eu->eu_substate = nua_substate_terminated; eu->eu_substate = nua_substate_terminated;
...@@ -888,8 +888,8 @@ static int process_response_to_refer(nua_handle_t *nh, ...@@ -888,8 +888,8 @@ static int process_response_to_refer(nua_handle_t *nh,
else if (status < 300) { else if (status < 300) {
if (cr->cr_usage) if (cr->cr_usage)
cr->cr_usage->du_ready = 1; cr->cr_usage->du_ready = 1;
nua_dialog_uac_route(nh, sip, 1); nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_get_peer_info(nh, sip); nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
} }
else /* if (status >= 300) */ { else /* if (status >= 300) */ {
if (cr->cr_usage) if (cr->cr_usage)
...@@ -935,7 +935,7 @@ int nua_stack_process_refer(nua_t *nua, ...@@ -935,7 +935,7 @@ int nua_stack_process_refer(nua_t *nua,
du->du_ready = 1; du->du_ready = 1;
nua_dialog_uas_route(nh, sip, 1); /* Set route and tags */ nua_dialog_uas_route(nh, nh->nh_ds, sip, 1); /* Set route and tags */
if (!sip->sip_referred_by) { if (!sip->sip_referred_by) {
sip_from_t *a = sip->sip_from; sip_from_t *a = sip->sip_from;
......
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