Commit 7885b06b authored by Martti Mela's avatar Martti Mela
Browse files

nua-glib: added bind URL and STUN server parameters for nua_glib_constructor()

darcs-hash:20060505153534-1b897-45f253b9b533273417f89924a2ac33a4d10174e6.gz
parent e4c3aa01
......@@ -26,6 +26,7 @@ INCLUDES = -I$(S_BASE)/bnf -I$(B_BASE)/bnf \
-I$(S_BASE)/nua -I$(B_BASE)/nua \
-I$(S_BASE)/sdp -I$(B_BASE)/sdp \
-I$(S_BASE)/sip -I$(B_BASE)/sip \
-I$(S_BASE)/stun -I$(B_BASE)/stun \
-I$(S_BASE)/soa -I$(B_BASE)/soa \
-I$(S_BASE)/tport -I$(B_BASE)/tport \
-I$(S_BASE)/url -I$(B_BASE)/url \
......
......@@ -93,6 +93,8 @@ enum
PROP_PROXY,
PROP_REGISTRAR,
PROP_AUTHINFO,
PROP_STUN,
PROP_SIP_BIND_ADDR,
LAST_PROPERTY
};
......@@ -107,8 +109,8 @@ static int sof_init(NuaGlibPrivate *priv, const char *contact);
static GObject *
nua_glib_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *obj;
int res = 0;
......@@ -139,17 +141,22 @@ nua_glib_constructor (GType type,
/*check address has been set*/
g_assert(strcmp(self->priv->address, "no-address-set")!=0);
res=sof_init(self->priv, self->priv->contact);
res = sof_init(self->priv, self->priv->contact);
if (res != -1) {
self->priv->nua = nua_create(self->priv->root,
sof_callback, self,
NUTAG_SOA_NAME("default"),
NUTAG_MEDIA_ENABLE(1),
TAG_IF(self->priv->contact, NUTAG_URL(self->priv->contact)),
/* NUTAG_MEDIA_ADDRESS(self->priv->media),
SOATAG_USER_SDP_STR(local_caps),*/
TAG_NULL());
sof_callback, self,
NUTAG_SOA_NAME("default"),
NUTAG_MEDIA_ENABLE(1),
TAG_IF(self->priv->bind_addr,
NUTAG_URL(self->priv->bind_addr)),
TAG_IF(self->priv->stun,
STUNTAG_SERVER(self->priv->stun)),
TAG_IF(self->priv->contact,
NUTAG_URL(self->priv->contact)),
/* NUTAG_MEDIA_ADDRESS(self->priv->media), */
/* SOATAG_USER_SDP_STR(local_caps), */
TAG_NULL());
if (self->priv->nua) {
int min_se = 0;
int s_e = 0;
......@@ -225,18 +232,21 @@ nua_glib_finalize (GObject *obj)
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
nua_glib_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
static
void nua_glib_set_property(GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
NuaGlib *self = (NuaGlib*) object;
#define STORE_PARAM(s, x) \
g_free ((gpointer)(s)->priv->x); \
(s)->priv->x = g_value_dup_string (value)
switch (property_id) {
case PROP_CONTACT: {
g_free ((gpointer)self->priv->contact);
self->priv->contact = g_value_dup_string (value);
STORE_PARAM(self, contact);
break;
}
case PROP_ADDRESS: {
......@@ -254,8 +264,7 @@ nua_glib_set_property (GObject *object,
break;
}
case PROP_PROXY: {
g_free ((gpointer)self->priv->proxy);
self->priv->proxy = g_value_dup_string (value);
STORE_PARAM(self, proxy);
if (self->priv->nua)
{
nua_set_params(self->priv->nua,
......@@ -265,8 +274,7 @@ nua_glib_set_property (GObject *object,
break;
}
case PROP_REGISTRAR: {
g_free ((gpointer)self->priv->registrar);
self->priv->registrar = g_value_dup_string (value);
STORE_PARAM(self, registrar);
if (self->priv->nua)
{
nua_set_params(self->priv->nua,
......@@ -276,8 +284,15 @@ nua_glib_set_property (GObject *object,
break;
}
case PROP_AUTHINFO: {
g_free ((gpointer)self->priv->authinfo);
self->priv->authinfo = g_value_dup_string (value);
STORE_PARAM(self, authinfo);
break;
}
case PROP_STUN: {
STORE_PARAM(self, stun);
break;
}
case PROP_SIP_BIND_ADDR: {
STORE_PARAM(self, bind_addr);
break;
}
......@@ -385,6 +400,25 @@ nua_glib_class_init (NuaGlibClass *nua_glib_class)
param_spec);
param_spec = g_param_spec_string("stun",
"NuaGlib construction property",
"STUN server address",
"", /*default value*/
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (gobject_class,
PROP_STUN,
param_spec);
param_spec = g_param_spec_string("bind_address",
"NuaGlib construction property",
"Bind address (i.e. sip:[::]:*) for SIP stack",
"", /*default value*/
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property(gobject_class,
PROP_SIP_BIND_ADDR,
param_spec);
/**
* NuaGlib::call-forked:
* @nua_glib: the object that received the signal
......
......@@ -45,6 +45,7 @@
#include <sofia-sip/sip_status.h>
#include <sofia-sip/nua.h>
#include <sofia-sip/nua_tag.h>
#include <sofia-sip/stun_tag.h>
#include <sofia-sip/soa.h>
#include <sofia-sip/su_tag_io.h>
#include <sofia-sip/su_tagarg.h>
......@@ -113,20 +114,22 @@ struct _NuaGlibOp {
struct _NuaGlibPrivate {
/* private: maybe this should be really private?*/
su_home_t home[1]; /**< Our memory home */
char const *name; /**< Our name */
su_root_t *root; /**< Pointer to application root */
su_home_t home[1]; /**< Our memory home */
char const *name; /**< Our name */
su_root_t *root; /**< Pointer to application root */
unsigned init : 1; /**< True if class is inited*/
unsigned init : 1; /**< True if class is inited */
gchar *contact; /**< contact url used by this UA*/
gchar *authinfo; /**< authorization info used by this UA*/
char *proxy; /**< proxy to use,no proxy used if NULL*/
char *address; /**< our SIP address-of-contact*/
char *registrar; /**< registrar to use*/
nua_t *nua; /**< Pointer to NUA object */
NuaGlibOp *operations; /**< Remote destinations */
gchar *contact; /**< contact url used by this UA */
gchar *authinfo; /**< authorization info used by this UA*/
char *proxy; /**< proxy to use,no proxy used if NULL*/
char *address; /**< our SIP address-of-contact*/
char *registrar; /**< registrar to use*/
char *stun; /**< STUN server address */
char *bind_addr; /**< SIP stack's address, family */
nua_t *nua; /**< Pointer to NUA object */
NuaGlibOp *operations; /**< Remote destinations */
};
......
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