source: mediastreamer2/p2pproxy/launcher/src/launcher-tester.c @ 125:e643134d0f9c

Last change on this file since 125:e643134d0f9c was 125:e643134d0f9c, checked in by smorlat <smorlat@…>, 5 years ago
  • autoconf build system,
  • cleanups in C code

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@128 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

File size: 1.6 KB
Line 
1#include "p2pproxy.h"
2#include <pthread.h>
3#include <unistd.h>
4
5static void * thread_starter(void *args){
6        char* largs[] = {"-seeding-server","-sip", "5058"};
7        p2pproxy_application_start(3,largs);
8        printf("exit from application \n");
9        return NULL;
10}
11
12
13int main(int argc, char **argv) {
14        pthread_t th;
15        printf("starting p2pproxy tester \n");
16        pthread_create(&th,NULL,thread_starter,NULL);
17        sleep(3);
18       
19        if (p2pproxy_application_get_state() == P2PPROXY_CONNECTED) {
20                printf("CONNECTED \n");
21        } else {
22                printf("NOT CONNECTED \n");
23        };
24
25
26        if (p2pproxy_accountmgt_createAccount("sip:titi@p2p.linphone.org") != P2PPROXY_NO_ERROR) {
27                printf("cannot create account \n");     
28        }
29       
30       
31        if (p2pproxy_accountmgt_isValidAccount("sip:titi@p2p.linphone.org") != P2PPROXY_ACCOUNTMGT_USER_EXIST) {
32                printf("user not created \n"); 
33        }
34       
35        char string_buffer[256];
36        if (p2pproxy_resourcemgt_lookup_sip_proxy(string_buffer,256,"p2p.linphone.org") != P2PPROXY_NO_ERROR) {
37                printf("cannot get proxy\n");   
38        } else {
39                printf("registrar is [%s]\n",string_buffer);
40        }
41       
42        if (p2pproxy_resourcemgt_revoke_sip_proxy(string_buffer) != P2PPROXY_NO_ERROR) {
43                printf("cannot fulsh  proxy [%s]\n",string_buffer);     
44        }
45
46        if (p2pproxy_resourcemgt_lookup_sip_proxy(string_buffer,256,"toto.linphone.org") != P2PPROXY_RESOURCEMGT_SERVER_NOT_FOUND) {
47                printf("unexpected proxy [%s]\n",string_buffer);       
48        } else {
49                printf("unknown domaine\n");
50        }
51
52        if (p2pproxy_accountmgt_deleteAccount("sip:titi@p2p.linphone.org") != P2PPROXY_NO_ERROR) {
53                printf("cannot delete account \n");     
54        }
55       
56       
57        p2pproxy_application_stop();
58        pthread_join(th,NULL);
59        return 0;
60}
Note: See TracBrowser for help on using the repository browser.