[partial] port to new libosmocore-0.3 APIs

This commit is contained in:
Harald Welte 2011-05-22 20:26:58 +02:00
parent 430f35194d
commit 8a183fb423
11 changed files with 47 additions and 50 deletions

View File

@ -1,8 +1,8 @@
#ifndef _ABIS_H
#define _ABIS_H
#include <osmocore/select.h>
#include <osmocore/timer.h>
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
#define IPA_TCP_PORT_OML 3002
#define IPA_TCP_PORT_RSL 3003
@ -47,8 +47,8 @@ struct ipabis_link {
int state;
struct osmocom_bts *bts; /* set, if OML link */
struct osmobts_trx *trx; /* set, if RSL link */
struct bsc_fd bfd;
struct timer_list timer;
struct osmo_fd bfd;
struct osmo_timer_list timer;
struct msgb *rx_msg;
struct llist_head tx_queue;
int ping, pong, id_resp;

View File

@ -62,7 +62,7 @@
struct osmobts_sysinfo {
uint8_t flags[BTS_SI_NUM];
uint8_t si[BTS_SI_NUM][23];
struct timer_list timer;
struct osmo_timer_list timer;
};
struct osmobts_slot;
@ -71,7 +71,6 @@ struct osmobts_slot;
struct osmobts_ms {
struct llist_head entry;
struct osmobts_trx *trx;
struct osmocom_ms ms;
};
/* one logical channel instance */
@ -79,7 +78,7 @@ struct osmobts_lchan {
struct osmobts_slot *slot;
uint8_t lchan_nr;
uint8_t chan_nr; /* CBITS+TN */
struct osmol2_entity l2_entity;
struct lapdm_channel lapdm_channel;
struct osmobts_rtp rtp;
};

View File

@ -2,7 +2,7 @@
#define _LOGGING_H
#define DEBUG
#include <osmocore/logging.h>
#include <osmocom/core/logging.h>
enum {
DRSL,

View File

@ -11,7 +11,7 @@ struct osmobts_lchan *lchan;
struct osmobts_udp {
struct osmobts_rtp *rtp;
struct bsc_fd bfd;
struct osmo_fd bfd;
struct sockaddr_in sin_local, sin_remote;
struct llist_head tx_queue;
};

View File

@ -285,7 +285,7 @@ static void abis_timeout(void *arg)
case LINK_STATE_RETRYING:
ret = abis_open(link, link->ip);
if (ret <= 0)
bsc_schedule_timer(&link->timer, OML_RETRY_TIMER, 0);
osmo_timer_schedule(&link->timer, OML_RETRY_TIMER, 0);
break;
case LINK_STATE_CONNECT:
if (link->ping && !link->pong) {
@ -294,7 +294,7 @@ static void abis_timeout(void *arg)
abis_close(link);
ret = abis_open(link, link->ip);
if (ret <= 0) {
bsc_schedule_timer(&link->timer,
osmo_timer_schedule(&link->timer,
OML_RETRY_TIMER, 0);
link->state = LINK_STATE_RETRYING;
}
@ -304,12 +304,12 @@ static void abis_timeout(void *arg)
link->pong = 0;
LOGP(DABIS, LOGL_INFO, "PING\n");
abis_tx_ipa_pingpong(link, IPA_MSGT_PING);
bsc_schedule_timer(&link->timer, OML_PING_TIMER, 0);
osmo_timer_schedule(&link->timer, OML_PING_TIMER, 0);
break;
}
}
static int abis_sock_cb(struct bsc_fd *bfd, unsigned int what)
static int abis_sock_cb(struct osmo_fd *bfd, unsigned int what)
{
struct ipabis_link *link = bfd->data;
struct ipabis_head *hh;
@ -318,11 +318,11 @@ static int abis_sock_cb(struct bsc_fd *bfd, unsigned int what)
if ((what & BSC_FD_WRITE) && link->state == LINK_STATE_CONNECTING) {
if (link->bts) {
if (bsc_timer_pending(&link->timer))
bsc_del_timer(&link->timer);
// bsc_schedule_timer(&link->timer, OML_PING_TIMER, 0);
if (osmo_timer_pending(&link->timer))
osmo_timer_del(&link->timer);
// osmo_timer_schedule(&link->timer, OML_PING_TIMER, 0);
#warning HACK
bsc_schedule_timer(&link->timer, 3, 0);
osmo_timer_schedule(&link->timer, 3, 0);
link->ping = link->pong = 0;
}
LOGP(DABIS, LOGL_INFO, "Abis socket now connected.\n");
@ -394,7 +394,7 @@ close:
LOGP(DABIS, LOGL_INFO, "Connection to BSC failed, retrying in %d "
"seconds.\n", OML_RETRY_TIMER);
bsc_schedule_timer(&link->timer, OML_RETRY_TIMER, 0);
osmo_timer_schedule(&link->timer, OML_RETRY_TIMER, 0);
link->state = LINK_STATE_RETRYING;
return 0;
@ -445,7 +445,7 @@ int abis_open(struct ipabis_link *link, uint32_t ip)
link->timer.cb = abis_timeout;
link->timer.data = link;
bsc_register_fd(&link->bfd);
osmo_fd_register(&link->bfd);
LOGP(DABIS, LOGL_INFO, "Abis socket trying to reach BSC.\n");
@ -476,13 +476,13 @@ void abis_close(struct ipabis_link *link)
while ((msg = msgb_dequeue(&link->tx_queue)))
msgb_free(msg);
bsc_unregister_fd(&link->bfd);
osmo_fd_unregister(&link->bfd);
close(link->bfd.fd);
link->bfd.fd = -1; /* -1 or 0 indicates: 'close' */
link->state = LINK_STATE_IDLE;
if (bsc_timer_pending(&link->timer))
bsc_del_timer(&link->timer);
if (osmo_timer_pending(&link->timer))
osmo_timer_del(&link->timer);
}

View File

@ -24,11 +24,11 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <osmocore/select.h>
#include <osmocore/timer.h>
#include <osmocore/msgb.h>
#include <osmocore/talloc.h>
#include <osmocore/protocol/gsm_12_21.h>
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
#include <osmo-bts/logging.h>
//#include <osmocom/bb/common/osmocom_data.h>
//#include <osmocom/bb/common/l1l2_interface.h>
@ -259,8 +259,8 @@ void destroy_bts(struct osmocom_bts *bts)
struct osmobts_ms, entry);
destroy_ms(ms);
}
if (bsc_timer_pending(&bts->trx[i]->si.timer))
bsc_del_timer(&bts->trx[i]->si.timer);
if (osmo_timer_pending(&bts->trx[i]->si.timer))
osmo_timer_del(&bts->trx[i]->si.timer);
talloc_free(bts->trx[i]);
bts->trx[i] = NULL;
}
@ -332,7 +332,7 @@ void bts_new_si(void *arg)
struct osmobts_trx *trx = arg;
int i;
if (bsc_timer_pending(&trx->si.timer))
if (osmo_timer_pending(&trx->si.timer))
return;
i = 0;
@ -353,7 +353,7 @@ void bts_new_si(void *arg)
/* delay until next SI */
trx->si.timer.cb = bts_new_si;
trx->si.timer.data = trx;
bsc_schedule_timer(&trx->si.timer, 0, 200000);
osmo_timer_schedule(&trx->si.timer, 0, 200000);
}
/* handle bts instance (including MS instances) */

View File

@ -27,7 +27,7 @@
#include <sys/types.h>
#include <arpa/inet.h>
#include <osmocore/protocol/gsm_12_21.h>
#include <osmocom/core/protocol/gsm_12_21.h>
#include <osmo-bts/logging.h>
//#include <osmocom/bb/common/osmocom_data.h>
#include <osmo-bts/support.h>

View File

@ -31,7 +31,7 @@
#include <time.h>
#include <string.h>
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <osmo-bts/logging.h>
//#include <osmocom/bb/common/osmocom_data.h>

View File

@ -20,7 +20,7 @@
#include <sys/types.h>
#include <string.h>
#include <osmocore/protocol/gsm_12_21.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
//#include <osmocom/bb/common/osmocom_data.h>
#include <osmo-bts/support.h>

View File

@ -31,16 +31,15 @@
#include <l1ctl_proto.h>
#include <osmocore/signal.h>
#include <osmocore/logging.h>
#include <osmocore/timer.h>
#include <osmocore/msgb.h>
#include <osmocore/tlv.h>
#include <osmocore/gsm_utils.h>
#include <osmocore/gsmtap_util.h>
#include <osmocore/protocol/gsm_04_08.h>
#include <osmocore/protocol/gsm_08_58.h>
#include <osmocore/rsl.h>
#include <osmocom/core/signal.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/gsmtap_util.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/rsl.h>
#include <osmocom/bb/common/l1ctl.h>
#include <osmocom/bb/common/osmocom_data.h>

View File

@ -19,11 +19,10 @@
*/
#include <netinet/in.h>
#include <osmocore/talloc.h>
#include <osmocore/signal.h>
#include <osmocore/timer.h>
#include <osmocore/select.h>
#include <osmocore/signal.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/signal.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/select.h>
#include <osmo-bts/logging.h>
//#include <osmocom/bb/common/osmocom_data.h>
#include <osmo-bts/support.h>
@ -206,7 +205,7 @@ int main(int argc, char **argv)
while (!quit) {
work_bts(bts);
bsc_select_main(0);
osmo_select_main(0);
}
fail: