Ignore:
Timestamp:
May 15, 2007 10:42:56 AM (17 years ago)
Author:
bennylp
Message:

Fixed several STUN bugs: USERNAME, REALM etc are not allowed in the response, retransmission timer calculation bug, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjstun-srv-test/main.c

    r1054 r1275  
    7979    pj_caching_pool cp; 
    8080    pj_stun_server *srv; 
     81    pj_stun_usage *turn; 
    8182    pj_status_t status; 
    8283 
    83     while((c=pj_getopt_long(argc,argv, "r:u:p:hF", long_options, &opt_id))!=-1) { 
     84    while((c=pj_getopt_long(argc,argv, "r:u:p:N:hF", long_options, &opt_id))!=-1) { 
    8485        switch (c) { 
    8586        case 'r': 
     
    132133 
    133134    status = pj_stun_turn_usage_create(srv, PJ_SOCK_DGRAM, NULL, 
    134                                        3478, NULL); 
     135                                       3478, &turn); 
    135136    if (status != PJ_SUCCESS) { 
    136137        pj_stun_perror(THIS_FILE, "Unable to create bind usage", status); 
    137138        return 1; 
     139    } 
     140 
     141    if (o.user_name && o.password) { 
     142        pj_stun_auth_cred cred; 
     143        pj_bzero(&cred, sizeof(cred)); 
     144        cred.type = PJ_STUN_AUTH_CRED_STATIC; 
     145        cred.data.static_cred.realm = pj_str(o.realm); 
     146        cred.data.static_cred.username = pj_str(o.user_name); 
     147        cred.data.static_cred.data_type = 0; 
     148        cred.data.static_cred.data = pj_str(o.password); 
     149        cred.data.static_cred.nonce = pj_str(o.nonce); 
     150        pj_stun_turn_usage_set_credential(turn, &cred); 
    138151    } 
    139152 
Note: See TracChangeset for help on using the changeset viewer.