port to more recent libosmocore API

This code has been bitrotting and missing all of the libosmocore API
changes of teh last 1.5 years or so...
This commit is contained in:
Harald Welte 2012-01-30 20:35:41 +01:00
parent 05943cb3cb
commit 44c1119d0d
12 changed files with 53 additions and 53 deletions

View File

@ -22,8 +22,8 @@
#include <stdint.h>
#include <errno.h>
#include <libosmocore/linuxlist.h>
#include <libosmocore/msgb.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/msgb.h>
#include "tcap_user.h"

View File

@ -23,8 +23,8 @@
#include <stdint.h>
#include <errno.h>
#include <osmocore/talloc.h>
#include <osmocore/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/msgb.h>
#include "tcap.h"

View File

@ -23,8 +23,8 @@
#include <errno.h>
#include <osmocore/talloc.h>
#include <osmocore/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/msgb.h>
#include "tcap.h"
@ -107,7 +107,7 @@ int tcap_ism_op_sent(struct tcap_invocation *ti)
/* Start invocation timer */
ti->inv_timer.cb = tcap_ism_inv_timer_exp;
ti->inv_timer.data = ti;
bsc_schedule_timer(&ti->inv_timer, ti->inv_timeout, 0);
osmo_timer_schedule(&ti->inv_timer, ti->inv_timeout, 0);
switch (ti->op_class) {
case 1:
@ -146,11 +146,11 @@ int tcap_ism_rr_l_recv(struct tcap_invocation *ti, struct ReturnResult *res,
/* TC-RESULT-L.ind (TCU <- CHA) */
rc = tcap_tcu_result_l_ind(ti, opCode, param, last_component);
/* Stop invocation timer */
bsc_del_timer(&ti->inv_timer);
osmo_timer_del(&ti->inv_timer);
/* Start reject timer */
ti->rej_timer.cb = tcap_ism_rej_timer_exp;
ti->rej_timer.data = ti;
bsc_schedule_timer(&ti->rej_timer, ti->rej_timeout, 0);
osmo_timer_schedule(&ti->rej_timer, ti->rej_timeout, 0);
tcap_ism_set_state(ti, TCAP_IS_WAIT_REJECT);
break;
case TCAP_IS_OP_SENT_CL2:
@ -158,7 +158,7 @@ int tcap_ism_rr_l_recv(struct tcap_invocation *ti, struct ReturnResult *res,
/* Generate RJ component (CCO <- ISM) */
rc = tcap_cco_gen_rej(ti);
/* Stop invocation timer */
bsc_del_timer(&ti->inv_timer);
osmo_timer_del(&ti->inv_timer);
tcap_ism_set_state(ti, TCAP_IS_INVALID);
tcap_ism_free(ti);
break;
@ -174,11 +174,11 @@ int tcap_ism_re_recv(struct tcap_invocation *ti, struct ReturnError *re,
case TCAP_IS_OP_SENT_CL2:
/* TC-U-ERROR.ind (TCU <- CHA) */
/* Stop invocation timer */
bsc_del_timer(&ti->inv_timer);
osmo_timer_del(&ti->inv_timer);
/* Start reject timer */
ti->rej_timer.cb = tcap_ism_rej_timer_exp;
ti->rej_timer.data = ti;
bsc_schedule_timer(&ti->rej_timer, ti->rej_timeout, 0);
osmo_timer_schedule(&ti->rej_timer, ti->rej_timeout, 0);
tcap_ism_set_state(ti, TCAP_IS_WAIT_REJECT);
break;
case TCAP_IS_OP_SENT_CL3:
@ -218,7 +218,7 @@ int tcap_ism_rr_nl_recv(struct tcap_invocation *ti, struct ReturnResult *res,
/* Generate RJ component (CCO <- ISM) */
rc = tcap_cco_gen_rej(ti);
/* Stop invocation timer */
bsc_del_timer(&ti->inv_timer);
osmo_timer_del(&ti->inv_timer);
tcap_ism_set_state(ti, TCAP_IS_INVALID);
tcap_ism_free(ti);
break;
@ -244,7 +244,7 @@ int tcap_ism_terminate(struct tcap_invocation *ti)
}
/* Stop invoation timer */
bsc_del_timer(&ti->inv_timer);
osmo_timer_del(&ti->inv_timer);
tcap_ism_set_state(ti, TCAP_IS_INVALID);
tcap_ism_free(ti);

View File

@ -22,9 +22,9 @@
#include <errno.h>
#include <netinet/in.h>
#include <osmocore/talloc.h>
#include <osmocore/msgb.h>
#include <osmocore/utils.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/utils.h>
#include <asn1c/OBJECT_IDENTIFIER.h>

View File

@ -22,10 +22,10 @@
#include <stdint.h>
#include <errno.h>
#include <osmocore/linuxlist.h>
#include <osmocore/talloc.h>
#include <osmocore/utils.h>
#include <osmocore/logging.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
#include "tcap.h"

View File

@ -28,9 +28,9 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <osmocore/logging.h>
#include <osmocore/msgb.h>
#include <osmocore/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include "tcap_user.h"
#include "tcap.h"
@ -48,22 +48,22 @@ int tcap_tco_n_notice_ind(struct tcap_transport_entity *se);
static int tcap_tp_udp_unitdata_req(struct tcap_transport_entity *se, struct msgb *msg)
{
return write_queue_enqueue(&se->udp.write_queue, msg);
return osmo_wqueue_enqueue(&se->udp.write_queue, msg);
}
/* called by the write queue / FD magic in case we need to write a message */
static int udp_write_cb(struct bsc_fd *fd, struct msgb *msg)
static int udp_write_cb(struct osmo_fd *fd, struct msgb *msg)
{
struct write_queue *wq = container_of(fd, struct write_queue, bfd);
struct osmo_wqueue *wq = container_of(fd, struct osmo_wqueue, bfd);
struct tcap_transport_entity *tte = container_of(wq, struct tcap_transport_entity, udp.write_queue);
return sendto(fd->fd, msg->data, msg->len, 0, (struct sockaddr *) &tte->remote_addr, sizeof(tte->remote_addr));
}
/* called by write queue / FD magic in case the socket has some data */
static int udp_read_cb(struct bsc_fd *fd)
static int udp_read_cb(struct osmo_fd *fd)
{
struct write_queue *wq = container_of(fd, struct write_queue, bfd);
struct osmo_wqueue *wq = container_of(fd, struct osmo_wqueue, bfd);
struct tcap_transport_entity *tte = container_of(wq, struct tcap_transport_entity, udp.write_queue);
struct msgb *msg = msgb_alloc_headroom(4096+128, 128, "incoming TCAP/UDP");
socklen_t addr_len = sizeof(tte->remote_addr);
@ -89,7 +89,7 @@ static int udp_read_cb(struct bsc_fd *fd)
LIB_EXPORTED struct tcap_transport_entity *tcap_transp_udp_create(struct sockaddr_storage *local_addr)
{
struct tcap_transport_entity *tte = talloc_zero(NULL, struct tcap_transport_entity);
struct write_queue *wq;
struct osmo_wqueue *wq;
int rc;
if (!tte)
@ -100,7 +100,7 @@ LIB_EXPORTED struct tcap_transport_entity *tcap_transp_udp_create(struct sockadd
/* Initialize write queue */
wq = &tte->udp.write_queue;
write_queue_init(wq, 100);
osmo_wqueue_init(wq, 100);
wq->read_cb = udp_read_cb;
wq->write_cb = udp_write_cb;
@ -113,7 +113,7 @@ LIB_EXPORTED struct tcap_transport_entity *tcap_transp_udp_create(struct sockadd
goto err_close;
wq->bfd.when |= BSC_FD_READ;
bsc_register_fd(&wq->bfd);
osmo_fd_register(&wq->bfd);
return tte;
@ -129,7 +129,7 @@ int tcap_scXp_n_unitdata_req(struct tcap_transport_entity *se, struct msgb *msg)
{
int rc = 0;
printf("N-UNITDATA.req(%s)\n", hexdump(msg->data, msg->len));
//printf("N-UNITDATA.req(%s)\n", osmo_hexdump(msg->data, msg->len));
#if 0
int i = open("ber.out", O_CREAT|O_WRONLY|O_TRUNC);
write(i, msg->data, msg->len);
@ -137,7 +137,7 @@ int tcap_scXp_n_unitdata_req(struct tcap_transport_entity *se, struct msgb *msg)
#endif
switch (se->type) {
case SCXP_T_UDP:
rc = write_queue_enqueue(&se->udp.write_queue, msg);
rc = osmo_wqueue_enqueue(&se->udp.write_queue, msg);
break;
}

View File

@ -21,10 +21,10 @@
#include <stdint.h>
#include <osmocore/linuxlist.h>
#include <osmocore/timer.h>
#include <osmocore/msgb.h>
#include <osmocore/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
#include <osmocom/tcap/TCMessage.h>
#include <osmocom/tcap/OPERATION.h>
@ -106,8 +106,8 @@ struct tcap_invocation {
/* Invocation timer */
uint32_t inv_timeout; /* Seconds */
uint32_t rej_timeout; /* Seconds */
struct timer_list inv_timer; /* Invoke Timer */
struct timer_list rej_timer; /* Reject Timer */
struct osmo_timer_list inv_timer; /* Invoke Timer */
struct osmo_timer_list rej_timer; /* Reject Timer */
/* user reference */
unsigned long user_ref;

View File

@ -28,8 +28,8 @@
//#include <asn1/OBJECT_IDENTIFIER.h>
#include <osmocore/utils.h>
#include <osmocore/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/talloc.h>
#include "tcap_user.h"
@ -226,6 +226,6 @@ int main(int argc, char **argv)
}
while (1) {
bsc_select_main(0);
osmo_select_main(0);
}
}

View File

@ -23,8 +23,8 @@
#include <stdint.h>
#include <sys/socket.h>
#include <osmocore/select.h>
#include <osmocore/write_queue.h>
#include <osmocom/core/select.h>
#include <osmocom/core/write_queue.h>
#include <asn1c/OBJECT_IDENTIFIER.h>
#include <osmocom/tcap/Parameter.h>
@ -48,7 +48,7 @@ struct tcap_transport_entity {
enum tcap_transport_entity_type type;
union {
struct {
struct write_queue write_queue;
struct osmo_wqueue write_queue;
} udp;
struct {
} sccp_ipa;

View File

@ -22,9 +22,9 @@
#include <stdint.h>
#include <errno.h>
#include <osmocore/msgb.h>
#include <osmocore/utils.h>
#include <osmocore/talloc.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/talloc.h>
#include <osmocom/tcap/Parameter.h>
#include <osmocom/tcap/OPERATION.h>

View File

@ -23,8 +23,8 @@
#include <errno.h>
#include <netinet/in.h>
#include <osmocore/msgb.h>
#include <osmocore/logging.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/logging.h>
#include <osmocom/tcap/TCMessage.h>
#include "tcap.h"
@ -48,7 +48,7 @@ int tcap_tco_n_unitdata_ind(struct tcap_transport_entity *se, struct msgb *msg)
struct tcap_transaction *tt;
uint32_t dest_tid;
fprintf(stdout, "N-UNITDATA.ind(%s):\n", hexdump(msg->data, msg->len));
fprintf(stdout, "N-UNITDATA.ind(%s):\n", osmo_hexdump(msg->data, msg->len));
rv = ber_decode(NULL, &asn_DEF_TCMessage, (void **) &tcmsg, msg->data, msg->len);
if (rv.code != RC_OK) {

View File

@ -23,7 +23,7 @@
#include <errno.h>
#include <netinet/in.h>
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <osmocom/tcap/TCMessage.h>
#include "tcap.h"