libosmocc: Add support for individual session config (per endpoint)

pull/1/head
Andreas Eversberg 2 years ago
parent 046834ac97
commit ef88fea8a0
  1. 4
      src/libmobile/call.c
  2. 4
      src/libmobile/console.c
  3. 13
      src/libosmocc/endpoint.c
  4. 4
      src/libosmocc/endpoint.h
  5. 8
      src/libosmocc/helper.c
  6. 4
      src/libosmocc/helper.h
  7. 31
      src/libosmocc/rtp.c
  8. 2
      src/libosmocc/rtp.h
  9. 4
      src/libosmocc/sdp.c
  10. 2
      src/libosmocc/sdp.h
  11. 42
      src/libosmocc/session.c
  12. 39
      src/libosmocc/session.h

@ -419,7 +419,7 @@ static void indicate_setup(process_t *process, const char *callerid, const char
/* bearer capability */
osmo_cc_add_ie_bearer(msg, OSMO_CC_CODING_ITU_T, OSMO_CC_CAPABILITY_AUDIO, OSMO_CC_MODE_CIRCUIT);
/* sdp offer */
process->session = osmo_cc_helper_audio_offer(process, codecs, down_audio, msg, 1);
process->session = osmo_cc_helper_audio_offer(&ep->session_config, process, codecs, down_audio, msg, 1);
PDEBUG(DCALL, DEBUG_INFO, "Indicate OSMO-CC setup towards fixed network\n");
osmo_cc_ll_msg(ep, process->callref, msg);
@ -705,7 +705,7 @@ void ll_msg_cb(osmo_cc_endpoint_t __attribute__((unused)) *ep, uint32_t callref,
const char *sdp;
/* sdp accept */
sdp = osmo_cc_helper_audio_accept(process, codecs, down_audio, msg, &process->session, &process->codec, 0);
sdp = osmo_cc_helper_audio_accept(&ep->session_config, process, codecs, down_audio, msg, &process->session, &process->codec, 0);
if (!sdp) {
disconnect_process(callref, 47);
break;

@ -176,7 +176,7 @@ static void request_setup(int callref, const char *dialing)
/* bearer capability */
osmo_cc_add_ie_bearer(msg, OSMO_CC_CODING_ITU_T, OSMO_CC_CAPABILITY_AUDIO, OSMO_CC_MODE_CIRCUIT);
/* sdp offer */
console.session = osmo_cc_helper_audio_offer(NULL, codecs, up_audio, msg, 1);
console.session = osmo_cc_helper_audio_offer(&ep->session_config, NULL, codecs, up_audio, msg, 1);
osmo_cc_ul_msg(ep, callref, msg);
}
@ -261,7 +261,7 @@ void console_msg(osmo_cc_call_t *call, osmo_cc_msg_t *msg)
}
console.callref = call->callref;
/* sdp accept */
sdp = osmo_cc_helper_audio_accept(NULL, codecs, up_audio, msg, &console.session, &console.codec, 0);
sdp = osmo_cc_helper_audio_accept(&ep->session_config, NULL, codecs, up_audio, msg, &console.session, &console.codec, 0);
if (!sdp) {
PDEBUG(DCC, DEBUG_NOTICE, "Cannot accept codec, rejecting.\n");
request_disconnect_release_reject(console.callref, CAUSE_RESOURCE_UNAVAIL, OSMO_CC_MSG_REJ_REQ);

@ -1155,7 +1155,7 @@ static int osmo_cc_set_address(osmo_cc_endpoint_t *ep, const char *text)
PDEBUG(DCC, DEBUG_ERROR, "Given local address '%s' is invalid.\n", *host_p);
return -EINVAL;
}
osmo_cc_set_local_peer(osmo_cc_session_nettype_inet, addrtype, *host_p);
osmo_cc_set_local_peer(&ep->session_config, osmo_cc_session_nettype_inet, addrtype, *host_p);
return 0;
}
@ -1175,7 +1175,7 @@ static void osmo_cc_help_rtp(void)
printf("interfaces, between machines, local machine's IP must be given.\n\n");
}
static int osmo_cc_set_rtp(const char *text)
static int osmo_cc_set_rtp(osmo_cc_endpoint_t *ep, const char *text)
{
int peer = 0, ports = 0;
@ -1204,7 +1204,7 @@ static int osmo_cc_set_rtp(const char *text)
PDEBUG(DCC, DEBUG_ERROR, "Given RTP address '%s' is invalid.\n", text);
return -EINVAL;
}
osmo_cc_set_local_peer(osmo_cc_session_nettype_inet, addrtype, text);
osmo_cc_set_local_peer(&ep->session_config, osmo_cc_session_nettype_inet, addrtype, text);
return 0;
}
@ -1236,7 +1236,7 @@ static int osmo_cc_set_rtp(const char *text)
from = from * 10 + *text - '0';
}
osmo_cc_set_rtp_ports(from, to);
osmo_cc_set_rtp_ports(&ep->session_config, from, to);
return 0;
}
@ -1279,6 +1279,9 @@ int osmo_cc_new(osmo_cc_endpoint_t *ep, const char *version, const char *name, u
ep->serving_location = serving_location;
ep->priv = priv;
osmo_cc_set_local_peer(&ep->session_config, osmo_cc_session_nettype_inet, osmo_cc_session_addrtype_ipv4, "127.0.0.1");
osmo_cc_set_rtp_ports(&ep->session_config, 16384, 32767);
/* apply args */
for (i = 0; i < argc; i++) {
if (!strncasecmp(argv[i], "local", 5)) {
@ -1294,7 +1297,7 @@ int osmo_cc_new(osmo_cc_endpoint_t *ep, const char *version, const char *name, u
}
} else
if (!strncasecmp(argv[i], "rtp", 3)) {
rc = osmo_cc_set_rtp(argv[i]);
rc = osmo_cc_set_rtp(ep, argv[i]);
if (rc < 0) {
return rc;
}

@ -45,6 +45,8 @@ typedef int16_t osmo_cc_sample_t;
#define OSMO_CC_SAMPLE_MIN -32768 /* lowest level */
#define OSMO_CC_SAMPLE_MAX 32767 /* highest level */
#include "session.h"
struct osmo_cc_call;
typedef struct osmo_cc_screen_list {
@ -84,6 +86,7 @@ typedef struct osmo_cc_endpoint {
osmo_cc_screen_list_t *screen_called_out;
int remote_auto; /* automatic remote address */
struct timer attach_timer; /* timer to retry attachment */
osmo_cc_session_config_t session_config; /* SDP/RTP default configuration */
} osmo_cc_endpoint_t;
extern osmo_cc_endpoint_t *osmo_cc_endpoint_list;
@ -121,7 +124,6 @@ enum osmo_cc_session_addrtype osmo_cc_address_type(const char *address);
const char *osmo_cc_host_of_address(const char *address);
const char *osmo_cc_port_of_address(const char *address);
#include "session.h"
#include "rtp.h"
#include "sdp.h"
#include "screen.h"

@ -29,14 +29,14 @@
#include "endpoint.h"
#include "helper.h"
osmo_cc_session_t *osmo_cc_helper_audio_offer(void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, int debug)
osmo_cc_session_t *osmo_cc_helper_audio_offer(osmo_cc_session_config_t *conf, void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, int debug)
{
osmo_cc_session_t *session;
osmo_cc_session_media_t *media;
const char *sdp;
int i;
session = osmo_cc_new_session(priv, NULL, NULL, NULL, 0, 0, NULL, NULL, debug);
session = osmo_cc_new_session(conf, priv, NULL, NULL, NULL, 0, 0, NULL, NULL, debug);
if (!session)
return NULL;
@ -52,7 +52,7 @@ osmo_cc_session_t *osmo_cc_helper_audio_offer(void *priv, struct osmo_cc_helper_
return session;
}
const char *osmo_cc_helper_audio_accept(void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, osmo_cc_session_t **session_p, osmo_cc_session_codec_t **codec_p, int force_our_codec)
const char *osmo_cc_helper_audio_accept(osmo_cc_session_config_t *conf, void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, osmo_cc_session_t **session_p, osmo_cc_session_codec_t **codec_p, int force_our_codec)
{
char offer_sdp[65536];
const char *accept_sdp;
@ -77,7 +77,7 @@ const char *osmo_cc_helper_audio_accept(void *priv, struct osmo_cc_helper_audio_
return NULL;
}
*session_p = osmo_cc_session_receive_offer(priv, offer_sdp);
*session_p = osmo_cc_session_receive_offer(conf, priv, offer_sdp);
if (!*session_p) {
PDEBUG(DCC, DEBUG_ERROR, "Failed to parse SDP.\n");
return NULL;

@ -7,7 +7,7 @@ struct osmo_cc_helper_audio_codecs {
void (*decoder)(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len);
};
osmo_cc_session_t *osmo_cc_helper_audio_offer(void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, int debug);
const char *osmo_cc_helper_audio_accept(void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, osmo_cc_session_t **session_p, osmo_cc_session_codec_t **codec_p, int force_our_codec);
osmo_cc_session_t *osmo_cc_helper_audio_offer(osmo_cc_session_config_t *conf, void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, int debug);
const char *osmo_cc_helper_audio_accept(osmo_cc_session_config_t *conf, void *priv, struct osmo_cc_helper_audio_codecs *codecs, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), osmo_cc_msg_t *msg, osmo_cc_session_t **session_p, osmo_cc_session_codec_t **codec_p, int force_our_codec);
int osmo_cc_helper_audio_negotiate(osmo_cc_msg_t *msg, osmo_cc_session_t **session_p, osmo_cc_session_codec_t **codec_p);

@ -32,15 +32,11 @@
#define RTP_VERSION 2
static uint16_t rtp_port_next = 16384;
static uint16_t rtp_port_from = 16384;
static uint16_t rtp_port_to = 32767;
void osmo_cc_set_rtp_ports(uint16_t from, uint16_t to)
void osmo_cc_set_rtp_ports(osmo_cc_session_config_t *conf, uint16_t from, uint16_t to)
{
rtp_port_next = from;
rtp_port_from = from;
rtp_port_to = to;
conf->rtp_port_next = from;
conf->rtp_port_from = from;
conf->rtp_port_to = to;
}
struct rtp_hdr {
@ -165,6 +161,7 @@ static void rtp_send(int sock, uint8_t *payload, int payload_len, uint8_t pt, ui
*/
int osmo_cc_rtp_open(osmo_cc_session_media_t *media)
{
osmo_cc_session_config_t *conf = media->session->config;
int domain = 0; // make GCC happy
uint16_t start_port;
struct sockaddr_storage sa;
@ -204,9 +201,9 @@ int osmo_cc_rtp_open(osmo_cc_session_media_t *media)
}
/* rtp_port_from/rtp_port_to may be changed at run time, so rtp_port_next can become out of range. */
if (rtp_port_next < rtp_port_from || rtp_port_next > rtp_port_to)
rtp_port_next = rtp_port_from;
start_port = rtp_port_next;
if (conf->rtp_port_next < conf->rtp_port_from || conf->rtp_port_next > conf->rtp_port_to)
conf->rtp_port_next = conf->rtp_port_from;
start_port = conf->rtp_port_next;
while (1) {
/* open sockets */
rc = socket(domain, SOCK_DGRAM, IPPROTO_UDP);
@ -223,24 +220,24 @@ socket_error:
media->rtcp_socket = rc;
/* bind sockets */
*sport = htons(rtp_port_next);
*sport = htons(conf->rtp_port_next);
rc = bind(media->rtp_socket, (struct sockaddr *)&sa, slen);
if (rc < 0) {
bind_error:
osmo_cc_rtp_close(media);
rtp_port_next = (rtp_port_next + 2 > rtp_port_to) ? rtp_port_from : rtp_port_next + 2;
if (rtp_port_next == start_port) {
conf->rtp_port_next = (conf->rtp_port_next + 2 > conf->rtp_port_to) ? conf->rtp_port_from : conf->rtp_port_next + 2;
if (conf->rtp_port_next == start_port) {
PDEBUG(DCC, DEBUG_ERROR, "Cannot bind socket (errno=%d(%s))\n", errno, strerror(errno));
return -EIO;
}
continue;
}
*sport = htons(rtp_port_next + 1);
*sport = htons(conf->rtp_port_next + 1);
rc = bind(media->rtcp_socket, (struct sockaddr *)&sa, slen);
if (rc < 0)
goto bind_error;
media->description.port_local = rtp_port_next;
rtp_port_next = (rtp_port_next + 2 > rtp_port_to) ? rtp_port_from : rtp_port_next + 2;
media->description.port_local = conf->rtp_port_next;
conf->rtp_port_next = (conf->rtp_port_next + 2 > conf->rtp_port_to) ? conf->rtp_port_from : conf->rtp_port_next + 2;
/* set nonblocking io */
flags = fcntl(media->rtp_socket, F_GETFL);
flags |= O_NONBLOCK;

@ -1,5 +1,5 @@
void osmo_cc_set_rtp_ports(uint16_t from, uint16_t to);
void osmo_cc_set_rtp_ports(osmo_cc_session_config_t *conf, uint16_t from, uint16_t to);
int osmo_cc_rtp_open(osmo_cc_session_media_t *media);
int osmo_cc_rtp_connect(osmo_cc_session_media_t *media);
void osmo_cc_rtp_send(osmo_cc_session_codec_t *codec, uint8_t *data, int len, int inc_sequence, int inc_timestamp);

@ -244,7 +244,7 @@ int osmo_cc_payload_type_by_attrs(uint8_t *fmt, const char *name, uint32_t *rate
*
* sdp = given SDP text
* return: SDP session description structure */
struct osmo_cc_session *osmo_cc_session_parsesdp(void *priv, const char *_sdp)
struct osmo_cc_session *osmo_cc_session_parsesdp(osmo_cc_session_config_t *conf, void *priv, const char *_sdp)
{
char buffer[strlen(_sdp) + 1], *sdp = buffer;
char *line, *p, *word, *next_word;
@ -260,7 +260,7 @@ struct osmo_cc_session *osmo_cc_session_parsesdp(void *priv, const char *_sdp)
memset(&ccd, 0, sizeof(ccd));
/* create SDP session description */
session = osmo_cc_new_session(priv, NULL, NULL, NULL, osmo_cc_session_nettype_inet, osmo_cc_session_addrtype_ipv4, "127.0.0.1", NULL, 0); // values will be replaced by local definitions during negotiation
session = osmo_cc_new_session(conf, priv, NULL, NULL, NULL, osmo_cc_session_nettype_inet, osmo_cc_session_addrtype_ipv4, "127.0.0.1", NULL, 0); // values will be replaced by local definitions during negotiation
/* check every line of SDP and parse its data */
while(*sdp) {

@ -1,6 +1,6 @@
char *osmo_cc_session_gensdp(struct osmo_cc_session *session);
struct osmo_cc_session *osmo_cc_session_parsesdp(void *priv, const char *_sdp);
struct osmo_cc_session *osmo_cc_session_parsesdp(osmo_cc_session_config_t *conf, void *priv, const char *_sdp);
int osmo_cc_payload_type_by_attrs(uint8_t *fmt, const char *name, uint32_t *rate, int *channels);
void osmo_cc_debug_sdp(const char *sdp);

@ -31,18 +31,14 @@
#define NTP_OFFSET 2208988800
enum osmo_cc_session_nettype default_nettype = osmo_cc_session_nettype_inet;
enum osmo_cc_session_addrtype default_addrtype = osmo_cc_session_addrtype_ipv4;
const char *default_unicast_address = "127.0.0.1";
void osmo_cc_set_local_peer(enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address)
void osmo_cc_set_local_peer(osmo_cc_session_config_t *conf, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address)
{
default_nettype = nettype;
default_addrtype = addrtype;
default_unicast_address = options_strdup(address);
conf->default_nettype = nettype;
conf->default_addrtype = addrtype;
conf->default_unicast_address = options_strdup(address);
}
osmo_cc_session_t *osmo_cc_new_session(void *priv, const char *username, const char *sess_id, const char *sess_version, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *unicast_address, const char *session_name, int debug)
osmo_cc_session_t *osmo_cc_new_session(osmo_cc_session_config_t *conf, void *priv, const char *username, const char *sess_id, const char *sess_version, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *unicast_address, const char *session_name, int debug)
{
osmo_cc_session_t *session;
@ -53,6 +49,7 @@ osmo_cc_session_t *osmo_cc_new_session(void *priv, const char *username, const c
PDEBUG(DCC, DEBUG_ERROR, "No mem!\n");
abort();
}
session->config = conf;
session->priv = priv;
if (username) {
int i;
@ -87,17 +84,17 @@ osmo_cc_session_t *osmo_cc_new_session(void *priv, const char *username, const c
if (nettype)
session->origin_local.nettype = strdup(osmo_cc_session_nettype2string(nettype));
else
session->origin_local.nettype = strdup(osmo_cc_session_nettype2string(default_nettype));
session->origin_local.nettype = strdup(osmo_cc_session_nettype2string(conf->default_nettype));
if (debug) PDEBUG(DCC, DEBUG_DEBUG, " -> network type = %s\n", session->origin_local.nettype);
if (addrtype)
session->origin_local.addrtype = strdup(osmo_cc_session_addrtype2string(addrtype));
else
session->origin_local.addrtype = strdup(osmo_cc_session_addrtype2string(default_addrtype));
session->origin_local.addrtype = strdup(osmo_cc_session_addrtype2string(conf->default_addrtype));
if (debug) PDEBUG(DCC, DEBUG_DEBUG, " -> address type = %s\n", session->origin_local.addrtype);
if (unicast_address)
session->origin_local.unicast_address = strdup(unicast_address);
else
session->origin_local.unicast_address = strdup(default_unicast_address);
session->origin_local.unicast_address = strdup(conf->default_unicast_address);
if (debug) PDEBUG(DCC, DEBUG_DEBUG, " -> unicast address = %s\n", session->origin_local.unicast_address);
if (session_name)
session->name = strdup(session_name);
@ -132,6 +129,7 @@ void osmo_cc_free_session(osmo_cc_session_t *session)
osmo_cc_session_media_t *osmo_cc_add_media(osmo_cc_session_t *session, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address, enum osmo_cc_session_media_type type, uint16_t port, enum osmo_cc_session_media_proto proto, int send, int receive, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), int debug)
{
osmo_cc_session_config_t *conf = session->config;
osmo_cc_session_media_t *media, **mediap;
media = calloc(1, sizeof(*media));
@ -143,15 +141,15 @@ osmo_cc_session_media_t *osmo_cc_add_media(osmo_cc_session_t *session, enum osmo
if (nettype)
media->connection_data_local.nettype = nettype;
else
media->connection_data_local.nettype = default_nettype;
media->connection_data_local.nettype = conf->default_nettype;
if (addrtype)
media->connection_data_local.addrtype = addrtype;
else
media->connection_data_local.addrtype = default_addrtype;
media->connection_data_local.addrtype = conf->default_addrtype;
if (address)
media->connection_data_local.address = strdup(address);
else
media->connection_data_local.address = strdup(default_unicast_address);
media->connection_data_local.address = strdup(conf->default_unicast_address);
media->description.type = type;
media->description.port_local = port;
media->description.proto = proto;
@ -355,7 +353,7 @@ const char *osmo_cc_session_send_offer(osmo_cc_session_t *session)
return sdp;
}
osmo_cc_session_t *osmo_cc_session_receive_offer(void *priv, const char *sdp)
osmo_cc_session_t *osmo_cc_session_receive_offer(osmo_cc_session_config_t *conf, void *priv, const char *sdp)
{
osmo_cc_session_t *session;
int rc;
@ -363,7 +361,7 @@ osmo_cc_session_t *osmo_cc_session_receive_offer(void *priv, const char *sdp)
PDEBUG(DCC, DEBUG_DEBUG, "Parsing session offer.\n");
osmo_cc_debug_sdp(sdp);
session = osmo_cc_session_parsesdp(priv, sdp);
session = osmo_cc_session_parsesdp(conf, priv, sdp);
if (!session)
return NULL;
@ -378,20 +376,22 @@ osmo_cc_session_t *osmo_cc_session_receive_offer(void *priv, const char *sdp)
void osmo_cc_session_accept_media(osmo_cc_session_media_t *media, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address, int send, int receive, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len))
{
osmo_cc_session_config_t *conf = media->session->config;
media->accepted = 1;
if (nettype)
media->connection_data_local.nettype = nettype;
else
media->connection_data_local.nettype = default_nettype;
media->connection_data_local.nettype = conf->default_nettype;
if (addrtype)
media->connection_data_local.addrtype = addrtype;
else
media->connection_data_local.addrtype = default_addrtype;
media->connection_data_local.addrtype = conf->default_addrtype;
free((char *)media->connection_data_local.address);
if (address)
media->connection_data_local.address = strdup(address);
else
media->connection_data_local.address = strdup(default_unicast_address);
media->connection_data_local.address = strdup(conf->default_unicast_address);
media->send = send;
media->receive = receive;
media->receiver = receiver;
@ -552,7 +552,7 @@ int osmo_cc_session_receive_answer(osmo_cc_session_t *session, const char *sdp)
PDEBUG(DCC, DEBUG_DEBUG, "Parsing session answer.\n");
osmo_cc_debug_sdp(sdp);
session_remote = osmo_cc_session_parsesdp(NULL, sdp);
session_remote = osmo_cc_session_parsesdp(session->config, NULL, sdp);
if (!session_remote)
return -EINVAL;

@ -1,3 +1,24 @@
/* configuration */
enum osmo_cc_session_nettype {
osmo_cc_session_nettype_unknown = 0,
osmo_cc_session_nettype_inet,
};
enum osmo_cc_session_addrtype {
osmo_cc_session_addrtype_unknown = 0,
osmo_cc_session_addrtype_ipv4,
osmo_cc_session_addrtype_ipv6,
};
typedef struct osmo_cc_session_config {
enum osmo_cc_session_nettype default_nettype;
enum osmo_cc_session_addrtype default_addrtype;
const char *default_unicast_address;
uint16_t rtp_port_next;
uint16_t rtp_port_from;
uint16_t rtp_port_to;
} osmo_cc_session_config_t;
/* session description, global part: */
@ -12,6 +33,7 @@ typedef struct osmo_cc_session_origin {
/* session instance */
typedef struct osmo_cc_session {
osmo_cc_session_config_t *config;
void *priv;
osmo_cc_session_origin_t origin_local, origin_remote;
const char *name;
@ -20,17 +42,6 @@ typedef struct osmo_cc_session {
/* connection description: */
enum osmo_cc_session_nettype {
osmo_cc_session_nettype_unknown = 0,
osmo_cc_session_nettype_inet,
};
enum osmo_cc_session_addrtype {
osmo_cc_session_addrtype_unknown = 0,
osmo_cc_session_addrtype_ipv4,
osmo_cc_session_addrtype_ipv6,
};
typedef struct osmo_cc_session_connection_data {
enum osmo_cc_session_nettype nettype;
const char *nettype_name;
@ -96,8 +107,8 @@ typedef struct osmo_cc_session_codec {
#define osmo_cc_session_for_each_codec(head, c) \
for (c = (head); c; c = c->next)
void osmo_cc_set_local_peer(enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address);
osmo_cc_session_t *osmo_cc_new_session(void *priv, const char *username, const char *sess_id, const char *sess_version, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *unicast_address, const char *session_name, int debug);
void osmo_cc_set_local_peer(osmo_cc_session_config_t *conf, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address);
osmo_cc_session_t *osmo_cc_new_session(osmo_cc_session_config_t *conf, void *priv, const char *username, const char *sess_id, const char *sess_version, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *unicast_address, const char *session_name, int debug);
void osmo_cc_free_session(osmo_cc_session_t *session);
osmo_cc_session_media_t *osmo_cc_add_media(osmo_cc_session_t *session, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address, enum osmo_cc_session_media_type type, uint16_t port, enum osmo_cc_session_media_proto proto, int send, int receive, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len), int debug);
void osmo_cc_free_media(osmo_cc_session_media_t *media);
@ -105,7 +116,7 @@ osmo_cc_session_codec_t *osmo_cc_add_codec(osmo_cc_session_media_t *media, const
void osmo_cc_free_codec(osmo_cc_session_codec_t *codec);
int osmo_cc_session_check(struct osmo_cc_session *session, int remote);
const char *osmo_cc_session_send_offer(osmo_cc_session_t *session);
osmo_cc_session_t *osmo_cc_session_receive_offer(void *priv, const char *sdp);
osmo_cc_session_t *osmo_cc_session_receive_offer(osmo_cc_session_config_t *conf, void *priv, const char *sdp);
void osmo_cc_session_accept_media(osmo_cc_session_media_t *media, enum osmo_cc_session_nettype nettype, enum osmo_cc_session_addrtype addrtype, const char *address, int send, int receive, void (*receiver)(struct osmo_cc_session_codec *codec, uint16_t sequence_number, uint32_t timestamp, uint8_t *data, int len));
void osmo_cc_session_accept_codec(osmo_cc_session_codec_t *codec, void (*encoder)(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len), void (*decoder)(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len));
const char *osmo_cc_session_send_answer(osmo_cc_session_t *session);

Loading…
Cancel
Save