From 42581829ec2a79ef82c813b8212da76f514aa4f4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 8 Aug 2009 16:12:58 +0200 Subject: the actual config file code (not just config files) this was missing from commit a08a9acdb6bff0ee4fdf0f58b78b6525017a1f9f --- openbsc/src/input/ipaccess.c | 4 ++-- openbsc/src/input/misdn.c | 40 ++++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'openbsc/src/input') diff --git a/openbsc/src/input/ipaccess.c b/openbsc/src/input/ipaccess.c index cee53cc13..05786dab4 100644 --- a/openbsc/src/input/ipaccess.c +++ b/openbsc/src/input/ipaccess.c @@ -461,7 +461,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) /* Request ID. FIXME: request LOCATION, HW/SW VErsion, Unit Name, Serno */ ret = write(bfd->fd, id_req, sizeof(id_req)); - return e1inp_line_register(line); + //return e1inp_line_register(line); } static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) @@ -574,7 +574,7 @@ int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa) line->driver = &ipaccess_driver; - return e1inp_line_register(line); + //return e1inp_line_register(line); } int ipaccess_setup(struct gsm_network *gsmnet) diff --git a/openbsc/src/input/misdn.c b/openbsc/src/input/misdn.c index 2ec74b8ea..bd655d12e 100644 --- a/openbsc/src/input/misdn.c +++ b/openbsc/src/input/misdn.c @@ -49,12 +49,6 @@ #include #include -/* data structure for one E1 interface with A-bis */ -struct mi_e1_handle { - /* The mISDN card number of the card we use */ - int cardnr; -}; - #define TS1_ALLOC_SIZE 300 struct prim_name { @@ -383,7 +377,6 @@ struct e1inp_driver misdn_driver = { static int mi_e1_setup(struct e1inp_line *line, int release_l2) { - struct mi_e1_handle *e1h = line->driver_data; int ts, ret; /* TS0 is CRC4, don't need any fd for it */ @@ -422,7 +415,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) memset(&addr, 0, sizeof(addr)); addr.family = AF_ISDN; - addr.dev = e1h->cardnr; + addr.dev = line->num; switch (e1i_ts->type) { case E1INP_TS_TYPE_SIGN: addr.channel = 0; @@ -471,20 +464,23 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) return 0; } -int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) +int mi_e1_line_update(struct e1inp_line *line) { - struct mi_e1_handle *e1h; - int sk, ret, cnt; struct mISDN_devinfo devinfo; + int sk, ret, cnt; - /* create the actual line instance */ - e1h = talloc(tall_bsc_ctx, struct mi_e1_handle); - memset(e1h, 0, sizeof(*e1h)); - - e1h->cardnr = cardnr; + if (!line->driver) { + /* this must be the first update */ + line->driver = &misdn_driver; + } else { + /* this is a subsequent update */ + /* FIXME: first close all sockets */ + fprintf(stderr, "incremental line updates not supported yet\n"); + return 0; + } - line->driver = &misdn_driver; - line->driver_data = e1h; + if (line->driver != &misdn_driver) + return -EINVAL; /* open the ISDN card device */ sk = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE); @@ -504,11 +500,11 @@ int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) //DEBUGP(DMI,"%d device%s found\n", cnt, (cnt==1)?"":"s"); printf("%d device%s found\n", cnt, (cnt==1)?"":"s"); #if 1 - devinfo.id = e1h->cardnr; + devinfo.id = line->num; ret = ioctl(sk, IMGETDEVINFO, &devinfo); if (ret < 0) { fprintf(stdout, "error getting info for device %d: %s\n", - e1h->cardnr, strerror(errno)); + line->num, strerror(errno)); return -ENODEV; } fprintf(stdout, " id: %d\n", devinfo.id); @@ -524,11 +520,11 @@ int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) return -EINVAL; } - ret = mi_e1_setup(line, release_l2); + ret = mi_e1_setup(line, 1); if (ret) return ret; - return e1inp_line_register(line); + return 0; } static __attribute__((constructor)) void on_dso_load_sms(void) -- cgit v1.2.3