sipsetup.h 3.77 KB
Newer Older
smorlat's avatar
smorlat committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
linphone
Copyright (C) 2000  Simon MORLAT (simon.morlat@linphone.org)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


#ifndef sipsetup_h
#define sipsetup_h
smorlat's avatar
smorlat committed
23 24

#include "mediastreamer2/mscommon.h"
smorlat's avatar
smorlat committed
25 26 27

struct _SipSetup;

smorlat's avatar
smorlat committed
28 29
struct _BuddyInfo;

smorlat's avatar
smorlat committed
30

smorlat's avatar
smorlat committed
31 32
struct _SipSetupContext{
	struct _SipSetup *funcs;
smorlat's avatar
smorlat committed
33
	struct _LinphoneProxyConfig *cfg;
smorlat's avatar
smorlat committed
34 35
	char domain[128];
	char username[128];
smorlat's avatar
smorlat committed
36 37 38 39 40
	void *data;
};

typedef struct _SipSetupContext SipSetupContext;

smorlat's avatar
smorlat committed
41 42 43 44 45 46
#define SIP_SETUP_CAP_PROXY_PROVIDER	(1)
#define SIP_SETUP_CAP_STUN_PROVIDER	(1<<1)
#define SIP_SETUP_CAP_RELAY_PROVIDER	(1<<2)
#define SIP_SETUP_CAP_BUDDY_LOOKUP	(1<<3)
#define SIP_SETUP_CAP_ACCOUNT_MANAGER	(1<<4)

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
typedef enum _BuddyLookupStatus{
	BuddyLookupNone,
	BuddyLookupConnecting,
	BuddyLookupConnected,
	BuddyLookupReceivingResponse,
	BuddyLookupDone,
	BuddyLookupFailure
}BuddyLookupStatus;

typedef struct _BuddyAddress{
	char street[64];
	char zip[64];
	char town[64];
	char country[64];
} BuddyAddress;

typedef struct _BuddyInfo{
	char firstname[64];
	char lastname[64];
	char displayname[64];
	char sip_uri[128];
	BuddyAddress address;
}BuddyInfo;

smorlat's avatar
smorlat committed
71

smorlat's avatar
smorlat committed
72 73
struct _SipSetup{
	char *name;
smorlat's avatar
smorlat committed
74
	unsigned int capabilities;
smorlat's avatar
smorlat committed
75
	bool_t (*init)(void);
smorlat's avatar
smorlat committed
76
	int (*init_instance)(SipSetupContext *ctx);
smorlat's avatar
smorlat committed
77 78 79 80 81
	int (*create_account)( const char *uri, const char *passwd);
	int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
	int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
	int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
	int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size);
smorlat's avatar
smorlat committed
82
	int (*lookup_buddy)(SipSetupContext *ctx, const char *key);
83
	BuddyLookupStatus (*get_buddy_lookup_status)(SipSetupContext *ctx);
smorlat's avatar
smorlat committed
84
	int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results);
smorlat's avatar
smorlat committed
85 86 87 88 89 90
	void (*exit)(void);
	bool_t initialized;
};

typedef struct _SipSetup SipSetup;

smorlat's avatar
smorlat committed
91

92 93 94
#ifdef __cplusplus
extern "C"{
#endif
smorlat's avatar
smorlat committed
95

smorlat's avatar
smorlat committed
96
void sip_setup_register(SipSetup *ss);
smorlat's avatar
smorlat committed
97
void sip_setup_register_all(void);
smorlat's avatar
smorlat committed
98
SipSetup *sip_setup_lookup(const char *type_name);
smorlat's avatar
smorlat committed
99
void sip_setup_unregister_all(void);
smorlat's avatar
smorlat committed
100 101

int sip_setup_new_account(SipSetup *s, const char *uri, const char *passwd);
smorlat's avatar
smorlat committed
102
SipSetupContext * sip_setup_context_new(SipSetup *s, struct _LinphoneProxyConfig *cfg);
smorlat's avatar
smorlat committed
103
int sip_setup_context_get_capabilities(SipSetupContext *ctx);
smorlat's avatar
smorlat committed
104 105 106
int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd);
int sip_setup_context_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
int sip_setup_context_get_stun_servers(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
smorlat's avatar
smorlat committed
107 108 109 110
int sip_setup_context_get_relay(SipSetupContext *ctx, char *relay, size_t size);
int sip_setup_context_lookup_buddy(SipSetupContext *ctx, const char *key);
BuddyLookupStatus sip_setup_context_get_buddy_lookup_status(SipSetupContext *ctx);
int sip_setup_context_get_buddy_lookup_results(SipSetupContext *ctx, MSList **results /*of BuddyInfo */);
111
void sip_setup_context_free_results(MSList *results);
smorlat's avatar
smorlat committed
112
void sip_setup_context_free(SipSetupContext *ctx);
113

smorlat's avatar
smorlat committed
114 115 116 117
/*internal methods*/
struct _LinphoneProxyConfig *sip_setup_context_get_proxy_config(const SipSetupContext *ctx);


118 119 120 121
#ifdef __cplusplus
}
#endif

smorlat's avatar
smorlat committed
122

smorlat's avatar
smorlat committed
123 124
#endif

smorlat's avatar
smorlat committed
125