lapd: Always print context information when logging

Historically, OpenBSC has primarily been used with setups that have
a single E1 based BTS connected. This meant that an error message on
the E1 LAPD implicitly has to be related to that single BTS.

However, in more comprehensive setups, there may be many BTSs on many
E1 lines with many signaling slots.  At this point, it's important to
know which line/timeslot/tei/sapi a given log message relates to.

This patch introduces related log context.

Change-Id: Ib81a749ae24013b17caaf5fd64ccd9acbbc3ce08
Requires: libosmocore.git Change-Id Ie6742843fff809edffcac24c4dce4edf66bc71be
Related: OS#1938
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index a38bab8..8230e44 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -285,6 +285,9 @@
 			 void (*hdlc_recv_cb)(struct e1inp_ts *ts,
 					      struct msgb *msg));
 
+/* obtain a string identifier/name for the given timeslot */
+void e1inp_ts_name(char *out, size_t out_len, const struct e1inp_ts *ts);
+
 /* Receive a packet from the E1 driver */
 int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
 		uint8_t tei, uint8_t sapi);
diff --git a/include/osmocom/abis/lapd.h b/include/osmocom/abis/lapd.h
index d618187..1e9ffe7 100644
--- a/include/osmocom/abis/lapd.h
+++ b/include/osmocom/abis/lapd.h
@@ -38,6 +38,7 @@
 
 	struct llist_head tei_list;	/* list of TEI in this LAPD instance */
 	int pcap_fd;			/* PCAP file descriptor */
+	char *name;			/* human-readable name */
 };
 
 enum lapd_recv_errors {
@@ -63,7 +64,14 @@
 	void (*tx_cb)(struct msgb *msg, void *cbdata), void *tx_cbdata,
 	void (*rx_cb)(struct osmo_dlsap_prim *odp, uint8_t tei, uint8_t sapi, 
 			void *rx_cbdata), void *rx_cbdata,
-	const struct lapd_profile *profile);
+	const struct lapd_profile *profile)
+OSMO_DEPRECATED("Use lapd_instance_alloc2() instead");
+
+struct lapd_instance *lapd_instance_alloc2(int network_side,
+	void (*tx_cb)(struct msgb *msg, void *cbdata), void *tx_cbdata,
+	void (*rx_cb)(struct osmo_dlsap_prim *odp, uint8_t tei, uint8_t sapi,
+			void *rx_cbdata), void *rx_cbdata,
+	const struct lapd_profile *profile, const char *name);
 
 /* In rare cases (e.g. Ericsson's lapd dialect), it may be necessary to
  * exchange the lapd profile on the fly. lapd_instance_set_profile()