From 31baf6937aee6f449a6675e102d6f0831bfb1fbe Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 3 Apr 2016 17:35:05 +0200 Subject: test: added test-case for authenticated register --- test/sip/sipsrv.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 test/sip/sipsrv.h (limited to 'test/sip/sipsrv.h') diff --git a/test/sip/sipsrv.h b/test/sip/sipsrv.h new file mode 100644 index 0000000..4690ffe --- /dev/null +++ b/test/sip/sipsrv.h @@ -0,0 +1,121 @@ +/** + * @file mock/sipsrv.h Mock SIP server -- interface + * + * Copyright (C) 2010 - 2016 Creytiv.com + */ + + +struct auth; + + +/* + * SIP Server + */ + +struct sip_server { + struct sip *sip; + struct sip_lsnr *lsnr; + bool auth_enabled; + bool terminate; + + unsigned n_register_req; + enum sip_transp tp_last; + + uint64_t secret; + struct hash *ht_dom; + struct hash *ht_aor; +}; + +int sip_server_alloc(struct sip_server **srvp); +int sip_server_uri(struct sip_server *srv, char *uri, size_t sz, + enum sip_transp tp); + + +/* + * AoR + */ + +struct aor { + struct le he; + struct list locl; + char *uri; +}; + +int aor_create(struct sip_server *srv, struct aor **aorp, + const struct uri *uri); +int aor_find(struct sip_server *srv, struct aor **aorp, + const struct uri *uri); + + +/* + * Auth + */ + +struct auth { + const struct sip_server *srv; + char realm[256]; + bool stale; +}; + +int auth_print(struct re_printf *pf, const struct auth *auth); +int auth_chk_nonce(struct sip_server *srv, + const struct pl *nonce, uint32_t expires); +int auth_set_realm(struct auth *auth, const char *realm); + + +/* + * Domain + */ + +struct domain { + struct le he; + struct hash *ht_usr; + char *name; +}; + + +int domain_add(struct sip_server *srv, const char *name); +int domain_find(struct sip_server *srv, const struct uri *uri); +int domain_auth(struct sip_server *srv, + const struct uri *uri, bool user_match, + const struct sip_msg *msg, enum sip_hdrid hdrid, + struct auth *auth); +struct domain *domain_lookup(struct sip_server *srv, const char *name); + + +/* + * Location + */ + +struct location { + struct le le; + struct sa src; + struct uri duri; + char *uri; + char *callid; + struct loctmp *tmp; + uint64_t expires; + uint32_t cseq; + double q; + bool rm; +}; + +int location_update(struct list *locl, const struct sip_msg *msg, + const struct sip_addr *contact, uint32_t expires); +void location_commit(struct list *locl); +void location_rollback(struct list *locl); + + +/* + * User + */ + +struct user { + struct le he; + uint8_t ha1[MD5_SIZE]; + char *name; +}; + +int user_add(struct hash *ht, const char *username, const char *password, + const char *realm); +struct user *user_find(struct hash *ht, const struct pl *name); -- cgit v1.2.3 From c9f404dd73c4f936aa763e81a4d0f908004b7d2e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 3 Apr 2016 18:13:04 +0200 Subject: auth test: add all transports --- test/sip/sipsrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/sip/sipsrv.h') diff --git a/test/sip/sipsrv.h b/test/sip/sipsrv.h index 4690ffe..aa136e0 100644 --- a/test/sip/sipsrv.h +++ b/test/sip/sipsrv.h @@ -1,5 +1,5 @@ /** - * @file mock/sipsrv.h Mock SIP server -- interface + * @file sip/sipsrv.h Mock SIP server -- interface * * Copyright (C) 2010 - 2016 Creytiv.com */ -- cgit v1.2.3