Changeset 5618 for pjproject/trunk/pjsip-apps/src/samples/streamutil.c
- Timestamp:
- Jul 4, 2017 1:00:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/streamutil.c
r5590 r5618 107 107 const pjmedia_codec_param *codec_param); 108 108 109 /* Prototype for LIBSRTP utility in file datatypes.c */ 110 int hex_string_to_octet_string(char *raw, char *hex, int len); 109 /* Hexa string to octet array */ 110 int my_hex_string_to_octet_string(char *raw, char *hex, int len) 111 { 112 int i; 113 for (i = 0; i < len; i+=2) { 114 int tmp; 115 if (i+1 >= len || !pj_isxdigit(hex[i]) || !pj_isxdigit(hex[i+1])) 116 return i; 117 tmp = pj_hex_digit_to_val((unsigned char)hex[i]) << 4; 118 tmp |= pj_hex_digit_to_val((unsigned char)hex[i+1]); 119 raw[i/2] = (char)(tmp & 0xFF); 120 } 121 return len; 122 } 111 123 112 124 /* … … 488 500 489 501 case OPT_SRTP_TX_KEY: 490 tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg,491 (int)strlen(pj_optarg));502 tmp_key_len = my_hex_string_to_octet_string(tmp_tx_key, pj_optarg, 503 (int)strlen(pj_optarg)); 492 504 pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); 493 505 break; 494 506 495 507 case OPT_SRTP_RX_KEY: 496 tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg,497 (int)strlen(pj_optarg));508 tmp_key_len = my_hex_string_to_octet_string(tmp_rx_key, pj_optarg, 509 (int)strlen(pj_optarg)); 498 510 pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); 499 511 break;
Note: See TracChangeset
for help on using the changeset viewer.