2 p2pproxy Copyright (C) 2007 Jehan Monnier ()
4 p2pproxy.h - sip proxy.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef P2PPROXY_LAUNCHER_H_
21 #define P2PPROXY_LAUNCHER_H_
25 %module P2pProxylauncher
29 #define P2PPROXY_EWOULDBLOCK 4
30 #define P2PPROXY_ACCOUNTMGT_USER_EXIST 1
31 #define P2PPROXY_ACCOUNTMGT_USER_NOT_EXIST 0
32 #define P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND 3
34 #define P2PPROXY_CONNECTED 2
35 #define P2PPROXY_NOT_CONNECTED 1
37 #define P2PPROXY_NO_ERROR 0
39 #define P2PPROXY_ERROR -1
40 #define P2PPROXY_ERROR_APPLICATION_NOT_STARTED -2
41 #define P2PPROXY_ERROR_APPLICATION_ALREADY_STARTED -3
42 #define P2PPROXY_ERROR_ACCOUNTMGT_USER_ALREADY_EXIST -4
43 #define P2PPROXY_ERROR_ACCOUNTMGT_BAD_SIP_URI -5
44 #define P2PPROXY_ERROR_RESOURCEMGT_SERVER_NOT_FOUND -6
48 * start p2pproxy application
50 * @param argc number of argument
51 * @param argv arguments
55 int p2pproxy_application_start(int argc, char **argv);
59 * @return P2PPROXY_CONNECTED, P2PPROXY_NOT_ERROR
62 int p2pproxy_application_get_state(void);
65 * stop p2pproxy application
68 int p2pproxy_application_stop(void);
71 * return the status string corresponding to the status code
73 /*const char* p2pproxy_status_string(int status_code);*/
75 /************************/
76 /***account management***/
77 /************************/
80 * create an account with the given name (must be unique)
81 * @param user_name user sip uri (sip:joe@p2p.linphone.org)
83 * @return P2PPROXY_NO_ERROR, P2PPROXY_ERROR_APPLICATIONNOTSTARTED, P2PPROXY_ERROR_ACCOUNTMGT_USERALREADYEXIST, P2PPROXY_ERROR_ACCOUNTMGT_BADSIPURI
85 int p2pproxy_accountmgt_createAccount(const char* user_name);
87 * check if a user name has been already created
88 * @param user_name user sip uri (sip:joe@p2p.linphone.org)
89 * @return P2PPROXY_ACCOUNTMGT_USEREXIST, P2PPROXY_ACCOUNTMGT_USERNOTEXIST , P2PPROXY_ERROR_APPLICATIONNOTSTARTED
91 int p2pproxy_accountmgt_isValidAccount(const char* user_name);
94 * delete an account with the given name
95 * @param user_name user sip uri (sip:joe@p2p.linphone.org)
96 * @return P2PPROXY_NO_ERROR, P2PPROXY_ERROR_APPLICATIONNOTSTARTED
98 int p2pproxy_accountmgt_deleteAccount(const char* user_name);
100 /****************************/
101 /***resource management******/
102 /****************************/
104 * Structure to store resource list, must be instanciated by
105 * p2pproxy_resourcemgt_new_resource_list and deleted by p2pproxy_resourcemgt_delete_resource_list.
108 #define P2PPROXY_MAX_RESOURCE_LIST_SIZE 10
109 typedef struct p2pproxy_resourcemgt_resource_list {
110 char* resource_uri[P2PPROXY_MAX_RESOURCE_LIST_SIZE]; /* uri list*/
111 unsigned char size; /*number of element in the list*/
112 } p2pproxy_resourcemgt_resource_list_t;
115 * Instanciate a p2pproxy_resourcemgt_resource_list
117 p2pproxy_resourcemgt_resource_list_t* p2pproxy_resourcemgt_new_resource_list(void);
119 * delete a p2pproxy_resourcemgt_resource_list
121 void p2pproxy_resourcemgt_delete_resource_list(p2pproxy_resourcemgt_resource_list_t* resource_list);
124 * access a proxy registrar sip addreess for a given domaine name
125 * @param [out] proxy_uri buffer allocated by the user
126 * @param [in] size buffer size
127 * @param [in] domaine name
128 * @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND
130 int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, const char* domain) ;
132 * access a media ressource addresses for a given domaine name
133 * @param [out] p2pproxy_resourcemgt_resource_list_t allocated by the user (size = 0)
134 * @param [in] domaine name
135 * @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND
137 int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, const char* domain) ;
139 * notify the library at a given proxy is no longuer reachable
140 * @param [in] proxy sip uri
141 * @return status code P2PPROXY_NO_ERROR
143 int p2pproxy_resourcemgt_revoke_sip_proxy(const char* proxy_uri);
146 * notify the library at a given Media resoure is no longuer reachable
147 * @param [in] media resource uri (udp://hostname:port)
148 * @return status code P2PPROXY_NO_ERROR
150 int p2pproxy_resourcemgt_revoke_media_resource(const char* resource_uri);
154 #endif /*P2PPROXY_LAUNCHER_H_*/