| 1 | /* |
|---|
| 2 | p2pproxy Copyright (C) 2007 Jehan Monnier () |
|---|
| 3 | |
|---|
| 4 | p2pproxy.h - sip proxy. |
|---|
| 5 | |
|---|
| 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. |
|---|
| 10 | |
|---|
| 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. |
|---|
| 15 | |
|---|
| 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. |
|---|
| 19 | */ |
|---|
| 20 | #ifndef P2PPROXY_LAUNCHER_H_ |
|---|
| 21 | #define P2PPROXY_LAUNCHER_H_ |
|---|
| 22 | |
|---|
| 23 | #include <stdio.h> |
|---|
| 24 | #ifdef SWIG |
|---|
| 25 | %module P2pProxylauncher |
|---|
| 26 | %javaconst(1); |
|---|
| 27 | %include "p2pproxy.h" |
|---|
| 28 | #endif /*SWIG*/ |
|---|
| 29 | |
|---|
| 30 | #define P2PPROXY_ACCOUNTMGT_USER_EXIST 1 |
|---|
| 31 | #define P2PPROXY_ACCOUNTMGT_USER_NOT_EXIST 0 |
|---|
| 32 | #define P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND 3 |
|---|
| 33 | /* state code*/ |
|---|
| 34 | #define P2PPROXY_CONNECTED 2 |
|---|
| 35 | #define P2PPROXY_NOT_CONNECTED 1 |
|---|
| 36 | /* status code*/ |
|---|
| 37 | #define P2PPROXY_NO_ERROR 0 |
|---|
| 38 | /*error codes*/ |
|---|
| 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 |
|---|
| 45 | |
|---|
| 46 | #ifndef SWIG |
|---|
| 47 | /** |
|---|
| 48 | * start p2pproxy application |
|---|
| 49 | * blocking call |
|---|
| 50 | * @param argc number of argument |
|---|
| 51 | * @param argv arguments |
|---|
| 52 | * @return status code |
|---|
| 53 | * |
|---|
| 54 | */ |
|---|
| 55 | int p2pproxy_application_start(int argc, char **argv); |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * return status |
|---|
| 59 | * @return P2PPROXY_CONNECTED, P2PPROXY_NOT_ERROR |
|---|
| 60 | * |
|---|
| 61 | */ |
|---|
| 62 | int p2pproxy_application_get_state(void); |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * stop p2pproxy application |
|---|
| 66 | * |
|---|
| 67 | */ |
|---|
| 68 | int p2pproxy_application_stop(void); |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | * return the status string corresponding to the status code |
|---|
| 72 | */ |
|---|
| 73 | /*const char* p2pproxy_status_string(int status_code);*/ |
|---|
| 74 | |
|---|
| 75 | /************************/ |
|---|
| 76 | /***account management***/ |
|---|
| 77 | /************************/ |
|---|
| 78 | |
|---|
| 79 | /** |
|---|
| 80 | * create an account with the given name (must be unique) |
|---|
| 81 | * @param user_name user sip uri (sip:joe@p2p.linphone.org) |
|---|
| 82 | * |
|---|
| 83 | * @return P2PPROXY_NO_ERROR, P2PPROXY_ERROR_APPLICATIONNOTSTARTED, P2PPROXY_ERROR_ACCOUNTMGT_USERALREADYEXIST, P2PPROXY_ERROR_ACCOUNTMGT_BADSIPURI |
|---|
| 84 | */ |
|---|
| 85 | int p2pproxy_accountmgt_createAccount(const char* user_name); |
|---|
| 86 | /** |
|---|
| 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 |
|---|
| 90 | */ |
|---|
| 91 | int p2pproxy_accountmgt_isValidAccount(const char* user_name); |
|---|
| 92 | |
|---|
| 93 | /** |
|---|
| 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 |
|---|
| 97 | */ |
|---|
| 98 | int p2pproxy_accountmgt_deleteAccount(const char* user_name); |
|---|
| 99 | |
|---|
| 100 | /****************************/ |
|---|
| 101 | /***resource management******/ |
|---|
| 102 | /****************************/ |
|---|
| 103 | /** |
|---|
| 104 | * Structure to store resource list, must be instanciated by |
|---|
| 105 | * p2pproxy_resourcemgt_new_resource_list and deleted by p2pproxy_resourcemgt_delete_resource_list. |
|---|
| 106 | * |
|---|
| 107 | */ |
|---|
| 108 | struct p2pproxy_resourcemgt_resource_list { |
|---|
| 109 | char[]* resource_uri; /* uri list*/ |
|---|
| 110 | unsigned char size; /*number of element in the list*/ |
|---|
| 111 | } p2pproxy_resourcemgt_resource_list_t; |
|---|
| 112 | |
|---|
| 113 | /** |
|---|
| 114 | * Instanciate a p2pproxy_resourcemgt_resource_list |
|---|
| 115 | */ |
|---|
| 116 | p2pproxy_resourcemgt_resource_list_t* p2pproxy_resourcemgt_new_resource_list(); |
|---|
| 117 | /** |
|---|
| 118 | * delete a p2pproxy_resourcemgt_resource_list |
|---|
| 119 | */ |
|---|
| 120 | void p2pproxy_resourcemgt_delete_resource_list(p2pproxy_resourcemgt_resource_list_t* resource_list); |
|---|
| 121 | |
|---|
| 122 | /** |
|---|
| 123 | * access a proxy registrar sip addreess for a given domaine name |
|---|
| 124 | * @param [out] proxy_uri buffer allocated by the user |
|---|
| 125 | * @param [in] size buffer size |
|---|
| 126 | * @param [in] domaine name |
|---|
| 127 | * @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND |
|---|
| 128 | */ |
|---|
| 129 | int p2pproxy_resourcemgt_lookup_sip_proxy(char* proxy_uri,size_t size, char* domaine) ; |
|---|
| 130 | /** |
|---|
| 131 | * access a media ressource addresses for a given domaine name |
|---|
| 132 | * @param [out] p2pproxy_resourcemgt_resource_list_t allocated by the user |
|---|
| 133 | * @param [in] domaine name |
|---|
| 134 | * @return status code P2PPROXY_NO_ERROR, P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND |
|---|
| 135 | */ |
|---|
| 136 | int p2pproxy_resourcemgt_lookup_media_resource(p2pproxy_resourcemgt_resource_list_t* resource_list, char* domaine) ; |
|---|
| 137 | /* |
|---|
| 138 | * notify the library at a given proxy is no longuer reachable |
|---|
| 139 | * @param [in] proxy sip uri |
|---|
| 140 | * @return status code P2PPROXY_NO_ERROR |
|---|
| 141 | */ |
|---|
| 142 | int p2pproxy_resourcemgt_revoke_sip_proxy(char* proxy_uri); |
|---|
| 143 | |
|---|
| 144 | /* |
|---|
| 145 | * notify the library at a given Media resoure is no longuer reachable |
|---|
| 146 | * @param [in] media resource uri (udp://hostname:port) |
|---|
| 147 | * @return status code P2PPROXY_NO_ERROR |
|---|
| 148 | */ |
|---|
| 149 | int p2pproxy_resourcemgt_revoke_media_resource(char* resource_uri); |
|---|
| 150 | |
|---|
| 151 | #endif /*SWIG*/ |
|---|
| 152 | |
|---|
| 153 | #endif /*P2PPROXY_LAUNCHER_H_*/ |
|---|