Changeset 4199


Ignore:
Timestamp:
Jul 5, 2012 10:52:55 AM (12 years ago)
Author:
nanang
Message:

Re: Added compile-time setting PJNATH_STUN_SOFTWARE_NAME to specify SOFTWARE attribute for STUN sessions.

Location:
pjproject/trunk/pjnath
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/config.h

    r3553 r4199  
    488488#endif 
    489489 
     490/** Default STUN software name */ 
     491#ifndef PJNATH_STUN_SOFTWARE_NAME 
     492#   define PJNATH_MAKE_SW_NAME(a,b,c,d)     "pjnath-" #a "." #b "." #c d 
     493#   define PJNATH_MAKE_SW_NAME2(a,b,c,d)    PJNATH_MAKE_SW_NAME(a,b,c,d) 
     494#   define PJNATH_STUN_SOFTWARE_NAME        PJNATH_MAKE_SW_NAME2( \ 
     495                                                    PJ_VERSION_NUM_MAJOR, \ 
     496                                                    PJ_VERSION_NUM_MINOR, \ 
     497                                                    PJ_VERSION_NUM_REV, \ 
     498                                                    PJ_VERSION_NUM_EXTRA) 
     499#endif 
     500 
    490501/** 
    491502 * @} 
  • pjproject/trunk/pjnath/include/pjnath/stun_config.h

    r3553 r4199  
    8282    unsigned             res_cache_msec; 
    8383 
     84    /** 
     85     * Software name to be included in all STUN requests and responses. 
     86     * 
     87     * Default: PJNATH_STUN_SOFTWARE_NAME. 
     88     */ 
     89    pj_str_t             software_name; 
     90 
    8491} pj_stun_config; 
    8592 
     
    103110    cfg->rto_msec = PJ_STUN_RTO_VALUE; 
    104111    cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION; 
     112    cfg->software_name = pj_str((char*)PJNATH_STUN_SOFTWARE_NAME); 
    105113} 
    106114 
  • pjproject/trunk/pjnath/src/pjnath/stun_session.c

    r3843 r4199  
    501501    sess->use_fingerprint = fingerprint; 
    502502    sess->log_flag = 0xFFFF; 
    503      
    504     sess->srv_name.ptr = (char*) pj_pool_alloc(pool, 32); 
    505     sess->srv_name.slen = pj_ansi_snprintf(sess->srv_name.ptr, 32, 
    506                                            "pjnath-%s", pj_get_version()); 
     503 
     504    pj_stun_session_set_software_name(sess, &cfg->software_name); 
    507505 
    508506    sess->rx_pool = pj_pool_create(sess->cfg->pf, name,  
Note: See TracChangeset for help on using the changeset viewer.