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.
diff --git a/src/input/dahdi.c b/src/input/dahdi.c
index bf73f97..20c2a09 100644
--- a/src/input/dahdi.c
+++ b/src/input/dahdi.c
@@ -122,8 +122,8 @@
 
 	idata = lapd_receive(e1i_ts->driver.dahdi.lapd, msg->data, msg->len, &ilen, &prim);
 	if (!idata && prim == 0) {
-		if (line->ops.error)
-			line->ops.error(NULL, -EBADMSG);
+		if (line->ops->error)
+			line->ops->error(NULL, -EBADMSG);
 		return -EIO;
 	}
 
@@ -152,8 +152,8 @@
 		ret = e1inp_rx_ts(e1i_ts, msg, tei, sapi);
 		break;
 	default:
-		if (line->ops.error)
-			line->ops.error(NULL, -EBADMSG);
+		if (line->ops->error)
+			line->ops->error(NULL, -EBADMSG);
 		break;
 	}
 
diff --git a/src/input/hsl.c b/src/input/hsl.c
index 0b6b078..a9a9a78 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -86,8 +86,8 @@
 
 	error = ipa_msg_recv(bfd->fd, &msg);
 	if (error <= 0) {
-		if (e1i_ts->line->ops.error)
-			e1i_ts->line->ops.error(NULL, error);
+		if (e1i_ts->line->ops->error)
+			e1i_ts->line->ops->error(NULL, line, ts_nr, error);
 		if (error == 0) {
 			osmo_fd_unregister(bfd);
 			close(bfd->fd);
@@ -106,17 +106,18 @@
 
 	/* HSL proprietary RSL extension */
 	if (hh->proto == 0 && (msg->l2h[0] == 0x81 || msg->l2h[0] == 0x80)) {
-		if (!line->ops.sign_link_up) {
+		if (!line->ops->sign_link_up) {
 			LOGP(DINP, LOGL_ERROR, "Fix your application, no "
 				"action set if the signalling link "
 				"becomes ready.\n");
 			return -EINVAL;
 		}
-		ret = line->ops.sign_link_up(msg, line);
+		ret = line->ops->sign_link_up(msg, line, E1INP_SIGN_RSL);
 		if (ret < 0) {
 			/* FIXME: close connection */
-			if (line->ops.error)
-				line->ops.error(msg, -EBADMSG);
+			if (line->ops->error)
+				line->ops->error(msg, line,
+						E1INP_SIGN_RSL, -EBADMSG);
 			return ret;
 		} else if (ret == 1)
 			return 0;
@@ -138,12 +139,12 @@
 	msg->dst = link;
 
 	/* XXX: better use e1inp_ts_rx? */
-	if (!e1i_ts->line->ops.sign_link) {
+	if (!e1i_ts->line->ops->sign_link) {
 		LOGP(DINP, LOGL_ERROR, "Fix your application, "
 			"no action set for signalling messages.\n");
 		return -ENOENT;
 	}
-	e1i_ts->line->ops.sign_link(msg, link);
+	e1i_ts->line->ops->sign_link(msg, line, link);
 
 	return ret;
 }
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 8ce10ab..20d275b 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -45,9 +45,6 @@
 #include <osmocom/abis/logging.h>
 #include <osmocom/abis/ipa.h>
 
-#define PRIV_OML 1
-#define PRIV_RSL 2
-
 static void *tall_ipa_ctx;
 
 #define TS1_ALLOC_SIZE	900
@@ -140,13 +137,13 @@
 	switch (msg_type) {
 	case IPAC_MSGT_ID_RESP:
 		DEBUGP(DMI, "ID_RESP\n");
-		if (!line->ops.sign_link_up) {
+		if (!line->ops->sign_link_up) {
 			LOGP(DINP, LOGL_ERROR, "Fix your application, "
 				"no action set if the signalling link "
 				"becomes ready\n");
 			return -EINVAL;
 		}
-		line->ops.sign_link_up(msg, line);
+		line->ops->sign_link_up(msg, line, bfd->priv_nr);
 		break;
 	}
 	return 0;
@@ -165,8 +162,8 @@
 	error = ipa_msg_recv(bfd->fd, &msg);
 	if (error <= 0) {
 		/* skip if RSL line is not set yet. */
-		if (e1i_ts && e1i_ts->line->ops.error)
-			e1i_ts->line->ops.error(NULL, error);
+		if (e1i_ts && e1i_ts->line->ops->error)
+			e1i_ts->line->ops->error(NULL, line, ts_nr, error);
 		if (error == 0) {
 		        osmo_fd_unregister(bfd);
 		        close(bfd->fd);
@@ -199,12 +196,12 @@
 	msg->dst = link;
 
 	/* XXX better use e1inp_ts_rx? */
-	if (!e1i_ts->line->ops.sign_link) {
+	if (!e1i_ts->line->ops->sign_link) {
 		LOGP(DINP, LOGL_ERROR, "Fix your application, "
 			"no action set for signalling messages.\n");
 		return -ENOENT;
 	}
-	e1i_ts->line->ops.sign_link(msg, link);
+	e1i_ts->line->ops->sign_link(msg, line, link);
 
 	return ret;
 }
@@ -353,7 +350,7 @@
 
 	bfd->fd = fd;
 	bfd->data = line;
-	bfd->priv_nr = PRIV_OML;
+	bfd->priv_nr = E1INP_SIGN_OML;
 	bfd->cb = ipaccess_fd_cb;
 	bfd->when = BSC_FD_READ;
 	ret = osmo_fd_register(bfd);
@@ -380,7 +377,7 @@
 		return -ENOMEM;
 
 	bfd->fd = fd;
-	bfd->priv_nr = PRIV_RSL;
+	bfd->priv_nr = E1INP_SIGN_RSL;
 	bfd->cb = ipaccess_fd_cb;
 	bfd->when = BSC_FD_READ;
 	ret = osmo_fd_register(bfd);
@@ -412,13 +409,15 @@
 		/* this is a request for identification from the BSC. */
 		if (msg_type == IPAC_MSGT_ID_GET) {
 			LOGP(DINP, LOGL_NOTICE, "received ID get\n");
-			if (!link->line->ops.sign_link_up) {
+			if (!link->line->ops->sign_link_up) {
 				LOGP(DINP, LOGL_ERROR, "Fix your application, "
 					"no action set if the signalling link "
 					"becomes ready\n");
 				return -EINVAL;
 			}
-			link->line->ops.sign_link_up(msg, link->line);
+			link->line->ops->sign_link_up(msg, link->line,
+				     link->port == IPA_TCP_PORT_OML ?
+					E1INP_SIGN_OML : E1INP_SIGN_RSL);
 		}
 		return 0;
 	} else if (link->port == IPA_TCP_PORT_OML)
@@ -437,12 +436,12 @@
 	msg->dst = sign_link;
 
 	/* XXX better use e1inp_ts_rx? */
-	if (!link->line->ops.sign_link) {
+	if (!link->line->ops->sign_link) {
 		LOGP(DINP, LOGL_ERROR, "Fix your application, "
 			"no action set for signalling messages.\n");
 		return -ENOENT;
 	}
-	link->line->ops.sign_link(msg, sign_link);
+	link->line->ops->sign_link(msg, link->line, sign_link);
 	return 0;
 }
 
diff --git a/src/input/misdn.c b/src/input/misdn.c
index 3ccfc4d..cf8b5d9 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -109,8 +109,8 @@
 	}
 
 	if (alen != sizeof(l2addr)) {
-		if (line->ops.error)
-			line->ops.error(NULL, -EBADMSG);
+		if (line->ops->error)
+			line->ops->error(NULL, line, ts_nr, -EBADMSG);
 		return -EINVAL;
 	}
 
@@ -173,8 +173,8 @@
 		l2addr.channel, l2addr.sapi, l2addr.tei);
 		break;
 	default:
-		if (line->ops.error)
-			line->ops.error(NULL, -EBADMSG);
+		if (line->ops->error)
+			line->ops->error(NULL, line, ts_nr, -EBADMSG);
 		break;
 	}
 	return ret;