diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-16 16:51:31 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-15 20:24:20 +0800 |
commit | fa20c944569e4eaf79370672ff571cb5330ff1b2 (patch) | |
tree | 9e0bc748f014429058fa998b290d544114f9d675 /openbsc/src/nat/bsc_sccp.c | |
parent | e1fb5670cda5ba099c24a6656058b98771fa2f3b (diff) |
[nat] Make create_sccp_src_ref return the SCCP Connection.
Right now it was not possible to just find a connection, by returning
the connection that is created we will have direct access to it. It
will be used by the local connection handling.
Diffstat (limited to 'openbsc/src/nat/bsc_sccp.c')
-rw-r--r-- | openbsc/src/nat/bsc_sccp.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c index 47cd9ce72..94b332a8e 100644 --- a/openbsc/src/nat/bsc_sccp.c +++ b/openbsc/src/nat/bsc_sccp.c @@ -82,7 +82,8 @@ static int assign_src_local_reference(struct sccp_source_reference *ref, struct return -1; } -int create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed) +struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc, + struct bsc_nat_parsed *parsed) { struct sccp_connections *conn; @@ -101,11 +102,11 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parse bsc_mgcp_dlcx(conn); llist_del(&conn->list_entry); talloc_free(conn); - return -1; + return NULL; } else { clock_gettime(CLOCK_MONOTONIC, &conn->creation_time); bsc_mgcp_dlcx(conn); - return 0; + return conn; } } @@ -113,7 +114,7 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parse conn = talloc_zero(bsc->nat, struct sccp_connections); if (!conn) { LOGP(DNAT, LOGL_ERROR, "Memory allocation failure.\n"); - return -1; + return NULL; } conn->bsc = bsc; @@ -122,7 +123,7 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parse if (assign_src_local_reference(&conn->patched_ref, bsc->nat) != 0) { LOGP(DNAT, LOGL_ERROR, "Failed to assign a ref.\n"); talloc_free(conn); - return -1; + return NULL; } bsc_mgcp_init(conn); @@ -134,7 +135,7 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parse sccp_src_ref_to_int(&conn->real_ref), sccp_src_ref_to_int(&conn->patched_ref), bsc); - return 0; + return conn; } int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *parsed) |