aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-06-25 18:42:55 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2011-06-25 18:42:55 +0200
commitf163d23bf66b76037645f5a1bdc3333cc88f1ad1 (patch)
tree4bb82692a80077fd712038a470f498986acd2930 /tests
parent130c4fbe2e815d94bcf4b6d13849bebbfbf0198d (diff)
e1_input: minor API changes to adapt it to openbsc
While working on the openbsc over libosmo-abis port, I noticed several API changes that we need to perform for better adaptation.
Diffstat (limited to 'tests')
-rw-r--r--tests/e1inp_ipa_bsc_test.c17
-rw-r--r--tests/e1inp_ipa_bts_test.c16
2 files changed, 23 insertions, 10 deletions
diff --git a/tests/e1inp_ipa_bsc_test.c b/tests/e1inp_ipa_bsc_test.c
index 3dfbc54..64623b2 100644
--- a/tests/e1inp_ipa_bsc_test.c
+++ b/tests/e1inp_ipa_bsc_test.c
@@ -7,19 +7,22 @@
static void *tall_test;
-static int sign_link_up(struct msgb *msg, struct e1inp_line *line)
+static int sign_link_up(struct msgb *msg, struct e1inp_line *line,
+ enum e1inp_sign_type type)
{
printf("ID_RESP received, create sign link.\n");
return 0;
}
-static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
+static int sign_link(struct msgb *msg, struct e1inp_line *line,
+ struct e1inp_sign_link *link)
{
printf("OML/RSL data received\n");
return 0;
}
-static int error(struct msgb *msg, int error)
+static int error(struct msgb *msg, struct e1inp_line *line,
+ enum e1inp_sign_type type, int error)
{
printf("error, malformed message\n");
return 0;
@@ -52,6 +55,8 @@ int main(void)
osmo_init_logging(&bsc_test_log_info);
struct e1inp_line_ops ops = {
+ .addr = "0.0.0.0",
+ .role = E1INP_LINE_R_BSC,
.sign_link_up = sign_link_up,
.sign_link = sign_link,
.error = error,
@@ -59,12 +64,14 @@ int main(void)
#define LINENR 0
- line = e1inp_line_create(LINENR, "ipa", &ops);
+ line = e1inp_line_create(LINENR, "ipa");
if (line == NULL) {
LOGP(DBSCTEST, LOGL_ERROR, "problem creating E1 line\n");
exit(EXIT_FAILURE);
}
+ e1inp_line_bind_ops(line, &ops);
+
/*
* Depending if this is a real or virtual E1 lines:
* - real (ISDN): create signal link for OML and RSL before line up.
@@ -76,7 +83,7 @@ int main(void)
* it explains how this is done with ISDN.
*/
- if (e1inp_line_update(line, E1INP_LINE_R_BSC, "0.0.0.0") < 0) {
+ if (e1inp_line_update(line) < 0) {
LOGP(DBSCTEST, LOGL_ERROR, "problem creating E1 line\n");
exit(EXIT_FAILURE);
}
diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c
index 6f4ceaa..9c6bd4c 100644
--- a/tests/e1inp_ipa_bts_test.c
+++ b/tests/e1inp_ipa_bts_test.c
@@ -7,19 +7,22 @@
static void *tall_test;
-static int sign_link_up(struct msgb *msg, struct e1inp_line *line)
+static int sign_link_up(struct msgb *msg, struct e1inp_line *line,
+ enum e1inp_sign_type type)
{
printf("ID_RESP received, create sign link.\n");
return 0;
}
-static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
+static int sign_link(struct msgb *msg, struct e1inp_line *line,
+ struct e1inp_sign_link *link)
{
printf("OML/RSL data received\n");
return 0;
}
-static int error(struct msgb *msg, int error)
+static int error(struct msgb *msg, struct e1inp_line *line,
+ enum e1inp_sign_type type, int error)
{
printf("error, malformed message\n");
return 0;
@@ -52,6 +55,8 @@ int main(void)
osmo_init_logging(&bts_test_log_info);
struct e1inp_line_ops ops = {
+ .role = E1INP_LINE_R_BTS,
+ .addr = "127.0.0.1",
.sign_link_up = sign_link_up,
.sign_link = sign_link,
.error = error,
@@ -59,11 +64,12 @@ int main(void)
#define LINENR 0
- line = e1inp_line_create(LINENR, "ipa", &ops);
+ line = e1inp_line_create(LINENR, "ipa");
if (line == NULL) {
LOGP(DBTSTEST, LOGL_ERROR, "problem enabling E1 line\n");
exit(EXIT_FAILURE);
}
+ e1inp_line_bind_ops(line, &ops);
/*
* Depending if this is a real or virtual E1 lines:
@@ -76,7 +82,7 @@ int main(void)
* it explains how this is done with ISDN.
*/
- if (e1inp_line_update(line, E1INP_LINE_R_BTS, "127.0.0.1") < 0) {
+ if (e1inp_line_update(line) < 0) {
LOGP(DBTSTEST, LOGL_ERROR, "problem enabling E1 line\n");
exit(EXIT_FAILURE);
}