diff options
author | Harald Welte <laforge@osmocom.org> | 2019-11-19 01:24:44 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2019-11-19 01:28:05 +0100 |
commit | 58de416ff0c645c6431d1dc6f5ff907cc7ef4fa7 (patch) | |
tree | 4fbd22525222b16e2e986aa0986f82f3bcd8cf74 | |
parent | 8e2fddc93e6213fa876a7afa5588b99f7dd917ad (diff) |
osmo_ss7: Add osmo_ss7_asp_find()
This is like osmo_ss7_asp_find_and_create(), i.e. it's doing a full
match for an ASP within the specified SS7 instance, of the specified
port numbers. It just doesn't create it if it is missing.
Change-Id: I1ed3cf2b69ee622d6f9d8b50487f392fe913ae90
Related: OS#4271
-rw-r--r-- | include/osmocom/sigtran/osmo_ss7.h | 4 | ||||
-rw-r--r-- | src/osmo_ss7.c | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 6778409..de9494b 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -436,6 +436,10 @@ struct osmo_ss7_asp *osmo_ss7_asp_find_by_proto(struct osmo_ss7_as *as, enum osmo_ss7_asp_protocol proto); struct osmo_ss7_asp * +osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name, + uint16_t remote_port, uint16_t local_port, + enum osmo_ss7_asp_protocol proto); +struct osmo_ss7_asp * osmo_ss7_asp_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto); diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index d74f8f9..a07fbed 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1226,6 +1226,24 @@ struct osmo_ss7_asp } struct osmo_ss7_asp * +osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name, + uint16_t remote_port, uint16_t local_port, + enum osmo_ss7_asp_protocol proto) +{ + struct osmo_ss7_asp *asp; + + OSMO_ASSERT(ss7_initialized); + asp = osmo_ss7_asp_find_by_name(inst, name); + if (!asp) + return NULL; + + if ((asp->cfg.remote.port != remote_port || asp->cfg.local.port != local_port || asp->cfg.proto != proto)) + return NULL; + + return asp; +} + +struct osmo_ss7_asp * osmo_ss7_asp_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto) |