aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/sccp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-11-18 22:11:28 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-11-20 13:09:15 +0100
commit3b9516e0d86b2008ce2b3ccaff25cd804e6bc84c (patch)
tree5fd06eb92913aa8aafbfb556acd2bc510e4fe062 /openbsc/src/sccp
parentac96770ad7160323e2445859e128175d28f49295 (diff)
[sccp] Implement sending the Inactivity Test on a connection..
Currently this will send a dummy inactivity test message, there is currently no parsing or API to receive the messages. The sequencing and credit entries are empty as sequencing is currently not used at all. The test is currently limited to send the message and see if the application is crashing or not.
Diffstat (limited to 'openbsc/src/sccp')
-rw-r--r--openbsc/src/sccp/sccp.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c
index 8b111b2f5..522afcf7a 100644
--- a/openbsc/src/sccp/sccp.c
+++ b/openbsc/src/sccp/sccp.c
@@ -535,6 +535,31 @@ static int _sccp_send_connection_data(struct sccp_connection *conn, struct msgb
return ret;
}
+static int _sccp_send_connection_it(struct sccp_connection *conn)
+{
+ struct msgb *msgb;
+ struct sccp_data_it *it;
+ int ret;
+
+ msgb = msgb_alloc_headroom(SCCP_MSG_SIZE,
+ SCCP_MSG_HEADROOM, "sccp it");
+ msgb->l2h = &msgb->data[0];
+ it = (struct sccp_data_it *) msgb_put(msgb, sizeof(*it));
+ it->type = SCCP_MSG_TYPE_IT;
+ memcpy(&it->destination_local_reference, &conn->destination_local_reference,
+ sizeof(struct sccp_source_reference));
+ memcpy(&it->source_local_reference, &conn->source_local_reference,
+ sizeof(struct sccp_source_reference));
+
+ it->proto_class = 0x2;
+ it->sequencing[0] = it->sequencing[1] = 0;
+ it->credit = 0;
+
+ ret = _send_msg(msgb);
+ msgb_free(msgb);
+ return ret;
+}
+
static int _sccp_send_connection_released(struct sccp_connection *conn, int cause)
{
struct msgb *msg;
@@ -1025,6 +1050,23 @@ int sccp_connection_write(struct sccp_connection *connection, struct msgb *data)
return _sccp_send_connection_data(connection, data);
}
+/*
+ * Send a Inactivity Test message. The owner of the connection
+ * should start a timer and call this method regularily. Calling
+ * this every 60 seconds should be good enough.
+ */
+int sccp_connection_send_it(struct sccp_connection *connection)
+{
+ if (connection->connection_state < SCCP_CONNECTION_STATE_CONFIRM
+ || connection->connection_state > SCCP_CONNECTION_STATE_ESTABLISHED) {
+ DEBUGP(DSCCP, "sccp_connection_write: Wrong connection state: %p %d\n",
+ connection, connection->connection_state);
+ return -1;
+ }
+
+ return _sccp_send_connection_it(connection);
+}
+
/* send a connection release and wait for the connection released */
int sccp_connection_close(struct sccp_connection *connection, int cause)
{