Changeset 5618
- Timestamp:
- Jul 4, 2017 1:00:42 PM (7 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/samples
- Files:
-
- 2 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; -
pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
r5311 r5618 109 109 const pjmedia_vid_codec_param *codec_param); 110 110 111 /* Prototype for LIBSRTP utility in file datatypes.c */ 112 int hex_string_to_octet_string(char *raw, char *hex, int len); 111 /* Hexa string to octet array */ 112 int my_hex_string_to_octet_string(char *raw, char *hex, int len) 113 { 114 int i; 115 for (i = 0; i < len; i+=2) { 116 int tmp; 117 if (i+1 >= len || !pj_isxdigit(hex[i]) || !pj_isxdigit(hex[i+1])) 118 return i; 119 tmp = pj_hex_digit_to_val((unsigned char)hex[i]) << 4; 120 tmp |= pj_hex_digit_to_val((unsigned char)hex[i+1]); 121 raw[i/2] = (char)(tmp & 0xFF); 122 } 123 return len; 124 } 113 125 114 126 /* … … 506 518 507 519 case OPT_SRTP_TX_KEY: 508 tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg,509 (int)strlen(pj_optarg));520 tmp_key_len = my_hex_string_to_octet_string(tmp_tx_key, pj_optarg, 521 (int)strlen(pj_optarg)); 510 522 pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); 511 523 break; 512 524 513 525 case OPT_SRTP_RX_KEY: 514 tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg,515 (int)strlen(pj_optarg));526 tmp_key_len = my_hex_string_to_octet_string(tmp_rx_key, pj_optarg, 527 (int)strlen(pj_optarg)); 516 528 pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); 517 529 break;
Note: See TracChangeset
for help on using the changeset viewer.