aboutsummaryrefslogtreecommitdiffstats
path: root/tests/e1inp_ipa_bsc_test.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-06-30 12:19:42 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2011-06-30 12:19:42 +0200
commitc9c4fd39055ab02c0af59d5519e62edc456e3d0b (patch)
treeb4ddf50a9b715a7a0270077e21790e8ec5efaf59 /tests/e1inp_ipa_bsc_test.c
parent59301856f6cf7e9c36b1494aa98b6b984b4b52d1 (diff)
major updates in e1_input callback ops and IPA infrastructures
This patch is a major update of the callback infrastructure, now the e1input_ops looks like the following: struct e1inp_sign_link * (*sign_link_up)(void *unit_info, struct e1inp_line *line, enum e1inp_sign_type type); void (*sign_link_down)(struct e1inp_line *line); int (*sign_link)(struct msgb *msg, struct e1inp_sign_link *link); The sign_link_up and sign_link_down will be used by the A-bis over IP input drivers. The sign_link_up callback is used if we receive a ID_RESP message, in that case, we have to set up the sign link for the corresponding new OML/RSL signal link. The pointer to unit_info provides a data structure that contains the BTS device details if we run as BSC, and the requested device information from the BSC if we run as BTS. The sign_link_up callback must return the new sign_link created. The sign_link_down callback is invoked if the line does down, which means that the counterpart has closed the socket. The sign_link callback is used to handle all RSL/OML messages. I have also added the following callback to the e1inp_driver: + void (*close)(struct e1inp_ts *ts); Which is invoked if you call e1inp_sign_link_destroy(). This callback is used to close the socket that is linked to that timeslot. This is useful for A-bis over IP drivers since sockets are closed if the OML/RSL signalling link is destroyed. As you can notice, I have also added all the ID_RESP parsing into libosmo-abis for both ipaccess and hsl drivers. This patch also contains a rework of the ipa_client_link whose integration with the e1_input infrastructure was broken (the transmission path was broken). This patch also contains more develop examples that act as BSC and BTS for the ipaccess driver. Sorry, I know it would be better to split all these changes into logical pieces but many of them are tightly related. This is under heavy development stage, it's anyway hard to track changes until this becomes more stable.
Diffstat (limited to 'tests/e1inp_ipa_bsc_test.c')
-rw-r--r--tests/e1inp_ipa_bsc_test.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/tests/e1inp_ipa_bsc_test.c b/tests/e1inp_ipa_bsc_test.c
index 64623b2..bac9926 100644
--- a/tests/e1inp_ipa_bsc_test.c
+++ b/tests/e1inp_ipa_bsc_test.c
@@ -6,25 +6,42 @@
#include <osmocom/core/logging.h>
static void *tall_test;
+static struct e1inp_sign_link *oml_sign_link, *rsl_sign_link;
-static int sign_link_up(struct msgb *msg, struct e1inp_line *line,
- enum e1inp_sign_type type)
+static struct e1inp_sign_link *
+sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
{
- printf("ID_RESP received, create sign link.\n");
- return 0;
+ struct e1inp_sign_link *sign_link = NULL;
+
+ switch(type) {
+ case E1INP_SIGN_OML:
+ e1inp_ts_config_sign(&line->ts[E1INP_SIGN_OML - 1], line);
+ sign_link = oml_sign_link =
+ e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML - 1],
+ E1INP_SIGN_OML, NULL, 255, 0);
+ break;
+ case E1INP_SIGN_RSL:
+ e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL - 1], line);
+ sign_link = rsl_sign_link =
+ e1inp_sign_link_create(&line->ts[E1INP_SIGN_RSL - 1],
+ E1INP_SIGN_OML, NULL, 0, 0);
+ break;
+ default:
+ break;
+ }
+ return sign_link;
}
-static int sign_link(struct msgb *msg, struct e1inp_line *line,
- struct e1inp_sign_link *link)
+static void sign_link_down(struct e1inp_line *line)
{
- printf("OML/RSL data received\n");
- return 0;
+ printf("link got down.\n");
+ e1inp_sign_link_destroy(oml_sign_link);
+ e1inp_sign_link_destroy(rsl_sign_link);
}
-static int error(struct msgb *msg, struct e1inp_line *line,
- enum e1inp_sign_type type, int error)
+static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
{
- printf("error, malformed message\n");
+ printf("OML/RSL data received\n");
return 0;
}
@@ -58,8 +75,8 @@ int main(void)
.addr = "0.0.0.0",
.role = E1INP_LINE_R_BSC,
.sign_link_up = sign_link_up,
+ .sign_link_down = sign_link_down,
.sign_link = sign_link,
- .error = error,
};
#define LINENR 0