e1input: rework generic (virtual and real) E1 line operations
struct e1inp_line_ops {
int (*sign_link_up)(struct msgb *msg, struct e1inp_line *line);
int (*sign_link)(struct msgb *msg, struct e1inp_sign_link *link);
int (*error)(struct msgb *msg, int error);
};
The description of the operations is the following:
* sign_link_up is invoked if the signalling link becomes up. In A-bis
over IP, we have to wait until the other peer identifies itself as
a BTS/BSC device, then this function is invoked. This function is not
used by ISDN drivers, the signalling link can be set up just after
the line is created.
* sign_link is called if we receive OML/RSL message. This function
is used both by ISDN and A-bis over IP drivers.
* error is called if we receive a malformed message. It is used both
by ISDN and A-bis over IP drivers.
diff --git a/src/input/misdn.c b/src/input/misdn.c
index c97169a..afa9032 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -115,7 +115,8 @@
}
if (alen != sizeof(l2addr)) {
- fprintf(stderr, "%s error len\n", __func__);
+ if (line->ops.error)
+ line->ops.error(NULL, -EBADMSG);
return -EINVAL;
}
@@ -178,6 +179,8 @@
l2addr.channel, l2addr.sapi, l2addr.tei);
break;
default:
+ if (line->ops.error)
+ line->ops.error(NULL, -EBADMSG);
break;
}
return ret;