1 /*
2   eXosip - This is the eXtended osip library.
3   Copyright (C) 2001-2020 Aymeric MOIZARD amoizard@antisip.com
4 
5   eXosip is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9 
10   eXosip is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14 
15   You should have received a copy of the GNU General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 
19   In addition, as a special exception, the copyright holders give
20   permission to link the code of portions of this program with the
21   OpenSSL library under certain conditions as described in each
22   individual source file, and distribute linked combinations
23   including the two.
24   You must obey the GNU General Public License in all respects
25   for all of the code used other than OpenSSL.  If you modify
26   file(s) with this exception, you may extend this exception to your
27   version of the file(s), but you are not obligated to do so.  If you
28   do not wish to do so, delete this exception statement from your
29   version.  If you delete this exception statement from all source
30   files in the program, then also delete it here.
31 */
32 
33 #ifdef ENABLE_MPATROL
34 #include <mpatrol.h>
35 #endif
36 
37 #ifndef __EX_REGISTER_H__
38 #define __EX_REGISTER_H__
39 
40 #include <osipparser2/osip_parser.h>
41 #include <time.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @file eX_register.h
49  * @brief eXosip registration API
50  *
51  * This file provide the API needed to control registrations. You can use it to:
52  *
53  * <ul>
54  * <li>build initial REGISTER.</li>
55  * <li>build REGISTER.</li>
56  * <li>send REGISTER.</li>
57  * </ul>
58  */
59 
60 /**
61  * @defgroup eXosip2_registration eXosip2 REGISTER and Registration Management
62  * @ingroup eXosip2_msg
63  * @{
64  */
65 
66 struct eXosip_reg_t;
67 
68 /**
69  * Build initial REGISTER request.
70  *
71  * @param excontext eXosip_t instance.
72  * @param from      SIP url for caller.
73  * @param proxy     Proxy used for registration.
74  * @param contact   Contact address. (optional)
75  * @param expires   The expires value for registration.
76  * @param reg       The SIP request to build.
77  */
78 int eXosip_register_build_initial_register(struct eXosip_t *excontext, const char *from, const char *proxy, const char *contact, int expires, osip_message_t **reg);
79 
80 /**
81  * Build initial REGISTER request with qvalue for contact.
82  *
83  * @param excontext eXosip_t instance.
84  * @param from      SIP url for caller.
85  * @param proxy     Proxy used for registration.
86  * @param contact   Contact address. (optional)
87  * @param expires   The expires value for registration.
88  * @param qvalue    The qvalue value for contact header.
89  * @param reg       The SIP request to build.
90  */
91 int eXosip_register_build_initial_register_withqvalue(struct eXosip_t *excontext, const char *from, const char *proxy, const char *contact, int expires, const char *qvalue, osip_message_t **reg);
92 
93 /**
94  * Build a new REGISTER request for an existing registration.
95  *
96  * @param excontext eXosip_t instance.
97  * @param rid       A unique identifier for the registration context
98  * @param expires   The expires value for registration.
99  * @param reg       The SIP request to build.
100  */
101 int eXosip_register_build_register(struct eXosip_t *excontext, int rid, int expires, osip_message_t **reg);
102 
103 /**
104  * Send a REGISTER request for an existing registration.
105  *
106  * @param excontext eXosip_t instance.
107  * @param rid       A unique identifier for the registration context
108  * @param reg       The SIP request to build. (NULL for default REGISTER)
109  */
110 int eXosip_register_send_register(struct eXosip_t *excontext, int rid, osip_message_t *reg);
111 
112 /**
113  * Remove existing registration without sending REGISTER.
114  *
115  * @param excontext eXosip_t instance.
116  * @param rid       A unique identifier for the registration context
117  */
118 int eXosip_register_remove(struct eXosip_t *excontext, int rid);
119 
120 /** @} */
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 #endif
126