summaryrefslogtreecommitdiffstats
path: root/include/osmocom/abis/e1_input.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso2011-07-07 17:47:26 +0200
committerPablo Neira Ayuso2011-07-07 19:33:24 +0200
commit3832c4f908e6d9d821b18bbccab017b2d3d6c79c (patch)
tree0fb3bc3956cde0c85db98671146cb503c86a138b /include/osmocom/abis/e1_input.h
parentipaccess: close connection if we receive bad messages from BTS (diff)
downloadlibosmo-abis-3832c4f908e6d9d821b18bbccab017b2d3d6c79c.tar.gz
libosmo-abis-3832c4f908e6d9d821b18bbccab017b2d3d6c79c.tar.xz
libosmo-abis-3832c4f908e6d9d821b18bbccab017b2d3d6c79c.zip
e1_input: add new refcounting scheme to avoid leaking E1 lines
This patch 's/e1inp_line_get/e1inp_line_find/g' since we need this function name for the new refcounting scheme. Basically, I have added a new function to clone lines that is used by the ipaccess driver: struct e1inp_line *e1inp_line_clone(void *ctx, struct e1inp_line *line); And two functions to bump and decrement the refcount: void e1inp_line_get(struct e1inp_line *line); void e1inp_line_put(struct e1inp_line *line); This is useful to avoid leaking virtual E1 lines in the ipaccess case, since we have two sockets for OML and RSL respectively, we have to release the line *once* both sockets have been closed. Without this patch, there are cases in which we don't know if it's time to release the virtual E1 line. This patch also includes a fix to avoid crashing if we open a connection with OML/RSL port without sending any ID_RESP message (in that case, we have no chance to set the signal link). I tested these situations with netcat.
Diffstat (limited to 'include/osmocom/abis/e1_input.h')
-rw-r--r--include/osmocom/abis/e1_input.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 51c9273..b317ed9 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -166,11 +166,20 @@ struct e1inp_driver *e1inp_driver_find(const char *name);
int e1inp_line_register(struct e1inp_line *line);
/* get a line by its ID */
-struct e1inp_line *e1inp_line_get(uint8_t e1_nr);
+struct e1inp_line *e1inp_line_find(uint8_t e1_nr);
/* create a line in the E1 input core */
struct e1inp_line *e1inp_line_create(uint8_t e1_nr, const char *driver_name);
+/* clone one existing E1 input line */
+struct e1inp_line *e1inp_line_clone(void *ctx, struct e1inp_line *line);
+
+/* increment refcount use of E1 input line */
+void e1inp_line_get(struct e1inp_line *line);
+
+/* decrement refcount use of E1 input line, release if unused */
+void e1inp_line_put(struct e1inp_line *line);
+
/* bind operations to one E1 input line */
void e1inp_line_bind_ops(struct e1inp_line *line, const struct e1inp_line_ops *ops);