Changeset 1038 for pjproject/trunk
- Timestamp:
- Mar 3, 2007 7:35:34 PM (18 years ago)
- Location:
- pjproject/trunk/pjlib-util/src/pjlib-util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/stun_msg.c
r1037 r1038 1842 1842 1843 1843 /* 1844 static char *print_binary(const pj_uint8_t *data, unsigned data_len) 1845 { 1846 static char static_buffer[1024]; 1847 char *buffer = static_buffer; 1848 unsigned length=sizeof(static_buffer), i; 1849 1850 if (length < data_len * 2 + 8) 1851 return ""; 1852 1853 pj_ansi_sprintf(buffer, ", data="); 1854 buffer += 7; 1855 1856 for (i=0; i<data_len; ++i) { 1857 pj_ansi_sprintf(buffer, "%02x", (*data) & 0xFF); 1858 buffer += 2; 1859 data++; 1860 } 1861 1862 pj_ansi_sprintf(buffer, "\n"); 1863 buffer++; 1864 1865 return static_buffer; 1866 } 1867 */ 1868 1869 /* 1844 1870 * Print the message structure to a buffer. 1845 1871 */ … … 2002 2028 2003 2029 /* Calculate HMAC-SHA1 digest */ 2004 pj_hmac_sha1((pj_uint8_t*) buf, buf-start,2030 pj_hmac_sha1((pj_uint8_t*)start, buf-start, 2005 2031 (pj_uint8_t*)key.ptr, key.slen, 2006 2032 amsgint->hmac); -
pjproject/trunk/pjlib-util/src/pjlib-util/stun_msg_dump.c
r1037 r1038 27 27 p += len 28 28 29 static int print_binary(char *buffer, unsigned length, 30 const pj_uint8_t *data, unsigned data_len) 31 { 32 unsigned i; 33 34 if (length < data_len * 2 + 8) 35 return -1; 36 37 pj_ansi_sprintf(buffer, ", data="); 38 buffer += 7; 39 40 for (i=0; i<data_len; ++i) { 41 pj_ansi_sprintf(buffer, "%02x", (*data) & 0xFF); 42 buffer += 2; 43 data++; 44 } 45 46 pj_ansi_sprintf(buffer, "\n"); 47 buffer++; 48 49 return data_len * 2 + 8; 50 } 51 29 52 static int print_attr(char *buffer, unsigned length, 30 53 const pj_stun_attr_hdr *ahdr) … … 145 168 146 169 case PJ_STUN_ATTR_MESSAGE_INTEGRITY: 170 { 171 const pj_stun_msgint_attr *attr; 172 173 attr = (const pj_stun_msgint_attr*) ahdr; 174 len = print_binary(p, end-p, attr->hmac, 20); 175 APPLY(); 176 } 177 break; 178 147 179 case PJ_STUN_ATTR_DATA: 180 { 181 const pj_stun_binary_attr *attr; 182 183 attr = (const pj_stun_binary_attr*) ahdr; 184 len = print_binary(p, end-p, attr->data, attr->length); 185 APPLY(); 186 } 187 break; 148 188 case PJ_STUN_ATTR_USE_CANDIDATE: 149 189 default: -
pjproject/trunk/pjlib-util/src/pjlib-util/stun_session.c
r1037 r1038 700 700 tmp_pool, &response); 701 701 if (status != PJ_SUCCESS && response != NULL) { 702 PJ_LOG(5,(SNAME(sess), "Message authentication failed")); 702 703 send_response(sess, tmp_pool, response, PJ_FALSE, 703 704 src_addr, src_addr_len); … … 866 867 dump = pj_pool_alloc(tmp_pool, PJ_STUN_MAX_PKT_LEN); 867 868 868 PJ_LOG( 4,(SNAME(sess),869 PJ_LOG(5,(SNAME(sess), 869 870 "RX STUN message:\n" 870 871 "--- begin STUN message ---\n" … … 885 886 status = authenticate_msg(sess, packet, pkt_size, msg, tmp_pool, 886 887 src_addr, src_addr_len); 887 if (status != PJ_SUCCESS) 888 if (status != PJ_SUCCESS) { 888 889 goto on_return; 890 } 889 891 890 892 /* Handle message */
Note: See TracChangeset
for help on using the changeset viewer.