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/dahdi.c b/src/input/dahdi.c
index ba8ce02..8e5e635 100644
--- a/src/input/dahdi.c
+++ b/src/input/dahdi.c
@@ -121,8 +121,11 @@
DEBUGP(DMI, "<= len = %d, sapi(%d) tei(%d)", ret, sapi, tei);
idata = lapd_receive(e1i_ts->driver.dahdi.lapd, msg->data, msg->len, &ilen, &prim);
- if (!idata && prim == 0)
+ if (!idata && prim == 0) {
+ if (line->ops.error)
+ line->ops.error(NULL, -EBADMSG);
return -EIO;
+ }
msgb_pull(msg, 2);
@@ -149,7 +152,8 @@
ret = e1inp_rx_ts(e1i_ts, msg, tei, sapi);
break;
default:
- printf("ERROR: unknown prim\n");
+ if (line->ops.error)
+ line->ops.error(NULL, -EBADMSG);
break;
}