diff --git a/configure.ac b/configure.ac index 84a1767..1b2e535 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,7 @@ AC_CHECK_HEADERS([net-snmp/net-snmp-config.h]) dnl Checks for typedefs, structures and compiler characteristics PKG_CHECK_MODULES([LIBOSMOCORE], [libosmocore]) +PKG_CHECK_MODULES([LIBOSMOGSM], [libosmogsm]) PKG_CHECK_MODULES([LIBOSMOSCCP], [libosmo-sccp]) PKG_CHECK_MODULES([LIBOSMOVTY], [libosmovty]) #PKG_CHECK_MODULES([NEXUSWARE_C7], [nexusware-c7]) diff --git a/include/bsc_data.h b/include/bsc_data.h index 3588ac8..ecd0747 100644 --- a/include/bsc_data.h +++ b/include/bsc_data.h @@ -24,10 +24,10 @@ #include "mtp_data.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -38,8 +38,8 @@ struct msc_connection; struct mtp_m2ua_transport; struct mtp_udp_data { - struct write_queue write_queue; - struct timer_list snmp_poll; + struct osmo_wqueue write_queue; + struct osmo_timer_list snmp_poll; struct llist_head links; }; @@ -83,7 +83,7 @@ struct bsc_data { /* inject */ int allow_inject; - struct bsc_fd inject_fd; + struct osmo_fd inject_fd; /* m2ua code */ struct sctp_m2ua_transport *m2ua_trans; diff --git a/include/bsc_sccp.h b/include/bsc_sccp.h index 6b4f6c4..0a1adb0 100644 --- a/include/bsc_sccp.h +++ b/include/bsc_sccp.h @@ -23,10 +23,10 @@ #include -#include -#include +#include +#include -#include +#include #include @@ -50,7 +50,7 @@ struct active_sccp_con { int released_from_msc; /* timeout for waiting for the RLC */ - struct timer_list rlc_timeout; + struct osmo_timer_list rlc_timeout; /* how often did we send a RLSD this */ unsigned int rls_tries; diff --git a/include/bss_patch.h b/include/bss_patch.h index d068e5f..6529619 100644 --- a/include/bss_patch.h +++ b/include/bss_patch.h @@ -21,7 +21,7 @@ #ifndef bss_patch_h #define bss_patch_h -#include +#include #include diff --git a/include/cellmgr_debug.h b/include/cellmgr_debug.h index e5d7738..c6d553d 100644 --- a/include/cellmgr_debug.h +++ b/include/cellmgr_debug.h @@ -2,7 +2,7 @@ #define CELLMGR_DEBUG_H #define DEBUG -#include +#include /* Debuag Areas of the code */ enum { diff --git a/include/counter.h b/include/counter.h index 631781c..781187a 100644 --- a/include/counter.h +++ b/include/counter.h @@ -22,7 +22,7 @@ #ifndef counter_h #define counter_h -#include +#include enum { MTP_LSET_TOTA_IN_MSG, diff --git a/include/ipaccess.h b/include/ipaccess.h index 4cf3a28..1658bd4 100644 --- a/include/ipaccess.h +++ b/include/ipaccess.h @@ -1,7 +1,7 @@ #ifndef _IPACCESS_H #define _IPACCESS_H -#include +#include #define IPA_TCP_PORT_OML 3002 #define IPA_TCP_PORT_RSL 3003 @@ -42,8 +42,8 @@ enum ipaccess_id_tags { /* * methods for parsing and sending a message */ -int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd); -struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error); +int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd); +struct msgb *ipaccess_read_msg(struct osmo_fd *bfd, int *error); void ipaccess_prepend_header(struct msgb *msg, int proto); int ipaccess_send_id_ack(int fd); int ipaccess_send_id_req(int fd); diff --git a/include/mgcp/mgcp.h b/include/mgcp/mgcp.h index 2bd6eb5..da8f77b 100644 --- a/include/mgcp/mgcp.h +++ b/include/mgcp/mgcp.h @@ -25,8 +25,8 @@ #include "cellmgr_debug.h" -#include -#include +#include +#include #include @@ -152,7 +152,7 @@ struct mgcp_config { struct in_addr transcoder_in; int transcoder_remote_base; - struct write_queue gw_fd; + struct osmo_wqueue gw_fd; struct mgcp_port_range bts_ports; struct mgcp_port_range net_ports; diff --git a/include/mgcp/mgcp_internal.h b/include/mgcp/mgcp_internal.h index 838e84c..137a608 100644 --- a/include/mgcp/mgcp_internal.h +++ b/include/mgcp/mgcp_internal.h @@ -23,7 +23,7 @@ #ifndef OPENBSC_MGCP_DATA_H #define OPENBSC_MGCP_DATA_H -#include +#include #define CI_UNUSED 0 @@ -66,8 +66,8 @@ struct mgcp_rtp_end { /* * Each end has a socket... */ - struct bsc_fd rtp; - struct bsc_fd rtcp; + struct osmo_fd rtp; + struct osmo_fd rtcp; int local_port; int local_alloc; diff --git a/include/mgcp_ss7.h b/include/mgcp_ss7.h index 45828e8..35f5b9c 100644 --- a/include/mgcp_ss7.h +++ b/include/mgcp_ss7.h @@ -22,8 +22,8 @@ #ifndef mgcp_ss7_h #define mgcp_ss7_h -#include -#include +#include +#include #include @@ -31,11 +31,11 @@ struct mgcp_ss7 { struct mgcp_config *cfg; - struct write_queue mgcp_fd; + struct osmo_wqueue mgcp_fd; struct msgb *mgcp_msg; /* timer */ - struct timer_list poll_timer; + struct osmo_timer_list poll_timer; /* thread handling */ struct thread_notifier *cmd_queue; diff --git a/include/msc_connection.h b/include/msc_connection.h index 7d3d354..94754d7 100644 --- a/include/msc_connection.h +++ b/include/msc_connection.h @@ -20,9 +20,9 @@ #ifndef MSC_CONNECTION_H #define MSC_CONNECTION_H -#include -#include -#include +#include +#include +#include #include @@ -42,22 +42,22 @@ struct msc_connection { /* connection management */ int msc_link_down; - struct write_queue msc_connection; - struct timer_list reconnect_timer; + struct osmo_wqueue msc_connection; + struct osmo_timer_list reconnect_timer; int first_contact; /* time to wait for first message from MSC */ - struct timer_list msc_timeout; + struct osmo_timer_list msc_timeout; int msc_time; /* timeouts for the msc connection */ int ping_time; int pong_time; - struct timer_list ping_timeout; - struct timer_list pong_timeout; + struct osmo_timer_list ping_timeout; + struct osmo_timer_list pong_timeout; /* mgcp messgaes */ - struct write_queue mgcp_agent; + struct osmo_wqueue mgcp_agent; /* application pointer */ struct ss7_application *app; diff --git a/include/mtp_data.h b/include/mtp_data.h index a8f9463..bb6805b 100644 --- a/include/mtp_data.h +++ b/include/mtp_data.h @@ -20,9 +20,9 @@ #ifndef mtp_data_h #define mtp_data_h -#include -#include -#include +#include +#include +#include struct bsc_data; struct mtp_link; @@ -86,8 +86,8 @@ struct mtp_link_set { /* statistics for routing */ int timeout_t18; int timeout_t20; - struct timer_list T18; - struct timer_list T20; + struct osmo_timer_list T18; + struct osmo_timer_list T20; /* custom data */ struct bsc_data *bsc; @@ -110,7 +110,7 @@ struct mtp_link { int available; - struct timer_list link_activate; + struct osmo_timer_list link_activate; /* link test routine */ uint8_t test_ptrn[14]; @@ -122,8 +122,8 @@ struct mtp_link { int was_up; int slta_misses; - struct timer_list t1_timer; - struct timer_list t2_timer; + struct osmo_timer_list t1_timer; + struct osmo_timer_list t2_timer; /* statistics */ struct rate_ctr_group *ctrg; diff --git a/include/sctp_m2ua.h b/include/sctp_m2ua.h index 2ae1472..96ee200 100644 --- a/include/sctp_m2ua.h +++ b/include/sctp_m2ua.h @@ -21,7 +21,7 @@ #include "mtp_data.h" #include -#include +#include #include #include @@ -36,7 +36,7 @@ struct mtp_link; struct sctp_m2ua_transport { int started; struct llist_head conns; - struct bsc_fd bsc; + struct osmo_fd bsc; struct llist_head links; }; @@ -69,7 +69,7 @@ struct sctp_m2ua_conn { uint8_t asp_ident[4]; int asp_up; - struct write_queue queue; + struct osmo_wqueue queue; struct sctp_m2ua_transport *trans; }; diff --git a/include/ss7_application.h b/include/ss7_application.h index 1b4d412..22bbb2e 100644 --- a/include/ss7_application.h +++ b/include/ss7_application.h @@ -21,8 +21,8 @@ #ifndef SS7_APPLICATION_H #define SS7_APPLICATION_H -#include -#include +#include +#include struct bsc_data; struct msc_connection; @@ -73,7 +73,7 @@ struct ss7_application { /* handling for the NAT/State handling */ struct llist_head sccp_connections; - struct timer_list reset_timeout; + struct osmo_timer_list reset_timeout; struct mtp_link_set *target_link; int forward_only; int reset_count; diff --git a/include/thread.h b/include/thread.h index aab4260..6708547 100644 --- a/include/thread.h +++ b/include/thread.h @@ -20,8 +20,8 @@ #ifndef thread_h #define thread_h -#include -#include +#include +#include #include @@ -29,7 +29,7 @@ * routines for dealing with threads */ struct thread_notifier { - struct bsc_fd bfd; + struct osmo_fd bfd; int no_write; int fd[2]; diff --git a/include/udp_input.h b/include/udp_input.h index 7c95384..68fe4b3 100644 --- a/include/udp_input.h +++ b/include/udp_input.h @@ -23,7 +23,7 @@ #define c7_udp_input_h #include -#include +#include #define UDP_FORMAT_SIMPLE_UDP 2 #define UDP_FORMAT_SIMPLE_TCP 3 diff --git a/src/Makefile.am b/src/Makefile.am index 092a183..4d68f30 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ $(NEXUSWARE_C7_CFLAGS) $(NEXUSWARE_UNIPORTE_CFLAGS) $(UNIPORTE) sbin_PROGRAMS = cellmgr_ng osmo_stp mgcp_mgw @@ -14,7 +15,8 @@ cellmgr_ng_SOURCES = main.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \ msc_conn.c link_udp.c snmp_mtp.c debug.c isup.c \ mtp_link.c counter.c sccp_state.c bsc.c ss7_application.c \ vty_interface_legacy.c vty_interface_cmds.c -cellmgr_ng_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \ +cellmgr_ng_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOSCCP_LIBS) $(NEXUSWARE_C7_LIBS) \ -lpthread -lnetsnmp -lcrypto osmo_stp_SOURCES = main_stp.c mtp_layer3.c thread.c pcap.c link_udp.c snmp_mtp.c \ @@ -22,5 +24,6 @@ osmo_stp_SOURCES = main_stp.c mtp_layer3.c thread.c pcap.c link_udp.c snmp_mtp.c bss_patch.c bssap_sccp.c bsc_sccp.c bsc_ussd.c input/ipaccess.c \ mtp_link.c counter.c bsc.c ss7_application.c \ vty_interface.c vty_interface_cmds.c -osmo_stp_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \ +osmo_stp_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOSCCP_LIBS) $(NEXUSWARE_C7_LIBS) \ -lpthread -lnetsnmp -lcrypto -lm2ua -lsctp diff --git a/src/bsc.c b/src/bsc.c index 98c2e8d..1bfa122 100644 --- a/src/bsc.c +++ b/src/bsc.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/src/bsc_sccp.c b/src/bsc_sccp.c index d2b5416..710f850 100644 --- a/src/bsc_sccp.c +++ b/src/bsc_sccp.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include @@ -97,7 +97,7 @@ unsigned int sls_for_src_ref(struct ss7_application *fw, struct sccp_source_refe void free_con(struct active_sccp_con *con) { llist_del(&con->entry); - bsc_del_timer(&con->rlc_timeout); + osmo_timer_del(&con->rlc_timeout); talloc_free(con); } diff --git a/src/bss_patch.c b/src/bss_patch.c index 3f74547..4076bc3 100644 --- a/src/bss_patch.c +++ b/src/bss_patch.c @@ -24,8 +24,9 @@ #include -#include -#include +#include +#include +#include #include diff --git a/src/bssap_sccp.c b/src/bssap_sccp.c index 3c91e59..f60c641 100644 --- a/src/bssap_sccp.c +++ b/src/bssap_sccp.c @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include diff --git a/src/counter.c b/src/counter.c index 2d82efd..cc35557 100644 --- a/src/counter.c +++ b/src/counter.c @@ -22,7 +22,7 @@ #include -#include +#include static const struct rate_ctr_desc mtp_lset_cfg_description[] = { [MTP_LSET_TOTA_IN_MSG] = { "total.in", "Total messages in "}, diff --git a/src/debug.c b/src/debug.c index 2dd1468..d79349b 100644 --- a/src/debug.c +++ b/src/debug.c @@ -20,7 +20,7 @@ #include -#include +#include /* default categories */ static const struct log_info_cat default_categories[] = { diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 32c3b01..ff1c2e7 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -31,9 +31,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include @@ -89,7 +89,7 @@ int ipaccess_send_id_req(int fd) /* base handling of the ip.access protocol */ int ipaccess_rcvmsg_base(struct msgb *msg, - struct bsc_fd *bfd) + struct osmo_fd *bfd) { uint8_t msg_type = *(msg->l2h); int ret = 0; @@ -111,7 +111,7 @@ int ipaccess_rcvmsg_base(struct msgb *msg, * read one ipa message from the socket * return NULL in case of error */ -struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error) +struct msgb *ipaccess_read_msg(struct osmo_fd *bfd, int *error) { struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE, "Abis/IP"); struct ipaccess_head *hh; diff --git a/src/isup.c b/src/isup.c index 770fa62..404dbb1 100644 --- a/src/isup.c +++ b/src/isup.c @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include static struct msgb *isup_status_alloc(int cic, int msg_type, uint8_t *extra, int range, int val) { diff --git a/src/link_udp.c b/src/link_udp.c index 69d2ee9..bc9cf2f 100644 --- a/src/link_udp.c +++ b/src/link_udp.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -47,7 +47,7 @@ static struct mtp_udp_link *find_link(struct mtp_udp_data *data, uint16_t link_i } -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 mtp_udp_data *data; struct mtp_udp_link *link; @@ -60,7 +60,7 @@ static int udp_write_cb(struct bsc_fd *fd, struct msgb *msg) return -1; } - LOGP(DINP, LOGL_DEBUG, "Sending MSU: %s\n", hexdump(msg->data, msg->len)); + LOGP(DINP, LOGL_DEBUG, "Sending MSU: %s\n", osmo_hexdump(msg->data, msg->len)); mtp_handle_pcap(link->base, NET_OUT, msg->l2h, msgb_l2len(msg)); /* the assumption is we have connected the socket to the remote */ @@ -74,7 +74,7 @@ static int udp_write_cb(struct bsc_fd *fd, struct msgb *msg) return 0; } -static int udp_read_cb(struct bsc_fd *fd) +static int udp_read_cb(struct osmo_fd *fd) { struct mtp_udp_data *data; struct mtp_udp_link *ulnk; @@ -160,7 +160,7 @@ static int udp_read_cb(struct bsc_fd *fd) LOGP(DINP, LOGL_DEBUG, "MSU data on link %d/%s of %d/%s data %s.\n", link->nr, link->name, link->set->nr, link->set->name, - hexdump(msg->data, msg->len)); + osmo_hexdump(msg->data, msg->len)); mtp_handle_pcap(link, NET_IN, msg->l2h, msgb_l2len(msg)); mtp_link_set_data(link, msg); @@ -213,7 +213,7 @@ static int udp_link_write(struct mtp_link *link, struct msgb *msg) msg->cb[0] = ulnk->link_index; - if (write_queue_enqueue(&ulnk->data->write_queue, msg) != 0) { + if (osmo_wqueue_enqueue(&ulnk->data->write_queue, msg) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to enqueue msg on link %d/%s of %d/%s.\n", link->nr, link->name, link->set->nr, link->set->name); msgb_free(msg); @@ -244,13 +244,13 @@ static void snmp_poll(void *_data) { struct mtp_udp_data *data = _data; snmp_mtp_poll(); - bsc_schedule_timer(&data->snmp_poll, 0, 5000); + osmo_timer_schedule(&data->snmp_poll, 0, 5000); } int link_global_init(struct mtp_udp_data *data) { INIT_LLIST_HEAD(&data->links); - write_queue_init(&data->write_queue, 100); + osmo_wqueue_init(&data->write_queue, 100); /* socket creation */ data->write_queue.bfd.data = data; @@ -288,7 +288,7 @@ int link_global_bind(struct mtp_udp_data *data, int src_port) } /* now connect the socket to the remote */ - if (bsc_register_fd(&data->write_queue.bfd) != 0) { + if (osmo_fd_register(&data->write_queue.bfd) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to register BFD.\n"); close(fd); return -1; @@ -334,7 +334,7 @@ void snmp_mtp_callback(struct snmp_mtp_session *session, if (!link->blocked) { link->link_activate.cb = do_start; link->link_activate.data = ulink; - bsc_schedule_timer(&link->link_activate, ulink->reset_timeout, 0); + osmo_timer_schedule(&link->link_activate, ulink->reset_timeout, 0); LOGP(DINP, LOGL_NOTICE, "Will bring up link %d/%s of linkset %d/%s in %d seconds.\n", link->nr, link->name, diff --git a/src/links.c b/src/links.c index 9d6bb67..1b97e58 100644 --- a/src/links.c +++ b/src/links.c @@ -28,7 +28,7 @@ #include #include -#include +#include extern struct bsc_data *bsc; @@ -179,6 +179,6 @@ int mtp_handle_pcap(struct mtp_link *link, int dir, const uint8_t *data, int len mtp_pcap_write_msu(link->set->pcap_fd, data, len); /* This might be too expensive? */ - LOGP(DPCAP, LOGL_NOTICE, "Packet: %s\n", hexdump(data, len)); + LOGP(DPCAP, LOGL_NOTICE, "Packet: %s\n", osmo_hexdump(data, len)); return 0; } diff --git a/src/main.c b/src/main.c index fdc5730..4da6294 100644 --- a/src/main.c +++ b/src/main.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -128,7 +128,7 @@ int main(int argc, char **argv) ss7_application_start(app); while (1) { - bsc_select_main(0); + osmo_select_main(0); } return 0; diff --git a/src/main_stp.c b/src/main_stp.c index b87a6cb..2451d35 100644 --- a/src/main_stp.c +++ b/src/main_stp.c @@ -32,7 +32,7 @@ #include -#include +#include #include @@ -82,7 +82,7 @@ static struct mtp_link_set *find_link_set(struct bsc_data *bsc, return NULL; } -static int inject_read_cb(struct bsc_fd *fd, unsigned int what) +static int inject_read_cb(struct osmo_fd *fd, unsigned int what) { struct msgb *msg; struct m2ua_msg_part *data, *link; @@ -184,7 +184,7 @@ static int inject_init(struct bsc_data *bsc) bsc->inject_fd.cb = inject_read_cb; bsc->inject_fd.data = bsc; - if (bsc_register_fd(&bsc->inject_fd) != 0) { + if (osmo_fd_register(&bsc->inject_fd) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to register.\n"); close(fd); return -1; @@ -270,7 +270,7 @@ int main(int argc, char **argv) } while (1) { - bsc_select_main(0); + osmo_select_main(0); } return 0; diff --git a/src/mgcp/mgcp_network.c b/src/mgcp/mgcp_network.c index 5bac1af..9649b33 100644 --- a/src/mgcp/mgcp_network.c +++ b/src/mgcp/mgcp_network.c @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -256,7 +256,7 @@ static int recevice_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in return rc; } -static int rtp_data_net(struct bsc_fd *fd, unsigned int what) +static int rtp_data_net(struct osmo_fd *fd, unsigned int what) { char buf[4096]; struct sockaddr_in addr; @@ -328,7 +328,7 @@ static void discover_bts(struct mgcp_endpoint *endp, int proto, struct sockaddr_ } } -static int rtp_data_bts(struct bsc_fd *fd, unsigned int what) +static int rtp_data_bts(struct osmo_fd *fd, unsigned int what) { char buf[4096]; struct sockaddr_in addr; @@ -382,7 +382,7 @@ static int rtp_data_bts(struct bsc_fd *fd, unsigned int what) } static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_endp, - int dest, struct bsc_fd *fd) + int dest, struct osmo_fd *fd) { char buf[4096]; struct sockaddr_in addr; @@ -422,7 +422,7 @@ static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_ return send_to(_endp, dest, proto == PROTO_RTP, &addr, &buf[0], rc); } -static int rtp_data_trans_net(struct bsc_fd *fd, unsigned int what) +static int rtp_data_trans_net(struct osmo_fd *fd, unsigned int what) { struct mgcp_endpoint *endp; endp = (struct mgcp_endpoint *) fd->data; @@ -430,7 +430,7 @@ static int rtp_data_trans_net(struct bsc_fd *fd, unsigned int what) return rtp_data_transcoder(&endp->trans_net, endp, DEST_NETWORK, fd); } -static int rtp_data_trans_bts(struct bsc_fd *fd, unsigned int what) +static int rtp_data_trans_bts(struct osmo_fd *fd, unsigned int what) { struct mgcp_endpoint *endp; endp = (struct mgcp_endpoint *) fd->data; @@ -438,7 +438,7 @@ static int rtp_data_trans_bts(struct bsc_fd *fd, unsigned int what) return rtp_data_transcoder(&endp->trans_bts, endp, DEST_BTS, fd); } -static int create_bind(const char *source_addr, struct bsc_fd *fd, int port) +static int create_bind(const char *source_addr, struct osmo_fd *fd, int port) { struct sockaddr_in addr; int on = 1; @@ -490,14 +490,14 @@ static int bind_rtp(struct mgcp_config *cfg, struct mgcp_rtp_end *rtp_end, int e set_ip_tos(rtp_end->rtcp.fd, cfg->endp_dscp); rtp_end->rtp.when = BSC_FD_READ; - if (bsc_register_fd(&rtp_end->rtp) != 0) { + if (osmo_fd_register(&rtp_end->rtp) != 0) { LOGP(DMGCP, LOGL_ERROR, "Failed to register RTP port %d on 0x%x\n", rtp_end->local_port, endpno); goto cleanup2; } rtp_end->rtcp.when = BSC_FD_READ; - if (bsc_register_fd(&rtp_end->rtcp) != 0) { + if (osmo_fd_register(&rtp_end->rtcp) != 0) { LOGP(DMGCP, LOGL_ERROR, "Failed to register RTCP port %d on 0x%x\n", rtp_end->local_port + 1, endpno); goto cleanup3; @@ -506,7 +506,7 @@ static int bind_rtp(struct mgcp_config *cfg, struct mgcp_rtp_end *rtp_end, int e return 0; cleanup3: - bsc_unregister_fd(&rtp_end->rtp); + osmo_fd_unregister(&rtp_end->rtp); cleanup2: close(rtp_end->rtcp.fd); rtp_end->rtcp.fd = -1; @@ -518,7 +518,7 @@ cleanup0: } static int int_bind(const char *port, - struct mgcp_rtp_end *end, int (*cb)(struct bsc_fd *, unsigned), + struct mgcp_rtp_end *end, int (*cb)(struct osmo_fd *, unsigned), struct mgcp_endpoint *_endp, int rtp_port) { if (end->rtp.fd != -1 || end->rtcp.fd != -1) { @@ -565,13 +565,13 @@ int mgcp_free_rtp_port(struct mgcp_rtp_end *end) if (end->rtp.fd != -1) { close(end->rtp.fd); end->rtp.fd = -1; - bsc_unregister_fd(&end->rtp); + osmo_fd_unregister(&end->rtp); } if (end->rtcp.fd != -1) { close(end->rtcp.fd); end->rtcp.fd = -1; - bsc_unregister_fd(&end->rtcp); + osmo_fd_unregister(&end->rtcp); } return 0; diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c index a8b5ddf..8e1ddc6 100644 --- a/src/mgcp/mgcp_protocol.c +++ b/src/mgcp/mgcp_protocol.c @@ -29,9 +29,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -614,7 +614,7 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg) return create_response_with_sdp(endp, "CRCX", trans_id); error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i); return create_err_response(error_code, "CRCX", trans_id); @@ -739,7 +739,7 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg) error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i, msg->l3h[line_start]); return create_err_response(error_code, "MDCX", trans_id); @@ -828,7 +828,7 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg) error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i); return create_err_response(error_code, "DLCX", trans_id); diff --git a/src/mgcp/mgcp_vty.c b/src/mgcp/mgcp_vty.c index 717a815..5167721 100644 --- a/src/mgcp/mgcp_vty.c +++ b/src/mgcp/mgcp_vty.c @@ -23,7 +23,7 @@ #include -#include +#include #include #include diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index 1201322..bd82bbf 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -25,9 +25,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -534,19 +534,19 @@ static int mgcp_ss7_policy(struct mgcp_trunk_config *tcfg, int endp_no, int stat return rc; } -static void enqueue_msg(struct write_queue *queue, struct sockaddr_in *addr, struct msgb *msg) +static void enqueue_msg(struct osmo_wqueue *queue, struct sockaddr_in *addr, struct msgb *msg) { struct sockaddr_in *data; data = (struct sockaddr_in *) msgb_push(msg, sizeof(*data)); *data = *addr; - if (write_queue_enqueue(queue, msg) != 0) { + if (osmo_wqueue_enqueue(queue, msg) != 0) { LOGP(DMGCP, LOGL_ERROR, "Failed to queue the message.\n"); msgb_free(msg); } } -static int write_call_agent(struct bsc_fd *bfd, struct msgb *msg) +static int write_call_agent(struct osmo_fd *bfd, struct msgb *msg) { int rc; struct sockaddr_in *addr; @@ -562,16 +562,16 @@ static int write_call_agent(struct bsc_fd *bfd, struct msgb *msg) } -static int read_call_agent(struct bsc_fd *fd) +static int read_call_agent(struct osmo_fd *fd) { struct sockaddr_in addr; socklen_t slen = sizeof(addr); struct msgb *resp; struct mgcp_ss7 *cfg; - struct write_queue *queue; + struct osmo_wqueue *queue; cfg = (struct mgcp_ss7 *) fd->data; - queue = container_of(fd, struct write_queue, bfd); + queue = container_of(fd, struct osmo_wqueue, bfd); /* read one less so we can use it as a \0 */ int rc = recvfrom(fd->fd, cfg->mgcp_msg->data, cfg->mgcp_msg->data_len - 1, 0, @@ -600,7 +600,7 @@ static int create_socket(struct mgcp_ss7 *cfg) { int on; struct sockaddr_in addr; - struct bsc_fd *bfd; + struct osmo_fd *bfd; bfd = &cfg->mgcp_fd.bfd; @@ -637,7 +637,7 @@ static int create_socket(struct mgcp_ss7 *cfg) talloc_steal(cfg, cfg->mgcp_msg); - if (bsc_register_fd(bfd) != 0) { + if (osmo_fd_register(bfd) != 0) { DEBUGP(DMGCP, "Failed to register the fd\n"); close(bfd->fd); return -1; @@ -673,7 +673,7 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) if (!conf) return NULL; - write_queue_init(&conf->mgcp_fd, 30); + osmo_wqueue_init(&conf->mgcp_fd, 30); conf->cfg = cfg; /* take over the ownership */ @@ -892,7 +892,7 @@ int main(int argc, char **argv) exit(-1); } while (1) { - bsc_select_main(0); + osmo_select_main(0); } return 0; } diff --git a/src/msc_conn.c b/src/msc_conn.c index a554514..792c482 100644 --- a/src/msc_conn.c +++ b/src/msc_conn.c @@ -27,9 +27,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -50,16 +51,16 @@ static void mgcp_forward(struct msc_connection *fw, const uint8_t *data, unsigne void msc_close_connection(struct msc_connection *fw) { - struct bsc_fd *bfd = &fw->msc_connection.bfd; + struct osmo_fd *bfd = &fw->msc_connection.bfd; close(bfd->fd); - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); bfd->fd = -1; fw->msc_link_down = 1; release_bsc_resources(fw); - bsc_del_timer(&fw->ping_timeout); - bsc_del_timer(&fw->pong_timeout); - bsc_del_timer(&fw->msc_timeout); + osmo_timer_del(&fw->ping_timeout); + osmo_timer_del(&fw->pong_timeout); + osmo_timer_del(&fw->msc_timeout); msc_schedule_reconnect(fw); } @@ -104,16 +105,16 @@ static void msc_ping_timeout(void *_fw_data) send_ping(fw); /* send another ping in 20 seconds */ - bsc_schedule_timer(&fw->ping_timeout, fw->ping_time, 0); + osmo_timer_schedule(&fw->ping_timeout, fw->ping_time, 0); /* also start a pong timer */ - bsc_schedule_timer(&fw->pong_timeout, fw->pong_time, 0); + osmo_timer_schedule(&fw->pong_timeout, fw->pong_time, 0); } /* * callback with IP access data */ -static int ipaccess_a_fd_cb(struct bsc_fd *bfd) +static int ipaccess_a_fd_cb(struct osmo_fd *bfd) { int error; struct ipaccess_head *hh; @@ -133,7 +134,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) return -1; } - LOGP(DMSC, LOGL_DEBUG, "From MSC: %s proto: %d\n", hexdump(msg->data, msg->len), msg->l2h[0]); + LOGP(DMSC, LOGL_DEBUG, "From MSC: %s proto: %d\n", osmo_hexdump(msg->data, msg->len), msg->l2h[0]); /* handle base message handling */ hh = (struct ipaccess_head *) msg->data; @@ -143,7 +144,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) if (hh->proto == IPAC_PROTO_IPACCESS) { if (fw->first_contact) { LOGP(DMSC, LOGL_NOTICE, "Connected to MSC. Sending reset.\n"); - bsc_del_timer(&fw->msc_timeout); + osmo_timer_del(&fw->msc_timeout); fw->first_contact = 0; fw->msc_link_down = 0; msc_send_reset(fw); @@ -151,7 +152,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) if (msg->l2h[0] == IPAC_MSGT_ID_GET && fw->token) { msc_send_id_response(fw); } else if (msg->l2h[0] == IPAC_MSGT_PONG) { - bsc_del_timer(&fw->pong_timeout); + osmo_timer_del(&fw->pong_timeout); } } else if (hh->proto == IPAC_PROTO_SCCP) { msc_dispatch_sccp(fw, msg); @@ -165,11 +166,11 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) return 0; } -static int ipaccess_write_cb(struct bsc_fd *fd, struct msgb *msg) +static int ipaccess_write_cb(struct osmo_fd *fd, struct msgb *msg) { int rc; - LOGP(DMSC, LOGL_DEBUG, "Sending to MSC: %s\n", hexdump(msg->data, msg->len)); + LOGP(DMSC, LOGL_DEBUG, "Sending to MSC: %s\n", osmo_hexdump(msg->data, msg->len)); rc = write(fd->fd, msg->data, msg->len); if (rc != msg->len) LOGP(DMSC, LOGL_ERROR, "Could not write to MSC.\n"); @@ -178,7 +179,7 @@ static int ipaccess_write_cb(struct bsc_fd *fd, struct msgb *msg) } /* called in the case of a non blocking connect */ -static int msc_connection_connect(struct bsc_fd *fd, unsigned int what) +static int msc_connection_connect(struct osmo_fd *fd, unsigned int what) { int rc; int val; @@ -208,7 +209,7 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what) /* go to full operation */ - fd->cb = write_queue_bfd_cb; + fd->cb = osmo_wqueue_bfd_cb; fd->when = BSC_FD_READ; if (!llist_empty(&fw->msc_connection.msg_queue)) fd->when |= BSC_FD_WRITE; @@ -219,7 +220,7 @@ error: return -1; } -static int setnonblocking(struct bsc_fd *fd) +static int setnonblocking(struct osmo_fd *fd) { int flags; @@ -243,7 +244,7 @@ static int setnonblocking(struct bsc_fd *fd) return 0; } -static int connect_to_msc(struct bsc_fd *fd, const char *ip, int port, int tos) +static int connect_to_msc(struct osmo_fd *fd, const char *ip, int port, int tos) { struct sockaddr_in sin; int on = 1, ret; @@ -287,10 +288,10 @@ static int connect_to_msc(struct bsc_fd *fd, const char *ip, int port, int tos) return ret; } else { fd->when = BSC_FD_READ; - fd->cb = write_queue_bfd_cb; + fd->cb = osmo_wqueue_bfd_cb; } - ret = bsc_register_fd(fd); + ret = osmo_fd_register(fd); if (ret < 0) { perror("Registering the fd failed"); close(fd->fd); @@ -306,24 +307,24 @@ static void msc_reconnect(void *_data) int rc; struct msc_connection *fw = _data; - bsc_del_timer(&fw->reconnect_timer); + osmo_timer_del(&fw->reconnect_timer); fw->first_contact = 1; rc = connect_to_msc(&fw->msc_connection.bfd, fw->ip, 5000, fw->dscp); if (rc < 0) { fprintf(stderr, "Opening the MSC connection failed. Trying again\n"); - bsc_schedule_timer(&fw->reconnect_timer, RECONNECT_TIME); + osmo_timer_schedule(&fw->reconnect_timer, RECONNECT_TIME); return; } fw->msc_timeout.cb = msc_connect_timeout; fw->msc_timeout.data = fw; - bsc_schedule_timer(&fw->msc_timeout, fw->msc_time, 0); + osmo_timer_schedule(&fw->msc_timeout, fw->msc_time, 0); } static void msc_schedule_reconnect(struct msc_connection *fw) { - bsc_schedule_timer(&fw->reconnect_timer, RECONNECT_TIME); + osmo_timer_schedule(&fw->reconnect_timer, RECONNECT_TIME); } /* @@ -339,7 +340,7 @@ void msc_mgcp_reset(struct msc_connection *msc) mgcp_forward(msc, (const uint8_t *) mgcp_reset, strlen(mgcp_reset)); } -static int mgcp_do_write(struct bsc_fd *fd, struct msgb *msg) +static int mgcp_do_write(struct osmo_fd *fd, struct msgb *msg) { int ret; @@ -352,7 +353,7 @@ static int mgcp_do_write(struct bsc_fd *fd, struct msgb *msg) return ret; } -static int mgcp_do_read(struct bsc_fd *fd) +static int mgcp_do_read(struct osmo_fd *fd) { struct msgb *mgcp; int ret; @@ -396,7 +397,7 @@ static void mgcp_forward(struct msc_connection *fw, const uint8_t *data, unsigne msgb_put(mgcp, length); memcpy(mgcp->data, data, mgcp->len); - if (write_queue_enqueue(&fw->mgcp_agent, mgcp) != 0) { + if (osmo_wqueue_enqueue(&fw->mgcp_agent, mgcp) != 0) { LOGP(DMGCP, LOGL_FATAL, "Could not queue message to MGCP GW.\n"); msgb_free(mgcp); } @@ -438,13 +439,13 @@ static int mgcp_create_port(struct msc_connection *fw) return -1; } - write_queue_init(&fw->mgcp_agent, 10); + osmo_wqueue_init(&fw->mgcp_agent, 10); fw->mgcp_agent.bfd.data = fw; fw->mgcp_agent.bfd.when = BSC_FD_READ; fw->mgcp_agent.read_cb = mgcp_do_read; fw->mgcp_agent.write_cb = mgcp_do_write; - if (bsc_register_fd(&fw->mgcp_agent.bfd) != 0) { + if (osmo_fd_register(&fw->mgcp_agent.bfd) != 0) { LOGP(DMGCP, LOGL_FATAL, "Failed to register BFD\n"); close(fw->mgcp_agent.bfd.fd); fw->mgcp_agent.bfd.fd = -1; @@ -464,7 +465,7 @@ static void msc_send(struct msc_connection *fw, struct msgb *msg, int proto) ipaccess_prepend_header(msg, proto); - if (write_queue_enqueue(&fw->msc_connection, msg) != 0) { + if (osmo_wqueue_enqueue(&fw->msc_connection, msg) != 0) { LOGP(DMSC, LOGL_FATAL, "Failed to queue MSG for the MSC.\n"); msgb_free(msg); return; @@ -532,7 +533,7 @@ struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp) return NULL; } - write_queue_init(&msc->msc_connection, 100); + osmo_wqueue_init(&msc->msc_connection, 100); msc->reconnect_timer.cb = msc_reconnect; msc->reconnect_timer.data = msc; msc->msc_connection.read_cb = ipaccess_a_fd_cb; diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index dc24a73..14bce65 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include @@ -181,8 +181,8 @@ void mtp_link_set_stop(struct mtp_link_set *set) llist_for_each_entry(lnk, &set->links, entry) mtp_link_stop_link_test(lnk); - bsc_del_timer(&set->T18); - bsc_del_timer(&set->T20); + osmo_timer_del(&set->T18); + osmo_timer_del(&set->T20); set->sccp_up = 0; set->running = 0; @@ -240,8 +240,8 @@ static int linkset_up(struct mtp_link *link) return 0; set->linkset_up = 1; - bsc_schedule_timer(&set->T18, set->timeout_t18, 0); - bsc_schedule_timer(&set->T20, set->timeout_t20, 0); + osmo_timer_schedule(&set->T18, set->timeout_t18, 0); + osmo_timer_schedule(&set->T20, set->timeout_t20, 0); /* More the functionality of a SSP here... */ if (set->sccp_opc != set->opc && @@ -267,7 +267,7 @@ static void linkset_t18_cb(void *_set) if (!link) { LOGP(DINP, LOGL_ERROR, "Linkset restart but no link available on linkset %d\n", set->nr); - bsc_del_timer(&set->T20); + osmo_timer_del(&set->T20); set->linkset_up = 0; return; } @@ -285,7 +285,7 @@ static void linkset_t20_cb(void *_set) if (!link) { LOGP(DINP, LOGL_ERROR, "Linkset restart but no link available on linkset %d\n", set->nr); - bsc_del_timer(&set->T20); + osmo_timer_del(&set->T20); set->linkset_up = 0; return; } @@ -325,8 +325,8 @@ static int mtp_link_sign_msg(struct mtp_link_set *set, struct mtp_level_3_hdr *h * arrive after we expired the timer but we are friendly here and * respond with a TFA and TRA... */ - bsc_del_timer(&set->T18); - bsc_del_timer(&set->T20); + osmo_timer_del(&set->T18); + osmo_timer_del(&set->T20); linkset_t18_cb(set); linkset_t20_cb(set); return 0; @@ -352,7 +352,7 @@ static int mtp_link_sign_msg(struct mtp_link_set *set, struct mtp_level_3_hdr *h } LOGP(DINP, LOGL_ERROR, "Unknown message:%d/%d %s on %d/%s.\n", - cmn->h0, cmn->h1, hexdump(&hdr->data[0], l3_len), + cmn->h0, cmn->h1, osmo_hexdump(&hdr->data[0], l3_len), set->nr, set->name); return -1; } diff --git a/src/mtp_link.c b/src/mtp_link.c index 27d5e48..b48f0d5 100644 --- a/src/mtp_link.c +++ b/src/mtp_link.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -83,12 +83,12 @@ static void mtp_sltm_t1_timeout(void *_link) link->nr, link->name, link->set->nr, link->set->name); ++link->slta_misses; mtp_send_sltm(link); - bsc_schedule_timer(&link->t1_timer, MTP_T1); + osmo_timer_schedule(&link->t1_timer, MTP_T1); } else { LOGP(DINP, LOGL_ERROR, "Two missing SLTAs on link %d/%s of %d/%s.\n", link->nr, link->name, link->set->nr, link->set->name); - bsc_del_timer(&link->t2_timer); + osmo_timer_del(&link->t2_timer); mtp_link_failure(link); } } @@ -107,19 +107,19 @@ static void mtp_sltm_t2_timeout(void *_link) link->slta_misses = 0; mtp_send_sltm(link); - bsc_schedule_timer(&link->t1_timer, MTP_T1); + osmo_timer_schedule(&link->t1_timer, MTP_T1); if (link->set->sltm_once && link->was_up) LOGP(DINP, LOGL_INFO, "Not sending SLTM again on link %d/%s of %d/%s.\n", link->nr, link->name, link->set->nr, link->set->name); else - bsc_schedule_timer(&link->t2_timer, MTP_T2); + osmo_timer_schedule(&link->t2_timer, MTP_T2); } void mtp_link_stop_link_test(struct mtp_link *link) { - bsc_del_timer(&link->t1_timer); - bsc_del_timer(&link->t2_timer); + osmo_timer_del(&link->t1_timer); + osmo_timer_del(&link->t2_timer); link->sltm_pending = 0; } @@ -154,7 +154,7 @@ int mtp_link_slta(struct mtp_link *link, uint16_t l3_len, } /* we had a matching slta */ - bsc_del_timer(&link->t1_timer); + osmo_timer_del(&link->t1_timer); link->sltm_pending = 0; link->was_up = 1; diff --git a/src/sccp_state.c b/src/sccp_state.c index b8874c9..b9efaa4 100644 --- a/src/sccp_state.c +++ b/src/sccp_state.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -191,7 +191,7 @@ void app_clear_connections(struct ss7_application *app) void app_resources_released(struct ss7_application *app) { - bsc_del_timer(&app->reset_timeout); + osmo_timer_del(&app->reset_timeout); } static void bsc_reset_timeout(void *_app) @@ -212,14 +212,14 @@ static void bsc_reset_timeout(void *_app) msg = create_reset(); if (!msg) { - bsc_schedule_timer(&app->reset_timeout, 10, 0); + osmo_timer_schedule(&app->reset_timeout, 10, 0); return; } ++app->reset_count; mtp_link_set_submit_sccp_data(set, -1, msg->l2h, msgb_l2len(msg)); msgb_free(msg); - bsc_schedule_timer(&app->reset_timeout, 20, 0); + osmo_timer_schedule(&app->reset_timeout, 20, 0); } /* @@ -259,7 +259,7 @@ void release_bsc_resources(struct msc_connection *fw) app = fw->app; set = app->route_src.set; - bsc_del_timer(&app->reset_timeout); + osmo_timer_del(&app->reset_timeout); /* 2. clear the MGCP endpoints */ msc_mgcp_reset(fw); @@ -287,7 +287,7 @@ void release_bsc_resources(struct msc_connection *fw) app->reset_timeout.cb = bsc_reset_timeout; app->reset_timeout.data = app; app->reset_count = 0; - bsc_schedule_timer(&app->reset_timeout, 10, 0); + osmo_timer_schedule(&app->reset_timeout, 10, 0); } } @@ -481,7 +481,7 @@ static void send_local_rlsd_for_con(void *data) /* try again in three seconds */ con->rlc_timeout.data = con; con->rlc_timeout.cb = send_local_rlsd_for_con; - bsc_schedule_timer(&con->rlc_timeout, 3, 0); + osmo_timer_schedule(&con->rlc_timeout, 3, 0); /* we send this to the BSC so we need to switch src and dest */ rlsd = create_sccp_rlsd(&con->dst_ref, &con->src_ref); diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c index 4b4b487..017f65e 100644 --- a/src/sctp_m2ua.c +++ b/src/sctp_m2ua.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -56,8 +56,8 @@ static void m2ua_conn_destroy(struct sctp_m2ua_conn *conn) struct mtp_m2ua_link *link; close(conn->queue.bfd.fd); - bsc_unregister_fd(&conn->queue.bfd); - write_queue_clear(&conn->queue); + osmo_fd_unregister(&conn->queue.bfd); + osmo_wqueue_clear(&conn->queue); llist_del(&conn->entry); llist_for_each_entry(link, &conn->trans->links, entry) { @@ -91,7 +91,7 @@ static int m2ua_conn_send(struct sctp_m2ua_conn *conn, msgb_push(msg, sizeof(*info)); memcpy(msg->data, info, sizeof(*info)); - if (write_queue_enqueue(&conn->queue, msg) != 0) { + if (osmo_wqueue_enqueue(&conn->queue, msg) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to enqueue.\n"); msgb_free(msg); return -1; @@ -540,7 +540,7 @@ static int m2ua_conn_handle(struct sctp_m2ua_conn *conn, return 0; } -static int m2ua_conn_read(struct bsc_fd *fd) +static int m2ua_conn_read(struct osmo_fd *fd) { struct sockaddr_in addr; struct sctp_sndrcvinfo info; @@ -628,7 +628,7 @@ clean: return 0; } -static int m2ua_conn_write(struct bsc_fd *fd, struct msgb *msg) +static int m2ua_conn_write(struct osmo_fd *fd, struct msgb *msg) { int ret; struct sctp_sndrcvinfo info; @@ -643,7 +643,7 @@ static int m2ua_conn_write(struct bsc_fd *fd, struct msgb *msg) return 0; } -static int sctp_trans_accept(struct bsc_fd *fd, unsigned int what) +static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what) { struct sctp_event_subscribe events; struct sctp_m2ua_transport *trans; @@ -685,14 +685,14 @@ static int sctp_trans_accept(struct bsc_fd *fd, unsigned int what) conn->trans = trans; - write_queue_init(&conn->queue, 10); + osmo_wqueue_init(&conn->queue, 10); conn->queue.bfd.fd = s; conn->queue.bfd.data = conn; conn->queue.bfd.when = BSC_FD_READ; conn->queue.read_cb = m2ua_conn_read; conn->queue.write_cb = m2ua_conn_write; - if (bsc_register_fd(&conn->queue.bfd) != 0) { + if (osmo_fd_register(&conn->queue.bfd) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to register.\n"); close(s); talloc_free(conn); @@ -788,7 +788,7 @@ int sctp_m2ua_transport_bind(struct sctp_m2ua_transport *trans, trans->bsc.cb = sctp_trans_accept; trans->bsc.when = BSC_FD_READ; - if (bsc_register_fd(&trans->bsc) != 0) { + if (osmo_fd_register(&trans->bsc) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to register the fd.\n"); close(sctp); return -4; diff --git a/src/snmp_mtp.c b/src/snmp_mtp.c index 308e6b8..c316369 100644 --- a/src/snmp_mtp.c +++ b/src/snmp_mtp.c @@ -19,7 +19,7 @@ */ #include #include -#include +#include static void add_pdu_var(netsnmp_pdu *pdu, const char *mib_name, int id, const char *value) { diff --git a/src/ss7_application.c b/src/ss7_application.c index ef74f3e..12e97df 100644 --- a/src/ss7_application.c +++ b/src/ss7_application.c @@ -28,7 +28,7 @@ #include #include -#include +#include /* the SS7 dispatch... maybe as function pointers in the future */ diff --git a/src/thread.c b/src/thread.c index 3f48dd0..83aa08f 100644 --- a/src/thread.c +++ b/src/thread.c @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/src/vty_interface.c b/src/vty_interface.c index 255dd44..5d67d75 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -880,7 +880,7 @@ void cell_vty_init(void) { cmd_init(1); vty_init(&vty_info); - logging_vty_add_cmds(); + logging_vty_add_cmds(&log_info); install_element(CONFIG_NODE, &cfg_ss7_cmd); install_node(&ss7_node, config_write_ss7); diff --git a/src/vty_interface_cmds.c b/src/vty_interface_cmds.c index 988444b..ef8fa95 100644 --- a/src/vty_interface_cmds.c +++ b/src/vty_interface_cmds.c @@ -23,11 +23,12 @@ #include #include -#include +#include #include #include #include +#include #include #include diff --git a/src/vty_interface_legacy.c b/src/vty_interface_legacy.c index 59f3852..89f32d8 100644 --- a/src/vty_interface_legacy.c +++ b/src/vty_interface_legacy.c @@ -24,9 +24,10 @@ #include #include #include +#include -#include -#include +#include +#include #include #include @@ -327,7 +328,7 @@ void cell_vty_init(void) { cmd_init(1); vty_init(&vty_info); - logging_vty_add_cmds(); + logging_vty_add_cmds(&log_info); install_element(CONFIG_NODE, &cfg_cell_cmd); install_node(&cell_node, config_write_cell);