From 4db92992865e1548e32ba2e95a9dc074dd90847b Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 6 May 2011 12:11:23 +0200 Subject: src: use namespace prefix osmo_fd* and osmo_select* Summary of changes: s/struct bsc_fd/struct osmo_fd/g s/bsc_register_fd/osmo_fd_register/g s/bsc_unregister_fd/osmo_fd_unregister/g s/bsc_select_main/osmo_select_main/g --- openbsc/doc/e1-data-model.txt | 2 +- openbsc/include/openbsc/bsc_nat.h | 4 +- openbsc/include/openbsc/e1_input.h | 6 +-- openbsc/include/openbsc/gprs_ns.h | 4 +- openbsc/include/openbsc/ipaccess.h | 4 +- openbsc/include/openbsc/mgcp_internal.h | 4 +- openbsc/include/openbsc/osmo_bsc_rf.h | 2 +- openbsc/include/openbsc/rtp_proxy.h | 2 +- openbsc/include/openbsc/sgsn.h | 6 +-- openbsc/include/openbsc/socket.h | 4 +- openbsc/src/gprs/gb_proxy_main.c | 2 +- openbsc/src/gprs/sgsn_libgtp.c | 8 ++-- openbsc/src/gprs/sgsn_main.c | 2 +- openbsc/src/ipaccess/ipaccess-config.c | 2 +- openbsc/src/ipaccess/ipaccess-find.c | 10 ++--- openbsc/src/ipaccess/ipaccess-proxy.c | 64 +++++++++++++++---------------- openbsc/src/libabis/input/dahdi.c | 16 ++++---- openbsc/src/libabis/input/hsl.c | 22 +++++------ openbsc/src/libabis/input/ipaccess.c | 56 +++++++++++++-------------- openbsc/src/libabis/input/misdn.c | 16 ++++---- openbsc/src/libbsc/bsc_msc.c | 14 +++---- openbsc/src/libcommon/socket.c | 6 +-- openbsc/src/libgb/gprs_ns.c | 8 ++-- openbsc/src/libgb/gprs_ns_frgre.c | 10 ++--- openbsc/src/libmgcp/mgcp_network.c | 24 ++++++------ openbsc/src/libmsc/mncc_sock.c | 28 +++++++------- openbsc/src/libtrau/rtp_proxy.c | 14 +++---- openbsc/src/osmo-bsc/osmo_bsc_main.c | 2 +- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 10 ++--- openbsc/src/osmo-bsc/osmo_bsc_rf.c | 14 +++---- openbsc/src/osmo-bsc_mgcp/mgcp_main.c | 6 +-- openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c | 6 +-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 16 ++++---- openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 2 +- openbsc/src/osmo-bsc_nat/bsc_ussd.c | 8 ++-- openbsc/src/osmo-nitb/bsc_hack.c | 2 +- openbsc/src/utils/bs11_config.c | 2 +- openbsc/src/utils/rs232.c | 12 +++--- openbsc/tests/channel/channel_test.c | 2 +- 39 files changed, 211 insertions(+), 211 deletions(-) diff --git a/openbsc/doc/e1-data-model.txt b/openbsc/doc/e1-data-model.txt index 9286d5f8a..509004fe9 100644 --- a/openbsc/doc/e1-data-model.txt +++ b/openbsc/doc/e1-data-model.txt @@ -140,7 +140,7 @@ struct e1inp_ts { union { struct { /* mISDN driver has one fd for each ts */ - struct bsc_fd; + struct osmo_fd; } misdn; } driver; }; diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 7d8c37e73..73911bcc9 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -275,7 +275,7 @@ struct bsc_nat { regex_t ussd_query_re; char *ussd_token; char *ussd_local; - struct bsc_fd ussd_listen; + struct osmo_fd ussd_listen; struct bsc_nat_ussd_con *ussd_con; /* for maintainenance */ @@ -363,7 +363,7 @@ uint32_t bsc_mgcp_extract_ci(const char *resp); int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id); int bsc_do_write(struct write_queue *queue, struct msgb *msg, int id); int bsc_write_msg(struct write_queue *queue, struct msgb *msg); -int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg); +int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg); /* IMSI allow/deny handling */ int bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv) __attribute__ ((warn_unused_result)); diff --git a/openbsc/include/openbsc/e1_input.h b/openbsc/include/openbsc/e1_input.h index cd8abcabc..0eae5d9a2 100644 --- a/openbsc/include/openbsc/e1_input.h +++ b/openbsc/include/openbsc/e1_input.h @@ -81,15 +81,15 @@ struct e1inp_ts { union { struct { /* mISDN driver has one fd for each ts */ - struct bsc_fd fd; + struct osmo_fd fd; } misdn; struct { /* ip.access driver has one fd for each ts */ - struct bsc_fd fd; + struct osmo_fd fd; } ipaccess; struct { /* DAHDI driver has one fd for each ts */ - struct bsc_fd fd; + struct osmo_fd fd; struct lapd_instance *lapd; } dahdi; } driver; diff --git a/openbsc/include/openbsc/gprs_ns.h b/openbsc/include/openbsc/gprs_ns.h index f497e2368..8f28d4623 100644 --- a/openbsc/include/openbsc/gprs_ns.h +++ b/openbsc/include/openbsc/gprs_ns.h @@ -133,13 +133,13 @@ struct gprs_ns_inst { /* NS-over-IP specific bits */ struct { - struct bsc_fd fd; + struct osmo_fd fd; uint32_t local_ip; uint16_t local_port; } nsip; /* NS-over-FR-over-GRE-over-IP specific bits */ struct { - struct bsc_fd fd; + struct osmo_fd fd; uint32_t local_ip; int enabled:1; } frgre; diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h index 388ad643a..8d30327a1 100644 --- a/openbsc/include/openbsc/ipaccess.h +++ b/openbsc/include/openbsc/ipaccess.h @@ -85,8 +85,8 @@ int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa); /* * 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); void ipaccess_prepend_header_ext(struct msgb *msg, int proto); int ipaccess_send_pong(int fd); diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h index 0214318f8..a9d51494b 100644 --- a/openbsc/include/openbsc/mgcp_internal.h +++ b/openbsc/include/openbsc/mgcp_internal.h @@ -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/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h index f1ff9baec..dbbb3dbf8 100644 --- a/openbsc/include/openbsc/osmo_bsc_rf.h +++ b/openbsc/include/openbsc/osmo_bsc_rf.h @@ -9,7 +9,7 @@ struct gsm_network; struct osmo_bsc_rf { /* the value of signal.h */ int policy; - struct bsc_fd listen; + struct osmo_fd listen; struct gsm_network *gsm_network; const char *last_state_command; diff --git a/openbsc/include/openbsc/rtp_proxy.h b/openbsc/include/openbsc/rtp_proxy.h index 8ad363604..3b208c3e8 100644 --- a/openbsc/include/openbsc/rtp_proxy.h +++ b/openbsc/include/openbsc/rtp_proxy.h @@ -48,7 +48,7 @@ struct rtp_sub_socket { struct sockaddr_in sin_local; struct sockaddr_in sin_remote; - struct bsc_fd bfd; + struct osmo_fd bfd; /* linked list of to-be-transmitted msgb's */ struct llist_head tx_queue; }; diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 00e1ec3fb..745661472 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -21,9 +21,9 @@ struct sgsn_instance { char *config_file; struct sgsn_config cfg; /* File descriptor wrappers for LibGTP */ - struct bsc_fd gtp_fd0; - struct bsc_fd gtp_fd1c; - struct bsc_fd gtp_fd1u; + struct osmo_fd gtp_fd0; + struct osmo_fd gtp_fd1c; + struct osmo_fd gtp_fd1u; /* Timer for libGTP */ struct osmo_timer_list gtp_timer; /* GSN instance for libgtp */ diff --git a/openbsc/include/openbsc/socket.h b/openbsc/include/openbsc/socket.h index 87ef37f07..0fd85f104 100644 --- a/openbsc/include/openbsc/socket.h +++ b/openbsc/include/openbsc/socket.h @@ -7,8 +7,8 @@ #define IPPROTO_GRE 47 #endif -int make_sock(struct bsc_fd *bfd, int proto, +int make_sock(struct osmo_fd *bfd, int proto, uint32_t ip, uint16_t port, int priv_nr, - int (*cb)(struct bsc_fd *fd, unsigned int what), void *data); + int (*cb)(struct osmo_fd *fd, unsigned int what), void *data); #endif /* _BSC_SOCKET_H */ diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c index 4f6944f25..b0fb6643f 100644 --- a/openbsc/src/gprs/gb_proxy_main.c +++ b/openbsc/src/gprs/gb_proxy_main.c @@ -279,7 +279,7 @@ int main(int argc, char **argv) gbprox_reset_persistent_nsvcs(bssgp_nsi); while (1) { - rc = bsc_select_main(0); + rc = osmo_select_main(0); if (rc < 0) exit(3); } diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index 7e6603526..f193aa308 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -505,7 +505,7 @@ int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, } /* libgtp select loop integration */ -static int sgsn_gtp_fd_cb(struct bsc_fd *fd, unsigned int what) +static int sgsn_gtp_fd_cb(struct osmo_fd *fd, unsigned int what) { struct sgsn_instance *sgi = fd->data; int rc; @@ -570,7 +570,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi) sgi->gtp_fd0.data = sgi; sgi->gtp_fd0.when = BSC_FD_READ; sgi->gtp_fd0.cb = sgsn_gtp_fd_cb; - rc = bsc_register_fd(&sgi->gtp_fd0); + rc = osmo_fd_register(&sgi->gtp_fd0); if (rc < 0) return rc; @@ -579,7 +579,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi) sgi->gtp_fd1c.data = sgi; sgi->gtp_fd1c.when = BSC_FD_READ; sgi->gtp_fd1c.cb = sgsn_gtp_fd_cb; - bsc_register_fd(&sgi->gtp_fd1c); + osmo_fd_register(&sgi->gtp_fd1c); if (rc < 0) return rc; @@ -588,7 +588,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi) sgi->gtp_fd1u.data = sgi; sgi->gtp_fd1u.when = BSC_FD_READ; sgi->gtp_fd1u.cb = sgsn_gtp_fd_cb; - bsc_register_fd(&sgi->gtp_fd1u); + osmo_fd_register(&sgi->gtp_fd1u); if (rc < 0) return rc; diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index f6a645ffa..687693965 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -279,7 +279,7 @@ int main(int argc, char **argv) } while (1) { - rc = bsc_select_main(0); + rc = osmo_select_main(0); if (rc < 0) exit(3); } diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index aa38d101e..5cd901c27 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -927,7 +927,7 @@ int main(int argc, char **argv) bts->oml_link->ts->sign.delay = 10; bts->c0->rsl_link->ts->sign.delay = 10; while (1) { - rc = bsc_select_main(0); + rc = osmo_select_main(0); if (rc < 0) exit(3); } diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c index 24f602e5c..b0db045c5 100644 --- a/openbsc/src/ipaccess/ipaccess-find.c +++ b/openbsc/src/ipaccess/ipaccess-find.c @@ -141,7 +141,7 @@ static int read_response(int fd) return parse_response(buf+6, len-6); } -static int bfd_cb(struct bsc_fd *bfd, unsigned int flags) +static int bfd_cb(struct osmo_fd *bfd, unsigned int flags) { if (flags & BSC_FD_READ) return read_response(bfd->fd); @@ -156,7 +156,7 @@ static struct osmo_timer_list timer; static void timer_cb(void *_data) { - struct bsc_fd *bfd = _data; + struct osmo_fd *bfd = _data; bfd->when |= BSC_FD_WRITE; @@ -165,7 +165,7 @@ static void timer_cb(void *_data) int main(int argc, char **argv) { - struct bsc_fd bfd; + struct osmo_fd bfd; char *ifname; int rc; @@ -187,7 +187,7 @@ int main(int argc, char **argv) exit(1); } - bsc_register_fd(&bfd); + osmo_fd_register(&bfd); timer.cb = timer_cb; timer.data = &bfd; @@ -197,7 +197,7 @@ int main(int argc, char **argv) printf("Trying to find ip.access BTS by broadcast UDP...\n"); while (1) { - rc = bsc_select_main(0); + rc = osmo_select_main(0); if (rc < 0) exit(3); } diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index f40590a7e..2717ba129 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -51,9 +51,9 @@ static struct log_target *stderr_target; /* one instance of an ip.access protocol proxy */ struct ipa_proxy { /* socket where we listen for incoming OML from BTS */ - struct bsc_fd oml_listen_fd; + struct osmo_fd oml_listen_fd; /* socket where we listen for incoming RSL from BTS */ - struct bsc_fd rsl_listen_fd; + struct osmo_fd rsl_listen_fd; /* list of BTS's (struct ipa_bts_conn */ struct llist_head bts_list; /* the BSC reconnect timer */ @@ -67,7 +67,7 @@ struct ipa_proxy { static struct ipa_proxy *ipp; struct ipa_proxy_conn { - struct bsc_fd fd; + struct osmo_fd fd; struct llist_head tx_queue; struct ipa_bts_conn *bts_conn; }; @@ -94,12 +94,12 @@ struct ipa_bts_conn { struct ipa_proxy_conn *bsc_rsl_conn[MAX_TRX]; /* UDP sockets for BTS and BSC injection */ - struct bsc_fd udp_bts_fd; - struct bsc_fd udp_bsc_fd; + struct osmo_fd udp_bts_fd; + struct osmo_fd udp_bsc_fd; /* NS data */ struct in_addr bts_addr; - struct bsc_fd gprs_ns_fd; + struct osmo_fd gprs_ns_fd; int gprs_local_port; uint16_t gprs_orig_port; uint32_t gprs_orig_ip; @@ -125,7 +125,7 @@ static char *listen_ipaddr; static char *bsc_ipaddr; static char *gprs_ns_ipaddr; -static int gprs_ns_cb(struct bsc_fd *bfd, unsigned int what); +static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what); #define PROXY_ALLOC_SIZE 1200 @@ -197,7 +197,7 @@ static void _logp_ipbc_uid(unsigned int ss, unsigned int lvl, char *file, int li logp2(ss, lvl, file, line, 0, "unknown "); } -static int handle_udp_read(struct bsc_fd *bfd) +static int handle_udp_read(struct osmo_fd *bfd) { struct ipa_bts_conn *ipbc = bfd->data; struct ipa_proxy_conn *other_conn = NULL; @@ -217,7 +217,7 @@ static int handle_udp_read(struct bsc_fd *bfd) } if (ret == 0) { DEBUGP(DINP, "UDP peer disappeared, dead socket\n"); - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; msgb_free(msg); @@ -288,7 +288,7 @@ static int handle_udp_read(struct bsc_fd *bfd) return 0; } -static int handle_udp_write(struct bsc_fd *bfd) +static int handle_udp_write(struct osmo_fd *bfd) { /* not implemented yet */ bfd->when &= ~BSC_FD_WRITE; @@ -297,7 +297,7 @@ static int handle_udp_write(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int udp_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int udp_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; @@ -310,7 +310,7 @@ static int udp_fd_cb(struct bsc_fd *bfd, unsigned int what) } -static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct bsc_fd *bfd, +static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd, uint16_t site_id, uint16_t bts_id, uint16_t trx_id, struct tlv_parsed *tlvp, struct msgb *msg) @@ -414,9 +414,9 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct bsc_fd *bfd, return 0; err_udp_bsc: - bsc_unregister_fd(&ipbc->udp_bts_fd); + osmo_fd_unregister(&ipbc->udp_bts_fd); err_udp_bts: - bsc_unregister_fd(&ipbc->bsc_oml_conn->fd); + osmo_fd_unregister(&ipbc->bsc_oml_conn->fd); close(ipbc->bsc_oml_conn->fd.fd); talloc_free(ipbc->bsc_oml_conn); ipbc->bsc_oml_conn = NULL; @@ -424,7 +424,7 @@ err_bsc_conn: talloc_free(ipbc->id_resp); talloc_free(ipbc); #if 0 - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); talloc_free(bfd); #endif @@ -433,7 +433,7 @@ err_out: } static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg, - struct bsc_fd *bfd) + struct osmo_fd *bfd) { struct tlv_parsed tlvp; uint8_t msg_type = *(msg->l2h); @@ -536,7 +536,7 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg, return 0; } -struct msgb *ipaccess_proxy_read_msg(struct bsc_fd *bfd, int *error) +struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error) { struct msgb *msg = msgb_alloc(PROXY_ALLOC_SIZE, "Abis/IP"); struct ipaccess_head *hh; @@ -660,7 +660,7 @@ reschedule: osmo_timer_schedule(&ipp->reconn_timer, 5, 0); } -static void handle_dead_socket(struct bsc_fd *bfd) +static void handle_dead_socket(struct osmo_fd *bfd) { struct ipa_proxy_conn *ipc = bfd->data; /* local conn */ struct ipa_proxy_conn *bsc_conn; /* remote conn */ @@ -668,7 +668,7 @@ static void handle_dead_socket(struct bsc_fd *bfd) unsigned int trx_id = bfd->priv_nr >> 8; struct msgb *msg, *msg2; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; @@ -686,7 +686,7 @@ static void handle_dead_socket(struct bsc_fd *bfd) ipbc->oml_conn = NULL; bsc_conn = ipbc->bsc_oml_conn; /* close the connection to the BSC */ - bsc_unregister_fd(&bsc_conn->fd); + osmo_fd_unregister(&bsc_conn->fd); close(bsc_conn->fd.fd); llist_for_each_entry_safe(msg, msg2, &bsc_conn->tx_queue, list) msgb_free(msg); @@ -698,7 +698,7 @@ static void handle_dead_socket(struct bsc_fd *bfd) ipbc->rsl_conn[trx_id] = NULL; bsc_conn = ipbc->bsc_rsl_conn[trx_id]; /* close the connection to the BSC */ - bsc_unregister_fd(&bsc_conn->fd); + osmo_fd_unregister(&bsc_conn->fd); close(bsc_conn->fd.fd); llist_for_each_entry_safe(msg, msg2, &bsc_conn->tx_queue, list) msgb_free(msg); @@ -761,7 +761,7 @@ static void patch_gprs_msg(struct ipa_bts_conn *ipbc, int priv_nr, struct msgb * } } -static int handle_tcp_read(struct bsc_fd *bfd) +static int handle_tcp_read(struct osmo_fd *bfd) { struct ipa_proxy_conn *ipc = bfd->data; struct ipa_bts_conn *ipbc = ipc->bts_conn; @@ -795,7 +795,7 @@ static int handle_tcp_read(struct bsc_fd *bfd) if (hh->proto == IPAC_PROTO_IPACCESS) { ret = ipaccess_rcvmsg(ipc, msg, bfd); if (ret < 0) { - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; talloc_free(bfd); @@ -835,7 +835,7 @@ static int handle_tcp_read(struct bsc_fd *bfd) } /* a TCP socket is ready to be written to */ -static int handle_tcp_write(struct bsc_fd *bfd) +static int handle_tcp_write(struct osmo_fd *bfd) { struct ipa_proxy_conn *ipc = bfd->data; struct ipa_bts_conn *ipbc = ipc->bts_conn; @@ -876,7 +876,7 @@ static int handle_tcp_write(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int ipaccess_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; @@ -892,11 +892,11 @@ static int ipaccess_fd_cb(struct bsc_fd *bfd, unsigned int what) } /* callback of the listening filedescriptor */ -static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) +static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) { int ret; struct ipa_proxy_conn *ipc; - struct bsc_fd *bfd; + struct osmo_fd *bfd; struct sockaddr_in sa; socklen_t sa_len = sizeof(sa); @@ -924,7 +924,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) bfd->priv_nr = listen_bfd->priv_nr; bfd->cb = ipaccess_fd_cb; bfd->when = BSC_FD_READ; - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DINP, LOGL_ERROR, "could not register FD\n"); close(bfd->fd); @@ -955,7 +955,7 @@ static void send_ns(int fd, const char *buf, int size, struct in_addr ip, int po } } -static int gprs_ns_cb(struct bsc_fd *bfd, unsigned int what) +static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what) { struct ipa_bts_conn *bts; char buf[4096]; @@ -990,7 +990,7 @@ static int gprs_ns_cb(struct bsc_fd *bfd, unsigned int what) static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, void *data) { struct ipa_proxy_conn *ipc; - struct bsc_fd *bfd; + struct osmo_fd *bfd; int ret, on = 1; ipc = alloc_conn(); @@ -1018,7 +1018,7 @@ static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, v } /* pre-fill tx_queue with identity request */ - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { close(bfd->fd); talloc_free(ipc); @@ -1200,6 +1200,6 @@ int main(int argc, char **argv) signal(SIGABRT, &signal_handler); while (1) { - bsc_select_main(0); + osmo_select_main(0); } } diff --git a/openbsc/src/libabis/input/dahdi.c b/openbsc/src/libabis/input/dahdi.c index 4fcd64f2a..e02e14127 100644 --- a/openbsc/src/libabis/input/dahdi.c +++ b/openbsc/src/libabis/input/dahdi.c @@ -92,7 +92,7 @@ static void handle_dahdi_exception(struct e1inp_ts *ts) } } -static int handle_ts1_read(struct bsc_fd *bfd) +static int handle_ts1_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -184,7 +184,7 @@ static void timeout_ts1_write(void *data) static void dahdi_write_msg(uint8_t *data, int len, void *cbdata) { - struct bsc_fd *bfd = cbdata; + struct osmo_fd *bfd = cbdata; struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1]; @@ -197,7 +197,7 @@ static void dahdi_write_msg(uint8_t *data, int len, void *cbdata) LOGP(DMI, LOGL_NOTICE, "%s write failed %d\n", __func__, ret); } -static int handle_ts1_write(struct bsc_fd *bfd) +static int handle_ts1_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -259,7 +259,7 @@ static uint8_t * flip_buf_bits ( uint8_t * buf , int len) #define D_BCHAN_TX_GRAN 160 /* write to a B channel TS */ -static int handle_tsX_write(struct bsc_fd *bfd) +static int handle_tsX_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -293,7 +293,7 @@ static int handle_tsX_write(struct bsc_fd *bfd) #define D_TSX_ALLOC_SIZE (D_BCHAN_TX_GRAN) /* FIXME: read from a B channel TS */ -static int handle_tsX_read(struct bsc_fd *bfd) +static int handle_tsX_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -329,7 +329,7 @@ static int handle_tsX_read(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int dahdi_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int dahdi_fd_cb(struct osmo_fd *bfd, unsigned int what) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -420,7 +420,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) unsigned int idx = ts-1; char openstr[128]; struct e1inp_ts *e1i_ts = &line->ts[idx]; - struct bsc_fd *bfd = &e1i_ts->driver.dahdi.fd; + struct osmo_fd *bfd = &e1i_ts->driver.dahdi.fd; bfd->data = line; bfd->priv_nr = ts; @@ -463,7 +463,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) return bfd->fd; } - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { fprintf(stderr, "could not register FD: %s\n", strerror(ret)); diff --git a/openbsc/src/libabis/input/hsl.c b/openbsc/src/libabis/input/hsl.c index 9ff855275..af95afa3b 100644 --- a/openbsc/src/libabis/input/hsl.c +++ b/openbsc/src/libabis/input/hsl.c @@ -64,7 +64,7 @@ /* data structure for one E1 interface with A-bis */ struct hsl_e1_handle { - struct bsc_fd listen_fd; + struct osmo_fd listen_fd; struct gsm_network *gsmnet; }; @@ -81,7 +81,7 @@ int hsl_drop_oml(struct gsm_bts *bts) struct gsm_bts_trx *trx; struct e1inp_ts *ts; struct e1inp_line *line; - struct bsc_fd *bfd; + struct osmo_fd *bfd; if (!bts || !bts->oml_link) return -1; @@ -92,7 +92,7 @@ int hsl_drop_oml(struct gsm_bts *bts) e1inp_event(ts, S_INP_TEI_DN, bts->oml_link->tei, bts->oml_link->sapi); bfd = &ts->driver.ipaccess.fd; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; @@ -109,7 +109,7 @@ int hsl_drop_oml(struct gsm_bts *bts) return -1; } -static int hsl_drop_ts_fd(struct e1inp_ts *ts, struct bsc_fd *bfd) +static int hsl_drop_ts_fd(struct e1inp_ts *ts, struct osmo_fd *bfd) { struct e1inp_sign_link *link, *link2; int bts_nr = -1; @@ -119,7 +119,7 @@ static int hsl_drop_ts_fd(struct e1inp_ts *ts, struct bsc_fd *bfd) e1inp_sign_link_destroy(link); } - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; @@ -195,7 +195,7 @@ static int process_hsl_rsl(struct msgb *msg, struct e1inp_line *line) return 0; } -static int handle_ts1_read(struct bsc_fd *bfd) +static int handle_ts1_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -290,7 +290,7 @@ static void timeout_ts1_write(void *data) ts_want_write(e1i_ts); } -static int handle_ts1_write(struct bsc_fd *bfd) +static int handle_ts1_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -346,7 +346,7 @@ static int handle_ts1_write(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int hsl_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int hsl_fd_cb(struct osmo_fd *bfd, unsigned int what) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -377,14 +377,14 @@ struct e1inp_driver hsl_driver = { }; /* callback of the OML listening filedescriptor */ -static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) +static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) { int ret; int idx = 0; int i; struct e1inp_line *line; struct e1inp_ts *e1i_ts; - struct bsc_fd *bfd; + struct osmo_fd *bfd; struct sockaddr_in sa; socklen_t sa_len = sizeof(sa); @@ -421,7 +421,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) bfd->priv_nr = PRIV_OML; bfd->cb = hsl_fd_cb; bfd->when = BSC_FD_READ; - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DINP, LOGL_ERROR, "could not register FD\n"); close(bfd->fd); diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c index 95e84f60b..13294dc1f 100644 --- a/openbsc/src/libabis/input/ipaccess.c +++ b/openbsc/src/libabis/input/ipaccess.c @@ -51,8 +51,8 @@ /* data structure for one E1 interface with A-bis */ struct ia_e1_handle { - struct bsc_fd listen_fd; - struct bsc_fd rsl_listen_fd; + struct osmo_fd listen_fd; + struct osmo_fd rsl_listen_fd; struct gsm_network *gsmnet; }; @@ -222,7 +222,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; @@ -243,7 +243,7 @@ int ipaccess_rcvmsg_base(struct msgb *msg, } static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, - struct bsc_fd *bfd) + struct osmo_fd *bfd) { struct tlv_parsed tlvp; uint8_t msg_type = *(msg->l2h); @@ -294,14 +294,14 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, bts->oml_tei, 0); } else if (bfd->priv_nr == PRIV_RSL) { struct e1inp_ts *e1i_ts; - struct bsc_fd *newbfd; + struct osmo_fd *newbfd; struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_id); /* drop any old rsl connection */ ipaccess_drop_rsl(trx); if (!bts->oml_link) { - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; talloc_free(bfd); @@ -321,10 +321,10 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, /* get rid of our old temporary bfd */ memcpy(newbfd, bfd, sizeof(*newbfd)); newbfd->priv_nr = PRIV_RSL + trx_id; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); bfd->fd = -1; talloc_free(bfd); - bsc_register_fd(newbfd); + osmo_fd_register(newbfd); } break; } @@ -338,7 +338,7 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, 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; @@ -394,7 +394,7 @@ int ipaccess_drop_oml(struct gsm_bts *bts) struct gsm_bts_trx *trx; struct e1inp_ts *ts; struct e1inp_line *line; - struct bsc_fd *bfd; + struct osmo_fd *bfd; if (!bts || !bts->oml_link) return -1; @@ -405,7 +405,7 @@ int ipaccess_drop_oml(struct gsm_bts *bts) e1inp_event(ts, S_INP_TEI_DN, bts->oml_link->tei, bts->oml_link->sapi); bfd = &ts->driver.ipaccess.fd; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; @@ -424,7 +424,7 @@ int ipaccess_drop_oml(struct gsm_bts *bts) return -1; } -static int ipaccess_drop(struct e1inp_ts *ts, struct bsc_fd *bfd) +static int ipaccess_drop(struct e1inp_ts *ts, struct osmo_fd *bfd) { struct e1inp_sign_link *link; int bts_nr; @@ -436,7 +436,7 @@ static int ipaccess_drop(struct e1inp_ts *ts, struct bsc_fd *bfd) * handling yet. So we can safely delete this bfd and * wait for a reconnect. */ - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; talloc_free(bfd); @@ -455,7 +455,7 @@ static int ipaccess_drop(struct e1inp_ts *ts, struct bsc_fd *bfd) /* error case */ LOGP(DINP, LOGL_ERROR, "Failed to find a signalling link for ts: %p\n", ts); - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; return -1; @@ -463,7 +463,7 @@ static int ipaccess_drop(struct e1inp_ts *ts, struct bsc_fd *bfd) int ipaccess_drop_rsl(struct gsm_bts_trx *trx) { - struct bsc_fd *bfd; + struct osmo_fd *bfd; struct e1inp_ts *ts; if (!trx || !trx->rsl_link) @@ -475,7 +475,7 @@ int ipaccess_drop_rsl(struct gsm_bts_trx *trx) /* close the socket */ bfd = &ts->driver.ipaccess.fd; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); close(bfd->fd); bfd->fd = -1; @@ -486,7 +486,7 @@ int ipaccess_drop_rsl(struct gsm_bts_trx *trx) return -1; } -static int handle_ts1_read(struct bsc_fd *bfd) +static int handle_ts1_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -588,7 +588,7 @@ static void timeout_ts1_write(void *data) ts_want_write(e1i_ts); } -static int handle_ts1_write(struct bsc_fd *bfd) +static int handle_ts1_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -639,7 +639,7 @@ static int handle_ts1_write(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int ipaccess_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -670,14 +670,14 @@ struct e1inp_driver ipaccess_driver = { }; /* callback of the OML listening filedescriptor */ -static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) +static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) { int ret; int idx = 0; int i; struct e1inp_line *line; struct e1inp_ts *e1i_ts; - struct bsc_fd *bfd; + struct osmo_fd *bfd; struct sockaddr_in sa; socklen_t sa_len = sizeof(sa); @@ -714,7 +714,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) bfd->priv_nr = PRIV_OML; bfd->cb = ipaccess_fd_cb; bfd->when = BSC_FD_READ; - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DINP, LOGL_ERROR, "could not register FD\n"); close(bfd->fd); @@ -729,17 +729,17 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) //return e1inp_line_register(line); } -static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) +static int rsl_listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) { struct sockaddr_in sa; socklen_t sa_len = sizeof(sa); - struct bsc_fd *bfd; + struct osmo_fd *bfd; int ret; if (!(what & BSC_FD_READ)) return 0; - bfd = talloc_zero(tall_bsc_ctx, struct bsc_fd); + bfd = talloc_zero(tall_bsc_ctx, struct osmo_fd); if (!bfd) return -ENOMEM; @@ -756,7 +756,7 @@ static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) bfd->priv_nr = PRIV_RSL; bfd->cb = ipaccess_fd_cb; bfd->when = BSC_FD_READ; - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DINP, LOGL_ERROR, "could not register FD\n"); close(bfd->fd); @@ -773,7 +773,7 @@ static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa) { struct e1inp_ts *e1i_ts = &line->ts[0]; - struct bsc_fd *bfd = &e1i_ts->driver.ipaccess.fd; + struct osmo_fd *bfd = &e1i_ts->driver.ipaccess.fd; int ret, on = 1; bfd->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -796,7 +796,7 @@ int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa) return ret; } - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { close(bfd->fd); return ret; diff --git a/openbsc/src/libabis/input/misdn.c b/openbsc/src/libabis/input/misdn.c index 3c337920f..d239ee75c 100644 --- a/openbsc/src/libabis/input/misdn.c +++ b/openbsc/src/libabis/input/misdn.c @@ -85,7 +85,7 @@ const char *get_prim_name(unsigned int prim) return "UNKNOWN"; } -static int handle_ts1_read(struct bsc_fd *bfd) +static int handle_ts1_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -200,7 +200,7 @@ static void timeout_ts1_write(void *data) ts_want_write(e1i_ts); } -static int handle_ts1_write(struct bsc_fd *bfd) +static int handle_ts1_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -253,7 +253,7 @@ static int handle_ts1_write(struct bsc_fd *bfd) #define BCHAN_TX_GRAN 160 /* write to a B channel TS */ -static int handle_tsX_write(struct bsc_fd *bfd) +static int handle_tsX_write(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -281,7 +281,7 @@ static int handle_tsX_write(struct bsc_fd *bfd) #define TSX_ALLOC_SIZE 4096 /* FIXME: read from a B channel TS */ -static int handle_tsX_read(struct bsc_fd *bfd) +static int handle_tsX_read(struct osmo_fd *bfd) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -329,7 +329,7 @@ static int handle_tsX_read(struct bsc_fd *bfd) } /* callback from select.c in case one of the fd's can be read/written */ -static int misdn_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int misdn_fd_cb(struct osmo_fd *bfd, unsigned int what) { struct e1inp_line *line = bfd->data; unsigned int ts_nr = bfd->priv_nr; @@ -365,7 +365,7 @@ static int activate_bchan(struct e1inp_line *line, int ts, int act) int ret; unsigned int idx = ts-1; struct e1inp_ts *e1i_ts = &line->ts[idx]; - struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd; + struct osmo_fd *bfd = &e1i_ts->driver.misdn.fd; fprintf(stdout, "activate bchan\n"); if (act) @@ -400,7 +400,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) for (ts = 1; ts < NUM_E1_TS; ts++) { unsigned int idx = ts-1; struct e1inp_ts *e1i_ts = &line->ts[idx]; - struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd; + struct osmo_fd *bfd = &e1i_ts->driver.misdn.fd; struct sockaddr_mISDN addr; bfd->data = line; @@ -470,7 +470,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) if (e1i_ts->type == E1INP_TS_TYPE_TRAU) activate_bchan(line, ts, 1); - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { fprintf(stderr, "could not register FD: %s\n", strerror(ret)); diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c index f4eee9ca5..a46f4b982 100644 --- a/openbsc/src/libbsc/bsc_msc.c +++ b/openbsc/src/libbsc/bsc_msc.c @@ -36,7 +36,7 @@ static void connection_loss(struct bsc_msc_connection *con) { - struct bsc_fd *fd; + struct osmo_fd *fd; fd = &con->write_queue.bfd; @@ -59,7 +59,7 @@ static void msc_con_timeout(void *_con) } /* 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; @@ -102,11 +102,11 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what) return 0; error: - bsc_unregister_fd(fd); + osmo_fd_unregister(fd); connection_loss(con); return -1; } -static void setnonblocking(struct bsc_fd *fd) +static void setnonblocking(struct osmo_fd *fd) { int flags; @@ -131,7 +131,7 @@ static void setnonblocking(struct bsc_fd *fd) int bsc_msc_connect(struct bsc_msc_connection *con) { struct bsc_msc_dest *dest; - struct bsc_fd *fd; + struct osmo_fd *fd; struct sockaddr_in sin; int on = 1, ret; @@ -197,7 +197,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con) con->connected(con); } - ret = bsc_register_fd(fd); + ret = osmo_fd_register(fd); if (ret < 0) { perror("Registering the fd failed"); close(fd->fd); @@ -229,7 +229,7 @@ void bsc_msc_lost(struct bsc_msc_connection *con) osmo_timer_del(&con->timeout_timer); if (con->write_queue.bfd.fd >= 0) - bsc_unregister_fd(&con->write_queue.bfd); + osmo_fd_unregister(&con->write_queue.bfd); connection_loss(con); } diff --git a/openbsc/src/libcommon/socket.c b/openbsc/src/libcommon/socket.c index dd25dd7d6..ff846aa6a 100644 --- a/openbsc/src/libcommon/socket.c +++ b/openbsc/src/libcommon/socket.c @@ -39,9 +39,9 @@ #include #include -int make_sock(struct bsc_fd *bfd, int proto, +int make_sock(struct osmo_fd *bfd, int proto, uint32_t ip, uint16_t port, int priv_nr, - int (*cb)(struct bsc_fd *fd, unsigned int what), void *data) + int (*cb)(struct osmo_fd *fd, unsigned int what), void *data) { struct sockaddr_in addr; int ret, on = 1; @@ -99,7 +99,7 @@ int make_sock(struct bsc_fd *bfd, int proto, } } - ret = bsc_register_fd(bfd); + ret = osmo_fd_register(bfd); if (ret < 0) { perror("register_listen_fd"); close(bfd->fd); diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c index 1c3c1b6cd..2e549f346 100644 --- a/openbsc/src/libgb/gprs_ns.c +++ b/openbsc/src/libgb/gprs_ns.c @@ -858,7 +858,7 @@ void gprs_ns_destroy(struct gprs_ns_inst *nsi) * We don't support Size Procedure, Configuration Procedure, ChangeWeight Procedure */ /* Read a single NS-over-IP message */ -static struct msgb *read_nsip_msg(struct bsc_fd *bfd, int *error, +static struct msgb *read_nsip_msg(struct osmo_fd *bfd, int *error, struct sockaddr_in *saddr) { struct msgb *msg = gprs_ns_msgb_alloc(); @@ -890,7 +890,7 @@ static struct msgb *read_nsip_msg(struct bsc_fd *bfd, int *error, return msg; } -static int handle_nsip_read(struct bsc_fd *bfd) +static int handle_nsip_read(struct osmo_fd *bfd) { int error; struct sockaddr_in saddr; @@ -907,7 +907,7 @@ static int handle_nsip_read(struct bsc_fd *bfd) return error; } -static int handle_nsip_write(struct bsc_fd *bfd) +static int handle_nsip_write(struct osmo_fd *bfd) { /* FIXME: actually send the data here instead of nsip_sendmsg() */ return -EIO; @@ -928,7 +928,7 @@ static int nsip_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg) } /* UDP Port 23000 carries the LLC-in-BSSGP-in-NS protocol stack */ -static int nsip_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int nsip_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; diff --git a/openbsc/src/libgb/gprs_ns_frgre.c b/openbsc/src/libgb/gprs_ns_frgre.c index 85019e1a4..366257239 100644 --- a/openbsc/src/libgb/gprs_ns_frgre.c +++ b/openbsc/src/libgb/gprs_ns_frgre.c @@ -49,7 +49,7 @@ struct gre_hdr { } __attribute__ ((packed)); /* IPv4 messages inside the GRE tunnel might be GRE keepalives */ -static int handle_rx_gre_ipv4(struct bsc_fd *bfd, struct msgb *msg, +static int handle_rx_gre_ipv4(struct osmo_fd *bfd, struct msgb *msg, struct iphdr *iph, struct gre_hdr *greh) { struct gprs_ns_inst *nsi = bfd->data; @@ -101,7 +101,7 @@ static int handle_rx_gre_ipv4(struct bsc_fd *bfd, struct msgb *msg, (struct sockaddr *)&daddr, sizeof(daddr)); } -static struct msgb *read_nsfrgre_msg(struct bsc_fd *bfd, int *error, +static struct msgb *read_nsfrgre_msg(struct osmo_fd *bfd, int *error, struct sockaddr_in *saddr) { struct msgb *msg = msgb_alloc(NS_ALLOC_SIZE, "Gb/NS/FR/GRE Rx"); @@ -203,7 +203,7 @@ out_err: int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg, struct sockaddr_in *saddr, enum gprs_ns_ll ll); -static int handle_nsfrgre_read(struct bsc_fd *bfd) +static int handle_nsfrgre_read(struct osmo_fd *bfd) { int rc; struct sockaddr_in saddr; @@ -230,7 +230,7 @@ out: return rc; } -static int handle_nsfrgre_write(struct bsc_fd *bfd) +static int handle_nsfrgre_write(struct osmo_fd *bfd) { /* FIXME: actually send the data here instead of nsip_sendmsg() */ return -EIO; @@ -268,7 +268,7 @@ int gprs_ns_frgre_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg) return rc; } -static int nsfrgre_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int nsfrgre_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c index 18d43a075..10f117bf0 100644 --- a/openbsc/src/libmgcp/mgcp_network.c +++ b/openbsc/src/libmgcp/mgcp_network.c @@ -255,7 +255,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; @@ -327,7 +327,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; @@ -381,7 +381,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; @@ -421,7 +421,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; @@ -429,7 +429,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; @@ -437,7 +437,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; @@ -489,14 +489,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; @@ -505,7 +505,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; @@ -517,7 +517,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) { @@ -564,13 +564,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/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c index f3841b045..5ef9922d2 100644 --- a/openbsc/src/libmsc/mncc_sock.c +++ b/openbsc/src/libmsc/mncc_sock.c @@ -39,8 +39,8 @@ struct mncc_sock_state { struct gsm_network *net; - struct bsc_fd listen_bfd; /* fd for listen socket */ - struct bsc_fd conn_bfd; /* fd for connection to lcr */ + struct osmo_fd listen_bfd; /* fd for listen socket */ + struct osmo_fd conn_bfd; /* fd for connection to lcr */ }; /* FIXME: avoid this */ @@ -85,17 +85,17 @@ void mncc_sock_write_pending(void) } /* FIXME: move this to libosmocore */ -int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path); +int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path); static void mncc_sock_close(struct mncc_sock_state *state) { - struct bsc_fd *bfd = &state->conn_bfd; + struct osmo_fd *bfd = &state->conn_bfd; LOGP(DMNCC, LOGL_NOTICE, "MNCC Socket has LOST connection\n"); close(bfd->fd); bfd->fd = -1; - bsc_unregister_fd(bfd); + osmo_fd_unregister(bfd); /* re-enable the generation of ACCEPT for new connections */ state->listen_bfd.when |= BSC_FD_READ; @@ -112,7 +112,7 @@ static void mncc_sock_close(struct mncc_sock_state *state) } } -static int mncc_sock_read(struct bsc_fd *bfd) +static int mncc_sock_read(struct osmo_fd *bfd) { struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data; struct gsm_mncc *mncc_prim; @@ -149,7 +149,7 @@ close: return -1; } -static int mncc_sock_write(struct bsc_fd *bfd) +static int mncc_sock_write(struct osmo_fd *bfd) { struct mncc_sock_state *state = bfd->data; struct gsm_network *net = state->net; @@ -189,7 +189,7 @@ close: return -1; } -static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags) +static int mncc_sock_cb(struct osmo_fd *bfd, unsigned int flags) { int rc = 0; @@ -205,10 +205,10 @@ static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags) } /* accept a new connection */ -static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags) +static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags) { struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data; - struct bsc_fd *conn_bfd = &state->conn_bfd; + struct osmo_fd *conn_bfd = &state->conn_bfd; struct sockaddr_un un_addr; socklen_t len; int rc; @@ -234,7 +234,7 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags) conn_bfd->cb = mncc_sock_cb; conn_bfd->data = state; - if (bsc_register_fd(conn_bfd) != 0) { + if (osmo_fd_register(conn_bfd) != 0) { LOGP(DMNCC, LOGL_ERROR, "Failed to register new connection fd\n"); close(conn_bfd->fd); conn_bfd->fd = -1; @@ -251,7 +251,7 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags) int mncc_sock_init(struct gsm_network *net) { struct mncc_sock_state *state; - struct bsc_fd *bfd; + struct osmo_fd *bfd; int rc; state = talloc_zero(tall_bsc_ctx, struct mncc_sock_state); @@ -275,7 +275,7 @@ int mncc_sock_init(struct gsm_network *net) bfd->cb = mncc_sock_accept; bfd->data = state; - rc = bsc_register_fd(bfd); + rc = osmo_fd_register(bfd); if (rc < 0) { LOGP(DMNCC, LOGL_ERROR, "Could not register listen fd: %d\n", rc); close(bfd->fd); @@ -289,7 +289,7 @@ int mncc_sock_init(struct gsm_network *net) } /* FIXME: move this to libosmocore */ -int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path) +int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path) { struct sockaddr_un local; unsigned int namelen; diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 04e224ccb..86d562418 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -482,7 +482,7 @@ static int rtp_socket_write(struct rtp_socket *rs, struct rtp_sub_socket *rss) /* callback for the select.c:bfd_* layer */ -static int rtp_bfd_cb(struct bsc_fd *bfd, unsigned int flags) +static int rtp_bfd_cb(struct osmo_fd *bfd, unsigned int flags) { struct rtp_socket *rs = bfd->data; struct rtp_sub_socket *rss; @@ -536,7 +536,7 @@ struct rtp_socket *rtp_socket_create(void) goto out_free; init_rss(&rs->rtp, rs, rc, RTP_PRIV_RTP); - rc = bsc_register_fd(&rs->rtp.bfd); + rc = osmo_fd_register(&rs->rtp.bfd); if (rc < 0) goto out_rtp_socket; @@ -545,7 +545,7 @@ struct rtp_socket *rtp_socket_create(void) goto out_rtp_bfd; init_rss(&rs->rtcp, rs, rc, RTP_PRIV_RTCP); - rc = bsc_register_fd(&rs->rtcp.bfd); + rc = osmo_fd_register(&rs->rtcp.bfd); if (rc < 0) goto out_rtcp_socket; @@ -558,11 +558,11 @@ struct rtp_socket *rtp_socket_create(void) return rs; out_rtcp_bfd: - bsc_unregister_fd(&rs->rtcp.bfd); + osmo_fd_unregister(&rs->rtcp.bfd); out_rtcp_socket: close(rs->rtcp.bfd.fd); out_rtp_bfd: - bsc_unregister_fd(&rs->rtp.bfd); + osmo_fd_unregister(&rs->rtp.bfd); out_rtp_socket: close(rs->rtp.bfd.fd); out_free: @@ -713,11 +713,11 @@ int rtp_socket_free(struct rtp_socket *rs) rs->proxy.other_sock) rs->proxy.other_sock->proxy.other_sock = NULL; - bsc_unregister_fd(&rs->rtp.bfd); + osmo_fd_unregister(&rs->rtp.bfd); close(rs->rtp.bfd.fd); free_tx_queue(&rs->rtp); - bsc_unregister_fd(&rs->rtcp.bfd); + osmo_fd_unregister(&rs->rtcp.bfd); close(rs->rtcp.bfd.fd); free_tx_queue(&rs->rtcp); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index 51e507761..6437d9305 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -256,7 +256,7 @@ int main(int argc, char **argv) } while (1) { - bsc_select_main(0); + osmo_select_main(0); } return 0; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index e1a95a89a..8b7c6e27b 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -44,7 +44,7 @@ static void send_ping(struct osmo_msc_data *data); /* * MGCP forwarding code */ -static int mgcp_do_read(struct bsc_fd *fd) +static int mgcp_do_read(struct osmo_fd *fd) { struct osmo_msc_data *data = (struct osmo_msc_data *) fd->data; struct msgb *mgcp; @@ -72,7 +72,7 @@ static int mgcp_do_read(struct bsc_fd *fd) return 0; } -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; @@ -150,7 +150,7 @@ static int mgcp_create_port(struct osmo_msc_data *data) data->mgcp_agent.read_cb = mgcp_do_read; data->mgcp_agent.write_cb = mgcp_do_write; - if (bsc_register_fd(&data->mgcp_agent.bfd) != 0) { + if (osmo_fd_register(&data->mgcp_agent.bfd) != 0) { LOGP(DMGCP, LOGL_FATAL, "Failed to register BFD\n"); close(data->mgcp_agent.bfd.fd); data->mgcp_agent.bfd.fd = -1; @@ -175,7 +175,7 @@ int msc_queue_write(struct bsc_msc_connection *conn, struct msgb *msg, int proto return 0; } -static int msc_alink_do_write(struct bsc_fd *fd, struct msgb *msg) +static int msc_alink_do_write(struct osmo_fd *fd, struct msgb *msg) { int ret; @@ -208,7 +208,7 @@ static void osmo_ext_handle(struct osmo_msc_data *msc, struct msgb *msg) send_lacs(msc->network, msc->msc_con); } -static int ipaccess_a_fd_cb(struct bsc_fd *bfd) +static int ipaccess_a_fd_cb(struct osmo_fd *bfd) { int error; struct msgb *msg = ipaccess_read_msg(bfd, &error); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_rf.c b/openbsc/src/osmo-bsc/osmo_bsc_rf.c index 8df03069f..5ce6bf522 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_rf.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_rf.c @@ -194,7 +194,7 @@ static void rf_delay_cmd_cb(void *data) } } -static int rf_read_cmd(struct bsc_fd *fd) +static int rf_read_cmd(struct osmo_fd *fd) { struct osmo_bsc_rf_conn *conn = fd->data; char buf[1]; @@ -203,7 +203,7 @@ static int rf_read_cmd(struct bsc_fd *fd) rc = read(fd->fd, buf, sizeof(buf)); if (rc != sizeof(buf)) { LOGP(DINP, LOGL_ERROR, "Short read %d/%s\n", errno, strerror(errno)); - bsc_unregister_fd(fd); + osmo_fd_unregister(fd); close(fd->fd); write_queue_clear(&conn->queue); talloc_free(conn); @@ -230,7 +230,7 @@ static int rf_read_cmd(struct bsc_fd *fd) return 0; } -static int rf_write_cmd(struct bsc_fd *fd, struct msgb *msg) +static int rf_write_cmd(struct osmo_fd *fd, struct msgb *msg) { int rc; @@ -243,7 +243,7 @@ static int rf_write_cmd(struct bsc_fd *fd, struct msgb *msg) return 0; } -static int rf_ctl_accept(struct bsc_fd *bfd, unsigned int what) +static int rf_ctl_accept(struct osmo_fd *bfd, unsigned int what) { struct osmo_bsc_rf_conn *conn; struct osmo_bsc_rf *rf = bfd->data; @@ -273,7 +273,7 @@ static int rf_ctl_accept(struct bsc_fd *bfd, unsigned int what) conn->queue.write_cb = rf_write_cmd; conn->rf = rf; - if (bsc_register_fd(&conn->queue.bfd) != 0) { + if (osmo_fd_register(&conn->queue.bfd) != 0) { close(fd); talloc_free(conn); return -1; @@ -286,7 +286,7 @@ struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net { unsigned int namelen; struct sockaddr_un local; - struct bsc_fd *bfd; + struct osmo_fd *bfd; struct osmo_bsc_rf *rf; int rc; @@ -341,7 +341,7 @@ struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net bfd->cb = rf_ctl_accept; bfd->data = rf; - if (bsc_register_fd(bfd) != 0) { + if (osmo_fd_register(bfd) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to register bfd.\n"); close(bfd->fd); talloc_free(rf); diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c index 207792950..8cb90c5c5 100644 --- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c +++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c @@ -135,7 +135,7 @@ static int mgcp_change_cb(struct mgcp_trunk_config *cfg, int endpoint, int state return 0; } -static int read_call_agent(struct bsc_fd *fd, unsigned int what) +static int read_call_agent(struct osmo_fd *fd, unsigned int what) { struct sockaddr_in addr; socklen_t slen = sizeof(addr); @@ -254,7 +254,7 @@ int main(int argc, char **argv) } - if (bsc_register_fd(&cfg->gw_fd.bfd) != 0) { + if (osmo_fd_register(&cfg->gw_fd.bfd) != 0) { LOGP(DMGCP, LOGL_FATAL, "Failed to register the fd\n"); return -1; } @@ -275,7 +275,7 @@ int main(int argc, char **argv) /* main loop */ while (1) { - bsc_select_main(0); + osmo_select_main(0); } diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c index 95a5388ff..be2666de3 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c @@ -598,7 +598,7 @@ struct msgb *bsc_mgcp_rewrite(char *input, int length, int endpoint, const char return output; } -static int mgcp_do_read(struct bsc_fd *fd) +static int mgcp_do_read(struct osmo_fd *fd) { struct bsc_nat *nat; struct msgb *msg, *resp; @@ -637,7 +637,7 @@ static int mgcp_do_read(struct bsc_fd *fd) return 0; } -static int mgcp_do_write(struct bsc_fd *bfd, struct msgb *msg) +static int mgcp_do_write(struct osmo_fd *bfd, struct msgb *msg) { int rc; @@ -704,7 +704,7 @@ int bsc_mgcp_nat_init(struct bsc_nat *nat) cfg->gw_fd.read_cb = mgcp_do_read; cfg->gw_fd.write_cb = mgcp_do_write; - if (bsc_register_fd(&cfg->gw_fd.bfd) != 0) { + if (osmo_fd_register(&cfg->gw_fd.bfd) != 0) { LOGP(DMGCP, LOGL_ERROR, "Failed to register MGCP fd.\n"); close(cfg->gw_fd.bfd.fd); cfg->gw_fd.bfd.fd = -1; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index ffcd3884c..0fb58436b 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -64,7 +64,7 @@ struct log_target *stderr_target; static const char *config_file = "bsc-nat.cfg"; static struct in_addr local_addr; -static struct bsc_fd bsc_listen; +static struct osmo_fd bsc_listen; static const char *msc_ip = NULL; static struct osmo_timer_list sccp_close; static int daemonize = 0; @@ -780,7 +780,7 @@ static void msc_send_reset(struct bsc_msc_connection *msc_con) LOGP(DMSC, LOGL_NOTICE, "Scheduled GSM0808 reset msg for the MSC.\n"); } -static int ipaccess_msc_read_cb(struct bsc_fd *bfd) +static int ipaccess_msc_read_cb(struct osmo_fd *bfd) { int error; struct bsc_msc_connection *msc_con; @@ -818,7 +818,7 @@ static int ipaccess_msc_read_cb(struct bsc_fd *bfd) return 0; } -static int ipaccess_msc_write_cb(struct bsc_fd *bfd, struct msgb *msg) +static int ipaccess_msc_write_cb(struct osmo_fd *bfd, struct msgb *msg) { int rc; rc = write(bfd->fd, msg->data, msg->len); @@ -875,7 +875,7 @@ void bsc_close_connection(struct bsc_connection *connection) /* close endpoints allocated by this BSC */ bsc_mgcp_clear_endpoints_for(connection); - bsc_unregister_fd(&connection->write_queue.bfd); + osmo_fd_unregister(&connection->write_queue.bfd); close(connection->write_queue.bfd.fd); write_queue_clear(&connection->write_queue); llist_del(&connection->list_entry); @@ -1147,7 +1147,7 @@ exit3: return -1; } -static int ipaccess_bsc_read_cb(struct bsc_fd *bfd) +static int ipaccess_bsc_read_cb(struct osmo_fd *bfd) { int error; struct bsc_connection *bsc = bfd->data; @@ -1194,7 +1194,7 @@ static int ipaccess_bsc_read_cb(struct bsc_fd *bfd) return 0; } -static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what) +static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what) { struct bsc_connection *bsc; int fd, rc, on; @@ -1256,7 +1256,7 @@ static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what) bsc->write_queue.read_cb = ipaccess_bsc_read_cb; bsc->write_queue.write_cb = bsc_write_cb; bsc->write_queue.bfd.when = BSC_FD_READ; - if (bsc_register_fd(&bsc->write_queue.bfd) < 0) { + if (osmo_fd_register(&bsc->write_queue.bfd) < 0) { LOGP(DNAT, LOGL_ERROR, "Failed to register BSC fd.\n"); close(fd); talloc_free(bsc); @@ -1514,7 +1514,7 @@ int main(int argc, char **argv) osmo_timer_schedule(&sccp_close, SCCP_CLOSE_TIME, 0); while (1) { - bsc_select_main(0); + osmo_select_main(0); } return 0; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 9ddc948cd..e796b2b89 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -787,7 +787,7 @@ int bsc_conn_type_to_ctr(struct sccp_connections *conn) return con_to_ctr[conn->con_type]; } -int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg) +int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg) { int rc; diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c index 5d599c734..910ef4073 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c +++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c @@ -58,7 +58,7 @@ static void bsc_nat_ussd_destroy(struct bsc_nat_ussd_con *con) } close(con->queue.bfd.fd); - bsc_unregister_fd(&con->queue.bfd); + osmo_fd_unregister(&con->queue.bfd); osmo_timer_del(&con->auth_timeout); write_queue_clear(&con->queue); talloc_free(con); @@ -95,7 +95,7 @@ static int forward_sccp(struct bsc_nat *nat, struct msgb *msg) return 0; } -static int ussd_read_cb(struct bsc_fd *bfd) +static int ussd_read_cb(struct osmo_fd *bfd) { int error; struct bsc_nat_ussd_con *conn = bfd->data; @@ -191,7 +191,7 @@ static void ussd_start_auth(struct bsc_nat_ussd_con *conn) bsc_do_write(&conn->queue, msg, IPAC_PROTO_IPACCESS); } -static int ussd_listen_cb(struct bsc_fd *bfd, unsigned int what) +static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what) { struct bsc_nat_ussd_con *conn; struct bsc_nat *nat; @@ -225,7 +225,7 @@ static int ussd_listen_cb(struct bsc_fd *bfd, unsigned int what) conn->queue.read_cb = ussd_read_cb; conn->queue.write_cb = bsc_write_cb; - if (bsc_register_fd(&conn->queue.bfd) < 0) { + if (osmo_fd_register(&conn->queue.bfd) < 0) { LOGP(DNAT, LOGL_ERROR, "Failed to register USSD fd.\n"); bsc_nat_ussd_destroy(conn); return -1; diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 8fec3688e..261c4264d 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -307,6 +307,6 @@ int main(int argc, char **argv) while (1) { log_reset_context(); - bsc_select_main(0); + osmo_select_main(0); } } diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c index 8e987de6d..9cb689712 100644 --- a/openbsc/src/utils/bs11_config.c +++ b/openbsc/src/utils/bs11_config.c @@ -903,7 +903,7 @@ int main(int argc, char **argv) status_timer.cb = status_timer_cb; while (1) { - bsc_select_main(0); + osmo_select_main(0); } abis_nm_bs11_factory_logon(g_bts, 0); diff --git a/openbsc/src/utils/rs232.c b/openbsc/src/utils/rs232.c index 43b0dc4fa..b322e8aba 100644 --- a/openbsc/src/utils/rs232.c +++ b/openbsc/src/utils/rs232.c @@ -36,7 +36,7 @@ /* adaption layer from GSM 08.59 + 12.21 to RS232 */ struct serial_handle { - struct bsc_fd fd; + struct osmo_fd fd; struct llist_head tx_queue; struct msgb *rx_msg; @@ -51,7 +51,7 @@ static struct serial_handle _ser_handle, *ser_handle = &_ser_handle; #define LAPD_HDR_LEN 10 -static int handle_ser_write(struct bsc_fd *bfd); +static int handle_ser_write(struct osmo_fd *bfd); /* callback from abis_nm */ int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml) @@ -88,7 +88,7 @@ int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml) } /* select.c callback in case we can write to the RS232 */ -static int handle_ser_write(struct bsc_fd *bfd) +static int handle_ser_write(struct osmo_fd *bfd) { struct serial_handle *sh = bfd->data; struct msgb *msg; @@ -119,7 +119,7 @@ static int handle_ser_write(struct bsc_fd *bfd) #define SERIAL_ALLOC_SIZE 300 /* select.c callback in case we can read from the RS232 */ -static int handle_ser_read(struct bsc_fd *bfd) +static int handle_ser_read(struct osmo_fd *bfd) { struct serial_handle *sh = bfd->data; struct msgb *msg; @@ -182,7 +182,7 @@ static int handle_ser_read(struct bsc_fd *bfd) } /* select.c callback */ -static int serial_fd_cb(struct bsc_fd *bfd, unsigned int what) +static int serial_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; @@ -237,7 +237,7 @@ int rs232_setup(const char *serial_port, unsigned int delay_ms, ser_handle->fd.data = ser_handle; ser_handle->delay_ms = delay_ms; ser_handle->bts = bts; - rc = bsc_register_fd(&ser_handle->fd); + rc = osmo_fd_register(&ser_handle->fd); if (rc < 0) { fprintf(stderr, "could not register FD: %s\n", strerror(rc)); diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 258938c89..e05af1e3e 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -68,7 +68,7 @@ int main(int argc, char **argv) subscr_get_channel(subscr, RSL_CHANNEED_TCH_F, subscr_cb, (void*)0x2342L); while (1) { - bsc_select_main(0); + osmo_select_main(0); } } -- cgit v1.2.3