Commit b460e53c authored by Pekka Pessi's avatar Pekka Pessi

stab 2 at soa

Added more functionality to soa. Stab at asynchronous API, too.

darcs-hash:20050908002300-65a35-d3cf6bfd21d7cb5ab7603d530056581164a4ece9.gz
parent aff03339
......@@ -26,7 +26,8 @@ BUILT_SOURCES = soa_tag_ref.c
include_HEADERS = soa.h soa_session.h soa_add.h
libsoa_a_SOURCES = soa.c soa_static.c soa_tag.c soa_tag_ref.c
libsoa_a_SOURCES = soa.c soa_static.c soa_asynch.c \
soa_tag.c soa_tag_ref.c
soa_objs_o_SOURCES = $(libsoa_a_SOURCES)
soa_objs_o_LDADD =
......
This diff is collapsed.
......@@ -49,9 +49,9 @@ typedef SOA_MAGIC_T soa_magic_t;
typedef int soa_callback_f(soa_magic_t *arg, soa_session_t *session);
soa_session_t *soa_create(su_root_t *, char const *name);
soa_session_t *soa_create(char const *name, su_root_t *, soa_magic_t *);
soa_session_t *soa_clone(soa_session_t *, su_root_t *);
soa_session_t *soa_clone(soa_session_t *, su_root_t *, soa_magic_t *);
void soa_destroy(soa_session_t *);
......@@ -67,6 +67,7 @@ int soa_error_as_sip_response(soa_session_t *soa,
char const *soa_error_as_sip_reason(soa_session_t *soa);
int soa_parse_sdp(soa_session_t *ss,
int live,
char const *sdp,
int len);
......@@ -122,11 +123,29 @@ int soa_is_remote_video_active(soa_session_t const *ss);
int soa_is_remote_image_active(soa_session_t const *ss);
int soa_is_remote_chat_active(soa_session_t const *ss);
/* SOA engine and media parameters
* set by soa_set_params(), get by soa_get_params()
* or soa_get_paramlist()
/*
* SOA engine and media parameters set by soa_set_params(), get by
* soa_get_params() or soa_get_paramlist()
*/
#define SOATAG_CAPS_SDP_STR(x) soatag_caps_sdp_str, tag_str_v(x)
extern tag_typedef_t soatag_caps_sdp_str;
#define SOATAG_CAPS_SDP_STR_REF(x) \
soatag_caps_sdp_str_ref, tag_str_vr(&(x))
extern tag_typedef_t soatag_caps_sdp_str_ref;
#define SOATAG_LOCAL_SDP_STR(x) soatag_local_sdp_str, tag_str_v(x)
extern tag_typedef_t soatag_local_sdp_str;
#define SOATAG_LOCAL_SDP_STR_REF(x) \
soatag_local_sdp_str_ref, tag_str_vr(&(x))
extern tag_typedef_t soatag_local_sdp_str_ref;
#define SOATAG_REMOTE_SDP_STR(x) soatag_remote_sdp_str, tag_str_v(x)
extern tag_typedef_t soatag_remote_sdp_str;
#define SOATAG_REMOTE_SDP_STR_REF(x) \
soatag_remote_sdp_str_ref, tag_str_vr(&(x))
extern tag_typedef_t soatag_remote_sdp_str_ref;
#define SOATAG_AF(x) soatag_af, tag_uint_v((x))
extern tag_typedef_t soatag_af;
......
......@@ -34,9 +34,12 @@
struct soa_session_actions;
extern struct soa_session_actions const soa_default_actions;
extern struct soa_session_actions const soa_static_actions;
extern struct soa_session_actions const soa_asynch_actions;
int soa_add(char const *name, struct soa_session_actions const *handler);
struct soa_session_actions const *soa_find(char const *name);
extern struct soa_session_actions const soa_default_actions;
struct soa_session_actions const *soa_find(char const *name);
#endif /* SOA_ADD_H */
......@@ -54,30 +54,42 @@ struct soa_session_actions
char **(*soa_media_features)(soa_session_t *, int live, su_home_t *);
char const * const *(*soa_sip_required)(soa_session_t const *ss);
char const * const *(*soa_sip_support)(soa_session_t const *ss);
int (*soa_remote_sip_features)(soa_session_t *ss,
int (*soa_remote_sip_features)(soa_session_t *ss,
char const * const * support,
char const * const * required);
int (*soa_config_sdp)(soa_session_t *ss, sdp_session_t *sdp,
char const *sdp_str, int strlen);
int (*soa_generate_offer)(soa_session_t *ss, soa_callback_f *completed);
int (*soa_generate_answer)(soa_session_t *ss, soa_callback_f *completed);
void (*soa_activate_session)(soa_session_t *ss, char const *option);
void (*soa_terminate_session)(soa_session_t *ss, char const *option);
};
int soa_default_init(char const *name, soa_session_t *, soa_session_t *parent);
void soa_default_deinit(soa_session_t *ss);
int soa_default_set_params(soa_session_t *ss, tagi_t const *tags);
int soa_default_get_params(soa_session_t const *ss, tagi_t *tags);
tagi_t *soa_default_get_paramlist(soa_session_t const *ss);
char **soa_default_media_features(soa_session_t *, int live, su_home_t *);
char const * const * soa_default_sip_required(soa_session_t const *ss);
char const * const * soa_default_sip_support(soa_session_t const *ss);
int soa_default_remote_sip_features(soa_session_t *ss,
soa_session_t *soa_session_ref(soa_session_t *ss);
void soa_session_unref(soa_session_t *ss);
int soa_base_init(char const *name, soa_session_t *, soa_session_t *parent);
void soa_base_deinit(soa_session_t *ss);
int soa_base_set_params(soa_session_t *ss, tagi_t const *tags);
int soa_base_get_params(soa_session_t const *ss, tagi_t *tags);
tagi_t *soa_base_get_paramlist(soa_session_t const *ss);
char **soa_base_media_features(soa_session_t *, int live, su_home_t *);
char const * const * soa_base_sip_required(soa_session_t const *ss);
char const * const * soa_base_sip_support(soa_session_t const *ss);
int soa_base_remote_sip_features(soa_session_t *ss,
char const * const * support,
char const * const * required);
int soa_default_generate_offer(soa_session_t *ss, soa_callback_f *completed);
int soa_default_generate_answer(soa_session_t *ss, soa_callback_f *completed);
void soa_default_activate_session(soa_session_t *ss, char const *option);
void soa_default_terminate_session(soa_session_t *ss, char const *option);
int soa_base_config_sdp(soa_session_t *ss, sdp_session_t *sdp,
char const *sdp0, int sdp0_len);
int soa_base_generate_offer(soa_session_t *ss, soa_callback_f *completed);
int soa_base_generate_answer(soa_session_t *ss, soa_callback_f *completed);
void soa_base_activate(soa_session_t *ss, char const *option);
void soa_base_terminate(soa_session_t *ss, char const *option);
int soa_default_generate_offer(soa_session_t *ss,
soa_callback_f *completed);
int soa_default_generate_answer(soa_session_t *ss,
soa_callback_f *completed);
struct soa_session
{
......@@ -86,10 +98,14 @@ struct soa_session
struct soa_session_actions const *ss_actions;
su_root_t *ss_root;
soa_magic_t *ss_magic; /**< Application data */
unsigned ss_active:1; /**< Session has been activated */
soa_callback_f *ss_in_progress;/**< Operation in progress */
/** Incremented once each time session is terminated */
unsigned ss_terminated;
unsigned ss_in_progress:1; /**< Operation in progress */
unsigned ss_active:1; /**< Session has been activated */
/* Current Offer-Answer status */
......@@ -102,7 +118,7 @@ struct soa_session
unsigned ss_answer_sent:2; /**< We have answered (reliably, if >1) */
unsigned :0; /* Pad */
unsigned ss_oa_rounds; /**< Number of O/A rounds completed */
unsigned ss_oa_rounds; /**< Number of O/A rounds completed */
struct soa_media_activity
{
......@@ -112,12 +128,18 @@ struct soa_session
int ma_chat:3; /**< Chat activity (send/recv) */
} ss_local_activity[1], ss_remote_activity[1];
/** Capabilities as specified by application */
char const *ss_caps_str0;
char const *ss_caps_str; /**< Session capabilities as string */
sdp_session_t *ss_caps; /**< Session capabilities */
/** Session description specified by application */
char const *ss_local_str0;
char const *ss_local_str; /**< Local session description as string */
sdp_session_t *ss_local; /**< Local session description */
sdp_session_t *ss_remote; /**< Remote session description */
sdp_origin_t *ss_o_remote;
sdp_parser_t *ss_parser; /**< SDP from incoming request */
sdp_session_t *ss_remote; /**< Remote session description */
/** SIP features required */
char const * const *ss_local_required;
......@@ -152,11 +174,16 @@ struct soa_session
su_strlst_t *ss_events;
unsigned ss_srtp_enable:1,
ss_srtp_confidentiality:1,
unsigned ss_srtp_enable:1,
ss_srtp_confidentiality:1,
ss_srtp_integrity:1;
};
/* ====================================================================== */
int soa_set_status(soa_session_t *ss, int status, char const *phrase);
void soa_set_activity(soa_session_t *ss, sdp_media_t const *m, int remote);
/* ====================================================================== */
/* Debug log settings */
......
......@@ -43,6 +43,11 @@ const char soa_static_c_id[] =
#include <assert.h>
struct soa_static_complete;
#define SU_MSG_ARG_T struct soa_static_completed
#include <su_wait.h>
#include <su_tag_class.h>
#include <su_tag_class.h>
#include <su_tagarg.h>
......@@ -55,24 +60,25 @@ const char soa_static_c_id[] =
#define NONE ((void *)-1)
#define XXX assert(!"implemented")
struct soa_static_session
typedef struct soa_static_session
{
soa_session_t session[1];
};
soa_session_t sss_session[1];
}
soa_static_session_t;
static int soa_static_init(char const *, soa_session_t *, soa_session_t *);
static void soa_static_deinit(soa_session_t *);
static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags);
static int soa_static_get_params(soa_session_t const *ss, tagi_t *tags);
static tagi_t *soa_static_get_paramlist(soa_session_t const *ss);
static int soa_static_generate_offer(soa_session_t *ss,
static int soa_static_generate_offer(soa_session_t *ss,
soa_callback_f *completed);
static int soa_static_generate_answer(soa_session_t *ss,
static int soa_static_generate_answer(soa_session_t *ss,
soa_callback_f *completed);
static void soa_static_activate_session(soa_session_t *ss, char const *option);
static void soa_static_terminate_session(soa_session_t *ss, char const *option);
static void soa_static_activate(soa_session_t *ss, char const *option);
static void soa_static_terminate(soa_session_t *ss, char const *option);
struct soa_session_actions const soa_static_actions =
struct soa_session_actions const soa_static_actions =
{
(sizeof soa_static_actions),
sizeof (struct soa_static_session),
......@@ -81,62 +87,115 @@ struct soa_session_actions const soa_static_actions =
soa_static_set_params,
soa_static_get_params,
soa_static_get_paramlist,
soa_default_media_features,
soa_default_sip_required,
soa_default_sip_support,
soa_default_remote_sip_features,
soa_base_media_features,
soa_base_sip_required,
soa_base_sip_support,
soa_base_remote_sip_features,
soa_base_config_sdp,
soa_static_generate_offer,
soa_static_generate_answer,
soa_static_activate_session,
soa_static_terminate_session
soa_static_activate,
soa_static_terminate
};
/* Initialize session */
static int soa_static_init(char const *name,
soa_session_t *ss,
static int soa_static_init(char const *name,
soa_session_t *ss,
soa_session_t *parent)
{
return soa_default_init(name, ss, parent);
soa_static_session_t *myss = (void *)ss;
return soa_base_init(name, ss, parent);
}
static void soa_static_deinit(soa_session_t *ss)
{
soa_default_deinit(ss);
soa_base_deinit(ss);
}
static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags)
{
return soa_default_set_params(ss, tags);
return soa_base_set_params(ss, tags);
}
static int soa_static_get_params(soa_session_t const *ss, tagi_t *tags)
{
return soa_default_get_params(ss, tags);
return soa_base_get_params(ss, tags);
}
static tagi_t *soa_static_get_paramlist(soa_session_t const *ss)
{
return soa_default_get_paramlist(ss);
return soa_base_get_paramlist(ss);
}
static int soa_static_generate_offer(soa_session_t *ss,
soa_callback_f *completed)
soa_callback_f *completed)
{
return soa_default_generate_offer(ss, completed);
sdp_media_t *m;
uint16_t port = 5004;
su_msg_r msg;
if (ss->ss_local == NULL) {
if (ss->ss_caps == NULL)
return soa_set_status(ss, 500, "No local session available");
}
if (ss->ss_local)
return 0; /* We are done */
/* Generate a dummy offer based on our capabilities */
ss->ss_local = sdp_session_dup(ss->ss_home, ss->ss_caps);
if (!ss->ss_local) {
return soa_set_status(ss, 500, "Internal error");
}
for (m = ss->ss_local->sdp_media; m; m = m->m_next)
if (m->m_port == 0)
m->m_port = port, port += 2;
soa_set_activity(ss, ss->ss_local->sdp_media, 0);
return 0;
}
static int soa_static_generate_answer(soa_session_t *ss,
soa_callback_f *completed)
static int soa_static_generate_answer(soa_session_t *ss,
soa_callback_f *completed)
{
return soa_default_generate_answer(ss, completed);
sdp_media_t *m;
uint16_t port = 5004;
su_msg_r msg;
if (ss->ss_local == NULL) {
if (ss->ss_caps == NULL)
return soa_set_status(ss, 500, "No local session available");
}
if (ss->ss_local)
return 0; /* We are done */
/* Generate a dummy answer based on our capabilities */
ss->ss_local = sdp_session_dup(ss->ss_home, ss->ss_caps);
if (!ss->ss_local) {
return soa_set_status(ss, 500, "Internal error");
}
for (m = ss->ss_local->sdp_media; m; m = m->m_next)
if (m->m_port == 0)
m->m_port = port, port += 2;
soa_set_activity(ss, ss->ss_local->sdp_media, 0);
return 0;
}
static void soa_static_activate_session(soa_session_t *ss, char const *option)
static void soa_static_activate(soa_session_t *ss, char const *option)
{
return soa_default_activate_session(ss, option);
soa_base_activate(ss, option);
}
static void soa_static_terminate_session(soa_session_t *ss, char const *option)
static void soa_static_terminate(soa_session_t *ss, char const *option)
{
return soa_default_terminate_session(ss, option);
if (ss->ss_local)
su_free(ss->ss_home, ss->ss_local), ss->ss_local = NULL;
soa_base_terminate(ss, option);
}
......@@ -42,6 +42,70 @@ const char soa_tag_c_id[] =
#include <soa.h>
#include <su_tag_class.h>
/**@def SOATAG_CAPS_SDP_STR(x)
* Pass media description file name to the NUA stack.
*
* Pass name of media description file that contains media templates
* (normally mss.sdp) to the NUA stack.
*
* @par Used with
* nua_set_params() \n
* nua_get_params() \n
* nua_create()
*
* @par Parameter type
* char const *
*
* @par Values
* NULL terminated character string
*
* Corresponding tag taking reference parameter is SOATAG_CAPS_SDP_STR_REF()
*/
tag_typedef_t soatag_caps_sdp_str = STRTAG_TYPEDEF(caps_sdp_str);
/**@def SOATAG_LOCAL_SDP_STR(x)
* Pass media description file name to the NUA stack.
*
* Pass name of media description file that contains media templates
* (normally mss.sdp) to the NUA stack.
*
* @par Used with
* nua_set_params() \n
* nua_get_params() \n
* nua_create()
*
* @par Parameter type
* char const *
*
* @par Values
* NULL terminated character string
*
* Corresponding tag taking reference parameter is SOATAG_LOCAL_SDP_STR_REF()
*/
tag_typedef_t soatag_local_sdp_str = STRTAG_TYPEDEF(local_sdp_str);
/**@def SOATAG_REMOTE_SDP_STR(x)
* Pass media description file name to the NUA stack.
*
* Pass name of media description file that contains media templates
* (normally mss.sdp) to the NUA stack.
*
* @par Used with
* nua_set_params() \n
* nua_get_params() \n
* nua_create()
*
* @par Parameter type
* char const *
*
* @par Values
* NULL terminated character string
*
* Corresponding tag taking reference parameter is SOATAG_REMOTE_SDP_STR_REF()
*/
tag_typedef_t soatag_remote_sdp_str = STRTAG_TYPEDEF(remote_sdp_str);
/**@def SOATAG_AF(x)
*
......
......@@ -51,6 +51,7 @@ struct context;
#define SOA_MAGIC_T struct context
#include "soa.h"
#include "soa_add.h"
#include <su_log.h>
......@@ -69,9 +70,19 @@ int tstflags = 0;
#define __func__ name
#endif
#define NONE ((void*)-1)
struct context
{
su_home_t home[1];
su_root_t *root;
struct {
soa_session_t *a;
soa_session_t *b;
} synch, asynch;
soa_session_t *completed;
};
int test_api_completed(struct context *arg, soa_session_t *session)
......@@ -87,8 +98,8 @@ int test_api_errors(struct context *ctx)
char const *null = NULL;
char const * const *featurelist;
TEST_1(!soa_create(NULL, "default"));
TEST_1(!soa_clone(NULL, NULL));
TEST_1(!soa_create("default", NULL, NULL));
TEST_1(!soa_clone(NULL, NULL, NULL));
TEST_VOID(soa_destroy(NULL));
TEST_1(-1 == soa_set_params(NULL, TAG_END()));
......@@ -101,7 +112,7 @@ int test_api_errors(struct context *ctx)
TEST_1(soa_error_as_sip_reason(NULL));
TEST_1(-1 == soa_parse_sdp(NULL, NULL, 0));
TEST_1(-1 == soa_parse_sdp(NULL, 0, NULL, 0));
TEST_VOID(soa_clear_sdp(NULL));
......@@ -144,6 +155,43 @@ int test_init(struct context *ctx, char *argv[])
{
BEGIN();
int n;
ctx->root = su_root_create(ctx); TEST_1(ctx->root);
ctx->asynch.a = soa_create("asynch", ctx->root, ctx);
TEST_1(!ctx->asynch.a);
TEST_1(!soa_find("asynch"));
TEST_1(soa_find("default"));
n = soa_add("asynch", &soa_asynch_actions); TEST(n, 0);
TEST_1(soa_find("asynch"));
ctx->asynch.a = soa_create("asynch", ctx->root, ctx);
TEST_1(ctx->asynch.a);
ctx->asynch.b = soa_create("asynch", ctx->root, ctx);
TEST_1(ctx->asynch.b);
/* Create asynchronous endpoints */
ctx->synch.a = soa_create("static", ctx->root, ctx);
TEST_1(!ctx->synch.a);
TEST_1(!soa_find("static"));
TEST_1(soa_find("default"));
n = soa_add("static", &soa_static_actions); TEST(n, 0);
TEST_1(soa_find("static"));
ctx->synch.a = soa_create("static", ctx->root, ctx);
TEST_1(ctx->synch.a);
ctx->synch.b = soa_create("static", ctx->root, ctx);
TEST_1(ctx->synch.b);
END();
}
......@@ -151,6 +199,172 @@ int test_init(struct context *ctx, char *argv[])
int test_params(struct context *ctx)
{
BEGIN();
int n;
n = soa_set_params(ctx->asynch.a, TAG_END()); TEST(n, 0);
n = soa_set_params(ctx->asynch.b, TAG_END()); TEST(n, 0);
END();
}
int test_completed(struct context *ctx, soa_session_t *session)
{
ctx->completed = session;
su_root_break(ctx->root);
return 0;
}
int test_static_offer_answer(struct context *ctx)
{
BEGIN();
int n;
su_home_t home[1] = { SU_HOME_INIT(home) };
char *caps = NONE, *offer = NONE, *answer = NONE;
int capslen = -1, offerlen = -1, answerlen = -1;
char const a[] =
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5004 RTP/AVP 0 8\r\n";
char const b[] =
"v=0\n"
"o=right 93298573265 321974 IN IP4 127.0.0.3\n"
"c=IN IP4 127.0.0.3\n"
"m=audio 5006 RTP/AVP 96\n"
"m=rtpmap:96 GSM/8000\n";
n = soa_parse_sdp(ctx->synch.a, 0, "m=audio 5004 RTP/AVP 0 8", -1);
TEST(n, 1);
n = soa_parse_sdp(ctx->synch.a, 0, a, strlen(a)); TEST(n, 1);
n = soa_print_sdp(ctx->synch.a, 0, home, &caps, &capslen); TEST(n, 1);
TEST_1(caps != NULL && caps != NONE);
TEST_1(capslen > 0);
su_free(home, caps);
n = soa_parse_sdp(ctx->synch.b, 0, b, strlen(b)); TEST(n, 1);
n = soa_offer(ctx->synch.a, 1, test_completed); TEST(n, 0);
n = soa_print_sdp(ctx->synch.a, 1, home, &offer, &offerlen); TEST(n, 1);
n = soa_parse_sdp(ctx->synch.b, 1, offer, offerlen); TEST(n, 1);
n = soa_offer_answer(ctx->synch.b, 0, test_completed); TEST(n, 0);
TEST_VOID(soa_activate(ctx->synch.b, NULL));
n = soa_print_sdp(ctx->synch.b, 1, home, &answer, &answerlen); TEST(n, 1);
n = soa_parse_sdp(ctx->synch.a, 1, answer, answerlen); TEST(n, 1);
n = soa_offer_answer(ctx->synch.a, 0, test_completed); TEST(n, 0);
TEST_VOID(soa_activate(ctx->synch.a, NULL));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_video_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_image_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_chat_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_remote_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_video_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_image_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_chat_active(ctx->synch.a));
su_home_deinit(home);
TEST_VOID(soa_terminate(ctx->synch.a, NULL));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_audio_active(ctx->synch.a));
TEST_VOID(soa_terminate(ctx->synch.b, NULL));
END();
}
int test_asynch_offer_answer(struct context *ctx)
{
BEGIN();
int n;
su_home_t home[1] = { SU_HOME_INIT(home) };
char *caps = NONE, *offer = NONE, *answer = NONE;
int capslen = -1, offerlen = -1, answerlen = -1;
char const a[] =
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5004 RTP/AVP 0 8\r\n";
char const b[] =
"v=0\n"
"o=right 93298573265 321974 IN IP4 127.0.0.3\n"
"c=IN IP4 127.0.0.3\n"
"m=audio 5006 RTP/AVP 96\n"
"m=rtpmap:96 GSM/8000\n";
n = soa_parse_sdp(ctx->asynch.a, 0, a, strlen(a)); TEST(n, 1);
n = soa_print_sdp(ctx->asynch.a, 0, home, &caps, &capslen); TEST(n, 1);
TEST_1(caps != NULL && caps != NONE);
TEST_1(capslen > 0);
su_free(home, caps);
n = soa_parse_sdp(ctx->asynch.b, 0, b, strlen(b)); TEST(n, 1);
n = soa_offer(ctx->asynch.a, 1, test_completed); TEST(n, 1);
su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.a); ctx->completed = NULL;
n = soa_print_sdp(ctx->asynch.a, 1, home, &offer, &offerlen); TEST(n, 1);
n = soa_parse_sdp(ctx->asynch.b, 1, offer, offerlen); TEST(n, 1);
n = soa_offer_answer(ctx->asynch.b, 0, test_completed); TEST(n, 1);
su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.b); ctx->completed = NULL;
TEST_VOID(soa_activate(ctx->asynch.b, NULL));
n = soa_print_sdp(ctx->asynch.b, 1, home, &answer, &answerlen); TEST(n, 1);
n = soa_parse_sdp(ctx->asynch.a, 1, answer, answerlen); TEST(n, 1);
n = soa_offer_answer(ctx->asynch.a, 0, test_completed); TEST(n, 0);
TEST_VOID(soa_activate(ctx->asynch.a, NULL));
su_home_deinit(home);
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_audio_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_video_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_image_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_chat_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_remote_audio_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_video_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_image_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_chat_active(ctx->asynch.a));
TEST_VOID(soa_terminate(ctx->asynch.a, NULL));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_audio_active(ctx->asynch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_audio_active(ctx->asynch.a));
TEST_VOID(soa_terminate(ctx->asynch.b, NULL));
END();
}
......@@ -240,15 +454,18 @@ int main(int argc, char *argv[])