]> sjero.net Git - linphone/blob - coreapi/sipsetup.h
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / coreapi / sipsetup.h
1 /*
2 linphone
3 Copyright (C) 2000  Simon MORLAT (simon.morlat@linphone.org)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program 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
20
21 #ifndef sipsetup_h
22 #define sipsetup_h
23
24 #include "mediastreamer2/mscommon.h"
25
26 struct _SipSetup;
27
28 struct _BuddyInfo;
29
30
31 struct _SipSetupContext{
32         struct _SipSetup *funcs;
33         struct _LinphoneProxyConfig *cfg;
34         char domain[128];
35         char username[128];
36         void *data;
37 };
38
39 typedef struct _SipSetupContext SipSetupContext;
40
41 #define SIP_SETUP_CAP_PROXY_PROVIDER    (1)
42 #define SIP_SETUP_CAP_STUN_PROVIDER     (1<<1)
43 #define SIP_SETUP_CAP_RELAY_PROVIDER    (1<<2)
44 #define SIP_SETUP_CAP_BUDDY_LOOKUP      (1<<3)
45 #define SIP_SETUP_CAP_ACCOUNT_MANAGER   (1<<4)  /*can create accounts*/
46 #define SIP_SETUP_CAP_LOGIN             (1<<5)  /*can login to any account for a given proxy */
47
48 typedef enum _BuddyLookupStatus{
49         BuddyLookupNone,
50         BuddyLookupConnecting,
51         BuddyLookupConnected,
52         BuddyLookupReceivingResponse,
53         BuddyLookupDone,
54         BuddyLookupFailure
55 }BuddyLookupStatus;
56
57 typedef struct _BuddyAddress{
58         char street[64];
59         char zip[64];
60         char town[64];
61         char country[64];
62 } BuddyAddress;
63
64 typedef struct _BuddyInfo{
65         char firstname[64];
66         char lastname[64];
67         char displayname[64];
68         char sip_uri[128];
69         char email[128];
70         BuddyAddress address;
71         char image_type[32];
72         uint8_t *image_data;
73         int image_length;
74 }BuddyInfo;
75
76 typedef struct _BuddyLookupRequest {
77         char *key;
78         int max_results;
79         BuddyLookupStatus status;
80         MSList *results; /*of BuddyInfo */
81 }BuddyLookupRequest;
82
83
84 typedef struct _BuddyLookupFuncs{
85         BuddyLookupRequest * (*request_create)(SipSetupContext *ctx);
86         int (*request_submit)(SipSetupContext *ctx, BuddyLookupRequest *req);
87         int (*request_free)(SipSetupContext *ctx, BuddyLookupRequest *req);
88 }BuddyLookupFuncs;
89
90
91 struct _SipSetup{
92         char *name;
93         unsigned int capabilities;
94         int initialized;
95         bool_t (*init)(void);
96         void (*exit)(void);
97         void (*init_instance)(SipSetupContext *ctx);
98         void (*uninit_instance)(SipSetupContext *ctx);
99         int (*account_exists)(SipSetupContext *ctx, const char *uri);
100         int (*create_account)(SipSetupContext *ctx, const char *uri, const char *passwd, const char *email, int suscribe);
101         int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
102         int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
103         int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
104         int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size);
105         const char * (*get_notice)(SipSetupContext *ctx);
106         const char ** (*get_domains)(SipSetupContext *ctx);
107         int (*logout_account)(SipSetupContext *ctx);
108         BuddyLookupFuncs *buddy_lookup_funcs;
109         int (*account_validated)(SipSetupContext *ctx, const char *uri);
110 };
111
112 typedef struct _SipSetup SipSetup;
113
114
115
116 #ifdef __cplusplus
117 extern "C"{
118 #endif
119
120 BuddyInfo *buddy_info_new();
121 void buddy_info_free(BuddyInfo *info);
122
123 void buddy_lookup_request_set_key(BuddyLookupRequest *req, const char *key);
124 void buddy_lookup_request_set_max_results(BuddyLookupRequest *req, int ncount);
125
126
127 void sip_setup_register(SipSetup *ss);
128 void sip_setup_register_all(void);
129 SipSetup *sip_setup_lookup(const char *type_name);
130 void sip_setup_unregister_all(void);
131 unsigned int sip_setup_get_capabilities(SipSetup *s);
132
133 SipSetupContext * sip_setup_context_new(SipSetup *s, struct _LinphoneProxyConfig *cfg);
134 int sip_setup_context_account_exists(SipSetupContext *ctx, const char *uri);
135 int sip_setup_context_account_validated(SipSetupContext *ctx, const char *uri);
136 int sip_setup_context_create_account(SipSetupContext *ctx, const char *uri, const char *passwd, const char *email, int suscribe);
137 int sip_setup_context_get_capabilities(SipSetupContext *ctx);
138 int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd);
139 int sip_setup_context_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
140 int sip_setup_context_get_stun_servers(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
141 int sip_setup_context_get_relay(SipSetupContext *ctx, char *relay, size_t size);
142
143 BuddyLookupRequest *sip_setup_context_create_buddy_lookup_request(SipSetupContext *ctx);
144 int sip_setup_context_buddy_lookup_submit(SipSetupContext *ctx , BuddyLookupRequest *req);
145 int sip_setup_context_buddy_lookup_free(SipSetupContext *ctx , BuddyLookupRequest *req);
146
147 const char * sip_setup_context_get_notice(SipSetupContext *ctx);
148 const char ** sip_setup_context_get_domains(SipSetupContext *ctx);
149
150 void sip_setup_context_free(SipSetupContext *ctx);
151
152 int sip_setup_context_logout(SipSetupContext *ctx);
153
154 /*internal methods for use WITHIN plugins: do not use elsewhere*/
155 struct _LinphoneProxyConfig *sip_setup_context_get_proxy_config(const SipSetupContext *ctx);
156 void buddy_lookup_request_free(BuddyLookupRequest *req);
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162
163 #endif
164
165