diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2015-11-10 22:07:04 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2015-11-16 15:16:36 +0100 |
commit | c227594394ddd00e11b8e57cfd16182338cef131 (patch) | |
tree | ff722434292655148823d181ccff2b59e2f73be1 /openbsc/include/openbsc/gtphub.h | |
parent | 5b664f4b9b95f3f8be3741794fceb309a345bb00 (diff) |
gtphub: make test code reusable for future tests.
Generalize to make the PDP ctx message definitions and "sending" of messages
from SGSN->gtphub->GGSN and back reusable in future tests.
Publish gsn_addr_from_sockaddr() in gtphub.h for use in gtphub_test.c.
Use an osmo_sockaddr for resolved_ggsn_addr, because one is needed for
comparison in probably every future test.
Add LVL2_ASSERT() to print assertion message and return instead of abort,
so that functions can be called from several tests without losing the
info of which test caused it from which line.
Use globals for struct gtphub and time_t now, to reduce nr of args that need to
be passed around when writing tests. Add a default test setup function.
Sponsored-by: On-Waves ehi
Diffstat (limited to 'openbsc/include/openbsc/gtphub.h')
-rw-r--r-- | openbsc/include/openbsc/gtphub.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gtphub.h b/openbsc/include/openbsc/gtphub.h index 514b1a375..79f138b0a 100644 --- a/openbsc/include/openbsc/gtphub.h +++ b/openbsc/include/openbsc/gtphub.h @@ -155,6 +155,10 @@ const char *gsn_addr_to_strb(const struct gsn_addr *gsna, /* Return 1 on match, zero otherwise. */ int gsn_addr_same(const struct gsn_addr *a, const struct gsn_addr *b); +/* Decode sa to gsna. Return 0 on success. If port is non-NULL, the port number + * from sa is also returned. */ +int gsn_addr_from_sockaddr(struct gsn_addr *gsna, uint16_t *port, + const struct osmo_sockaddr *sa); /* expiry */ |