diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-29 04:31:51 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-29 04:36:48 +0100 |
commit | caf49b4c141f2b623da77bd7984a37e1b62fc75f (patch) | |
tree | 7b4f6afb69ec74784b2ca1099abf15168f1c759b /openbsc/src | |
parent | ef84539fb7dc68712bd0c530cfedb29c3374df5e (diff) |
[sccp] Implement sccp_parse_header to be used by the NAT code.
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/sccp/sccp.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c index e435ecf23..81bd254f5 100644 --- a/openbsc/src/sccp/sccp.c +++ b/openbsc/src/sccp/sccp.c @@ -1275,6 +1275,41 @@ int sccp_determine_msg_type(struct msgb *msg) return msg->l2h[0]; } +int sccp_parse_header(struct msgb *msg, struct sccp_parse_result *result) +{ + int type; + + if (msgb_l2len(msg) < 1) + return -1; + + type = msg->l2h[0]; + switch(type) { + case SCCP_MSG_TYPE_CR: + return _sccp_parse_connection_request(msg, result); + break; + case SCCP_MSG_TYPE_RLSD: + return _sccp_parse_connection_released(msg, result); + break; + case SCCP_MSG_TYPE_CREF: + return _sccp_parse_connection_refused(msg, result); + break; + case SCCP_MSG_TYPE_CC: + return _sccp_parse_connection_confirm(msg, result); + break; + case SCCP_MSG_TYPE_RLC: + return _sccp_parse_connection_release_complete(msg, result); + break; + case SCCP_MSG_TYPE_DT1: + return _sccp_parse_connection_dt1(msg, result); + break; + case SCCP_MSG_TYPE_UDT: + return _sccp_parse_udt(msg, result); + break; + }; + + return -1; +} + static __attribute__((constructor)) void on_dso_load(void) { tall_sccp_ctx = talloc_named_const(NULL, 1, "sccp"); |