TT#111150 Use modern <stdint.h> uint<bits>_t types

The u_int<bits>_t are BSD legacy types, while the new ones are specified
by C99 and SUSv3.

Change-Id: Ia748cabc33a7e5adc2c7a6049ad1e55be0c788a8
pull/1252/head
Guillem Jover 4 years ago
parent 231fc0dd53
commit 07695d2abb

@ -488,7 +488,7 @@ destroy:
#define DS(x) do { \ #define DS(x) do { \
u_int64_t ks_val; \ uint64_t ks_val; \
ks_val = atomic64_get(&ps->kernel_stats.x); \ ks_val = atomic64_get(&ps->kernel_stats.x); \
if (ke->stats.x < ks_val) \ if (ke->stats.x < ks_val) \
diff_ ## x = 0; \ diff_ ## x = 0; \
@ -498,7 +498,7 @@ destroy:
atomic64_add(&rtpe_statsps.x, diff_ ## x); \ atomic64_add(&rtpe_statsps.x, diff_ ## x); \
} while (0) } while (0)
static void update_requests_per_second_stats(struct requests_ps *request, u_int64_t new_val) { static void update_requests_per_second_stats(struct requests_ps *request, uint64_t new_val) {
mutex_lock(&request->lock); mutex_lock(&request->lock);
request->count++; request->count++;
@ -533,7 +533,7 @@ static void call_timer(void *ptr) {
struct rtp_stats *rs; struct rtp_stats *rs;
unsigned int pt; unsigned int pt;
endpoint_t ep; endpoint_t ep;
u_int64_t offers, answers, deletes; uint64_t offers, answers, deletes;
struct timeval tv_start; struct timeval tv_start;
long long run_diff; long long run_diff;

@ -1775,7 +1775,7 @@ static int __handler_func_sequencer(struct media_packet *mp, struct transcode_pa
packet_sequencer_init(&ssrc_in_p->sequencer, (GDestroyNotify) __transcode_packet_free); packet_sequencer_init(&ssrc_in_p->sequencer, (GDestroyNotify) __transcode_packet_free);
u_int16_t seq_ori = ssrc_in_p->sequencer.seq; uint16_t seq_ori = ssrc_in_p->sequencer.seq;
int seq_ret = packet_sequencer_insert(&ssrc_in_p->sequencer, &packet->p); int seq_ret = packet_sequencer_insert(&ssrc_in_p->sequencer, &packet->p);
if (seq_ret < 0) { if (seq_ret < 0) {
// dupe // dupe

@ -23,22 +23,22 @@ GString __thread *crypto_debug_string;
static int aes_cm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, u_int64_t); static int aes_cm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, uint64_t);
static int aes_cm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); static int aes_cm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, uint64_t);
static int aes_gcm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, u_int64_t); static int aes_gcm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, uint64_t);
static int aes_gcm_decrypt_rtp(struct crypto_context *, struct rtp_header *, str *, u_int64_t); static int aes_gcm_decrypt_rtp(struct crypto_context *, struct rtp_header *, str *, uint64_t);
static int aes_gcm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); static int aes_gcm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, uint64_t);
static int aes_gcm_decrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); static int aes_gcm_decrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, uint64_t);
static int hmac_sha1_rtp(struct crypto_context *, char *out, str *in, u_int64_t); static int hmac_sha1_rtp(struct crypto_context *, char *out, str *in, uint64_t);
static int hmac_sha1_rtcp(struct crypto_context *, char *out, str *in); static int hmac_sha1_rtcp(struct crypto_context *, char *out, str *in);
static int aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx); static int aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx);
static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx); static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx);
static int aes_cm_session_key_init(struct crypto_context *c); static int aes_cm_session_key_init(struct crypto_context *c);
static int aes_gcm_session_key_init(struct crypto_context *c); static int aes_gcm_session_key_init(struct crypto_context *c);
static int aes_f8_session_key_init(struct crypto_context *c); static int aes_f8_session_key_init(struct crypto_context *c);
static int evp_session_key_cleanup(struct crypto_context *c); static int evp_session_key_cleanup(struct crypto_context *c);
static int null_crypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx); static int null_crypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx);
static int null_crypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx); static int null_crypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx);
/* all lengths are in bytes */ /* all lengths are in bytes */
struct crypto_suite __crypto_suites[] = { struct crypto_suite __crypto_suites[] = {
@ -367,7 +367,7 @@ static void aes_ctr(unsigned char *out, str *in, EVP_CIPHER_CTX *ecc, const unsi
unsigned int left; unsigned int left;
int outlen, i; int outlen, i;
gboolean aligned = TRUE; gboolean aligned = TRUE;
u_int64_t *pi, *qi, *ki; uint64_t *pi, *qi, *ki;
if (!ecc) if (!ecc)
return; return;
@ -527,10 +527,10 @@ int crypto_gen_session_key(struct crypto_context *c, str *out, unsigned char lab
*/ */
/* rfc 3711 section 4.1.1 */ /* rfc 3711 section 4.1.1 */
static int aes_cm_encrypt(struct crypto_context *c, u_int32_t ssrc, str *s, u_int64_t idx) { static int aes_cm_encrypt(struct crypto_context *c, uint32_t ssrc, str *s, uint64_t idx) {
unsigned char iv[16]; unsigned char iv[16];
u_int32_t *ivi; uint32_t *ivi;
u_int32_t idxh, idxl; uint32_t idxh, idxl;
memcpy(iv, c->session_salt, 14); memcpy(iv, c->session_salt, 14);
iv[14] = iv[15] = '\0'; iv[14] = iv[15] = '\0';
@ -549,26 +549,26 @@ static int aes_cm_encrypt(struct crypto_context *c, u_int32_t ssrc, str *s, u_in
} }
/* rfc 3711 section 4.1 */ /* rfc 3711 section 4.1 */
static int aes_cm_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx) { static int aes_cm_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx) {
return aes_cm_encrypt(c, r->ssrc, s, idx); return aes_cm_encrypt(c, r->ssrc, s, idx);
} }
/* rfc 3711 sections 3.4 and 4.1 */ /* rfc 3711 sections 3.4 and 4.1 */
static int aes_cm_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx) { static int aes_cm_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx) {
return aes_cm_encrypt(c, r->ssrc, s, idx); return aes_cm_encrypt(c, r->ssrc, s, idx);
} }
/* rfc 7714 section 8 */ /* rfc 7714 section 8 */
static int aes_gcm_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx) { static int aes_gcm_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx) {
unsigned char iv[12]; unsigned char iv[12];
int len, ciphertext_len; int len, ciphertext_len;
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->ssrc; *(uint32_t*)(iv+2) ^= r->ssrc;
*(u_int32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); *(uint32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16);
*(u_int16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); *(uint16_t*)(iv+10) ^= htons(idx & 0x00ffffULL);
EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL,
(const unsigned char *) c->session_key, iv); (const unsigned char *) c->session_key, iv);
@ -589,7 +589,7 @@ static int aes_gcm_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, s
return 0; return 0;
} }
static int aes_gcm_decrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx) { static int aes_gcm_decrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx) {
unsigned char iv[12]; unsigned char iv[12];
int len, plaintext_len; int len, plaintext_len;
@ -598,9 +598,9 @@ static int aes_gcm_decrypt_rtp(struct crypto_context *c, struct rtp_header *r, s
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->ssrc; *(uint32_t*)(iv+2) ^= r->ssrc;
*(u_int32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); *(uint32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16);
*(u_int16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); *(uint16_t*)(iv+10) ^= htons(idx & 0x00ffffULL);
EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL,
(const unsigned char *) c->session_key, iv); (const unsigned char *) c->session_key, iv);
@ -623,16 +623,16 @@ static int aes_gcm_decrypt_rtp(struct crypto_context *c, struct rtp_header *r, s
/* rfc 7714 section 9 */ /* rfc 7714 section 9 */
static int aes_gcm_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx) { static int aes_gcm_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx) {
unsigned char iv[12]; unsigned char iv[12];
unsigned char e_idx[4]; unsigned char e_idx[4];
int len, ciphertext_len; int len, ciphertext_len;
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->ssrc; *(uint32_t*)(iv+2) ^= r->ssrc;
*(u_int32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); *(uint32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL);
*(u_int32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); *(uint32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000);
EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL,
(const unsigned char *) c->session_key, iv); (const unsigned char *) c->session_key, iv);
@ -654,16 +654,16 @@ static int aes_gcm_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r,
return 0; return 0;
} }
static int aes_gcm_decrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx) { static int aes_gcm_decrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx) {
unsigned char iv[12]; unsigned char iv[12];
unsigned char e_idx[4]; unsigned char e_idx[4];
int len, plaintext_len; int len, plaintext_len;
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->ssrc; *(uint32_t*)(iv+2) ^= r->ssrc;
*(u_int32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); *(uint32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL);
*(u_int32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); *(uint32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000);
EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL,
(const unsigned char *) c->session_key, iv); (const unsigned char *) c->session_key, iv);
@ -692,10 +692,10 @@ static void aes_128_f8_encrypt(struct crypto_context *c, unsigned char *iv, str
ivx[16], /* IV' */ ivx[16], /* IV' */
x[16]; x[16];
int i, outlen, left; int i, outlen, left;
u_int32_t j; uint32_t j;
unsigned char *p; unsigned char *p;
u_int64_t *pi, *ki, *lki, *xi; uint64_t *pi, *ki, *lki, *xi;
u_int32_t *xu; uint32_t *xu;
EVP_EncryptUpdate(c->session_key_ctx[1], ivx, &outlen, iv, 16); EVP_EncryptUpdate(c->session_key_ctx[1], ivx, &outlen, iv, 16);
assert(outlen == 16); assert(outlen == 16);
@ -747,9 +747,9 @@ done:
} }
/* rfc 3711 section 4.1.2.2 */ /* rfc 3711 section 4.1.2.2 */
static int aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx) { static int aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx) {
unsigned char iv[16]; unsigned char iv[16];
u_int32_t roc; uint32_t roc;
iv[0] = '\0'; iv[0] = '\0';
memcpy(&iv[1], &r->m_pt, 11); /* m, pt, seq, ts, ssrc */ memcpy(&iv[1], &r->m_pt, 11); /* m, pt, seq, ts, ssrc */
@ -762,9 +762,9 @@ static int aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, st
} }
/* rfc 3711 section 4.1.2.3 */ /* rfc 3711 section 4.1.2.3 */
static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx) { static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx) {
unsigned char iv[16]; unsigned char iv[16];
u_int32_t i; uint32_t i;
memset(iv, 0, 4); memset(iv, 0, 4);
i = htonl(0x80000000ULL | idx); i = htonl(0x80000000ULL | idx);
@ -776,9 +776,9 @@ static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r,
return 0; return 0;
} }
/* rfc 3711, sections 4.2 and 4.2.1 */ /* rfc 3711, sections 4.2 and 4.2.1 */
static int hmac_sha1_rtp(struct crypto_context *c, char *out, str *in, u_int64_t index) { static int hmac_sha1_rtp(struct crypto_context *c, char *out, str *in, uint64_t index) {
unsigned char hmac[20]; unsigned char hmac[20];
u_int32_t roc; uint32_t roc;
HMAC_CTX *hc; HMAC_CTX *hc;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L
@ -897,10 +897,10 @@ static int evp_session_key_cleanup(struct crypto_context *c) {
return 0; return 0;
} }
static int null_crypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_t idx) { static int null_crypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, uint64_t idx) {
return 0; return 0;
} }
static int null_crypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, u_int64_t idx) { static int null_crypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, str *s, uint64_t idx) {
return 0; return 0;
} }

@ -242,30 +242,30 @@ out:
// from captagent transport_hep.[ch] // from captagent transport_hep.[ch]
struct hep_chunk { struct hep_chunk {
u_int16_t vendor_id; uint16_t vendor_id;
u_int16_t type_id; uint16_t type_id;
u_int16_t length; uint16_t length;
} __attribute__((packed)); } __attribute__((packed));
typedef struct hep_chunk hep_chunk_t; typedef struct hep_chunk hep_chunk_t;
struct hep_chunk_uint8 { struct hep_chunk_uint8 {
hep_chunk_t chunk; hep_chunk_t chunk;
u_int8_t data; uint8_t data;
} __attribute__((packed)); } __attribute__((packed));
typedef struct hep_chunk_uint8 hep_chunk_uint8_t; typedef struct hep_chunk_uint8 hep_chunk_uint8_t;
struct hep_chunk_uint16 { struct hep_chunk_uint16 {
hep_chunk_t chunk; hep_chunk_t chunk;
u_int16_t data; uint16_t data;
} __attribute__((packed)); } __attribute__((packed));
typedef struct hep_chunk_uint16 hep_chunk_uint16_t; typedef struct hep_chunk_uint16 hep_chunk_uint16_t;
struct hep_chunk_uint32 { struct hep_chunk_uint32 {
hep_chunk_t chunk; hep_chunk_t chunk;
u_int32_t data; uint32_t data;
} __attribute__((packed)); } __attribute__((packed));
typedef struct hep_chunk_uint32 hep_chunk_uint32_t; typedef struct hep_chunk_uint32 hep_chunk_uint32_t;
@ -293,7 +293,7 @@ typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
struct hep_ctrl { struct hep_ctrl {
char id[4]; char id[4];
u_int16_t length; uint16_t length;
} __attribute__((packed)); } __attribute__((packed));
typedef struct hep_ctrl hep_ctrl_t; typedef struct hep_ctrl hep_ctrl_t;

@ -55,7 +55,7 @@ static void ice_agents_timer_run(void *);
static u_int64_t tie_breaker; static uint64_t tie_breaker;
static struct timerthread ice_agents_timer_thread; static struct timerthread ice_agents_timer_thread;
@ -99,16 +99,16 @@ int ice_has_related(enum ice_candidate_type t) {
static u_int64_t __ice_pair_priority(const struct local_intf *ifa, struct ice_candidate *cand, static uint64_t __ice_pair_priority(const struct local_intf *ifa, struct ice_candidate *cand,
int controlling) int controlling)
{ {
u_int64_t g, d; uint64_t g, d;
g = ice_priority(ICT_HOST, ifa->unique_id, cand->component_id); g = ice_priority(ICT_HOST, ifa->unique_id, cand->component_id);
d = cand->priority; d = cand->priority;
if (!controlling) { if (!controlling) {
u_int64_t t = g; uint64_t t = g;
g = d; g = d;
d = t; d = t;
} }
@ -200,11 +200,11 @@ static int __found_equal(const void *a, const void *b) {
&& A->component_id == B->component_id; && A->component_id == B->component_id;
} }
static unsigned int __trans_hash(const void *p) { static unsigned int __trans_hash(const void *p) {
const u_int32_t *tp = p; const uint32_t *tp = p;
return tp[0] ^ tp[1] ^ tp[2]; return tp[0] ^ tp[1] ^ tp[2];
} }
static int __trans_equal(const void *a, const void *b) { static int __trans_equal(const void *a, const void *b) {
const u_int32_t *A = a, *B = b; const uint32_t *A = a, *B = b;
return A[0] == B[0] && A[1] == B[1] && A[2] == B[2]; return A[0] == B[0] && A[1] == B[1] && A[2] == B[2];
} }
static int __pair_prio_cmp(const void *a, const void *b) { static int __pair_prio_cmp(const void *a, const void *b) {
@ -578,7 +578,7 @@ static void __fail_pair(struct ice_candidate_pair *pair) {
static void __do_ice_check(struct ice_candidate_pair *pair) { static void __do_ice_check(struct ice_candidate_pair *pair) {
struct stream_fd *sfd = pair->sfd; struct stream_fd *sfd = pair->sfd;
struct ice_agent *ag = pair->agent; struct ice_agent *ag = pair->agent;
u_int32_t prio, transact[3]; uint32_t prio, transact[3];
if (AGENT_ISSET(ag, LITE_SELF)) if (AGENT_ISSET(ag, LITE_SELF))
PAIR_SET(pair, SUCCEEDED); PAIR_SET(pair, SUCCEEDED);

@ -1448,11 +1448,11 @@ noop:
// check and update SSRC pointers // check and update SSRC pointers
static void __stream_ssrc(struct packet_stream *in_srtp, struct packet_stream *out_srtp, u_int32_t ssrc_bs, static void __stream_ssrc(struct packet_stream *in_srtp, struct packet_stream *out_srtp, uint32_t ssrc_bs,
struct ssrc_ctx **ssrc_in_p, struct ssrc_ctx **ssrc_out_p, struct ssrc_hash *ssrc_hash, struct packet_handler_ctx *phc) struct ssrc_ctx **ssrc_in_p, struct ssrc_ctx **ssrc_out_p, struct ssrc_hash *ssrc_hash, struct packet_handler_ctx *phc)
{ {
u_int32_t in_ssrc = ntohl(ssrc_bs); uint32_t in_ssrc = ntohl(ssrc_bs);
u_int32_t out_ssrc; uint32_t out_ssrc;
// input direction // input direction
mutex_lock(&in_srtp->in_lock); mutex_lock(&in_srtp->in_lock);

@ -1035,7 +1035,7 @@ static int redis_hash_get_str(str *out, const struct redis_hash *h, const char *
/* we can do this because this happens during startup in a single thread */ /* we can do this because this happens during startup in a single thread */
static atomic64 strtoa64(const char *c, char **endp, int base) { static atomic64 strtoa64(const char *c, char **endp, int base) {
u_int64_t u; uint64_t u;
atomic64 ret; atomic64 ret;
u = strtoull(c, endp, base); u = strtoull(c, endp, base);
@ -1053,15 +1053,15 @@ define_get_int_type(time_t, time_t, strtoull);
define_get_int_type(timeval, struct timeval, strtotimeval); define_get_int_type(timeval, struct timeval, strtotimeval);
define_get_int_type(int, int, strtol); define_get_int_type(int, int, strtol);
define_get_int_type(unsigned, unsigned int, strtol); define_get_int_type(unsigned, unsigned int, strtol);
//define_get_int_type(u16, u_int16_t, strtol); //define_get_int_type(u16, uint16_t, strtol);
//define_get_int_type(u64, u_int64_t, strtoull); //define_get_int_type(u64, uint64_t, strtoull);
define_get_int_type(a64, atomic64, strtoa64); define_get_int_type(a64, atomic64, strtoa64);
define_get_type_format(str, str); define_get_type_format(str, str);
define_get_type_format(int, int); define_get_type_format(int, int);
//define_get_type_format(unsigned, unsigned int); //define_get_type_format(unsigned, unsigned int);
//define_get_type_format(u16, u_int16_t); //define_get_type_format(u16, uint16_t);
//define_get_type_format(u64, u_int64_t); //define_get_type_format(u64, uint64_t);
define_get_type_format(a64, atomic64); define_get_type_format(a64, atomic64);
static int redis_hash_get_c_buf_fn(unsigned char *out, size_t len, const struct redis_hash *h, static int redis_hash_get_c_buf_fn(unsigned char *out, size_t len, const struct redis_hash *h,
@ -1697,7 +1697,7 @@ static int json_build_ssrc(struct call *c, JsonReader *root_reader) {
if (!json_reader_read_element(root_reader, jidx)) if (!json_reader_read_element(root_reader, jidx))
return -1; return -1;
u_int32_t ssrc = json_reader_get_ll(root_reader, "ssrc"); uint32_t ssrc = json_reader_get_ll(root_reader, "ssrc");
struct ssrc_entry_call *se = get_ssrc(ssrc, c->ssrc_hash); struct ssrc_entry_call *se = get_ssrc(ssrc, c->ssrc_hash);
se->input_ctx.srtp_index = json_reader_get_ll(root_reader, "in_srtp_index"); se->input_ctx.srtp_index = json_reader_get_ll(root_reader, "in_srtp_index");
se->input_ctx.srtcp_index = json_reader_get_ll(root_reader, "in_srtcp_index"); se->input_ctx.srtcp_index = json_reader_get_ll(root_reader, "in_srtcp_index");

@ -68,22 +68,22 @@
struct report_block { struct report_block {
u_int32_t ssrc; uint32_t ssrc;
unsigned char fraction_lost; unsigned char fraction_lost;
unsigned char number_lost[3]; unsigned char number_lost[3];
u_int32_t high_seq_received; uint32_t high_seq_received;
u_int32_t jitter; uint32_t jitter;
u_int32_t lsr; uint32_t lsr;
u_int32_t dlsr; uint32_t dlsr;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct sender_report_packet { struct sender_report_packet {
struct rtcp_packet rtcp; struct rtcp_packet rtcp;
u_int32_t ntp_msw; uint32_t ntp_msw;
u_int32_t ntp_lsw; uint32_t ntp_lsw;
u_int32_t timestamp; uint32_t timestamp;
u_int32_t packet_count; uint32_t packet_count;
u_int32_t octet_count; uint32_t octet_count;
struct report_block reports[0]; struct report_block reports[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -99,7 +99,7 @@ struct sdes_item {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct sdes_chunk { struct sdes_chunk {
u_int32_t ssrc; uint32_t ssrc;
struct sdes_item items[0]; struct sdes_item items[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -110,7 +110,7 @@ struct source_description_packet {
struct bye_packet { struct bye_packet {
struct rtcp_header header; struct rtcp_header header;
u_int32_t ssrcs[0]; uint32_t ssrcs[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct app_packet { struct app_packet {
@ -121,14 +121,14 @@ struct app_packet {
struct fb_packet { struct fb_packet {
struct rtcp_packet rtcp; struct rtcp_packet rtcp;
u_int32_t media_ssrc; uint32_t media_ssrc;
unsigned char information[0]; unsigned char information[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct xr_report_block { struct xr_report_block {
u_int8_t bt; /**< Block type. */ uint8_t bt; /**< Block type. */
u_int8_t specific; /**< Block specific data. */ uint8_t specific; /**< Block specific data. */
u_int16_t length; /**< Block length. */ uint16_t length; /**< Block length. */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct xr_packet { struct xr_packet {
@ -138,14 +138,14 @@ struct xr_packet {
struct xr_rb_rr_time { struct xr_rb_rr_time {
struct xr_report_block header; struct xr_report_block header;
u_int32_t ntp_msw; /**< NTP time, seconds part. */ uint32_t ntp_msw; /**< NTP time, seconds part. */
u_int32_t ntp_lsw; /**< NTP time, fractions part. */ uint32_t ntp_lsw; /**< NTP time, fractions part. */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct xr_rb_dlrr_item { struct xr_rb_dlrr_item {
u_int32_t ssrc; /**< receiver SSRC */ uint32_t ssrc; /**< receiver SSRC */
u_int32_t lrr; /**< last receiver report */ uint32_t lrr; /**< last receiver report */
u_int32_t dlrr; /**< delay since last receiver uint32_t dlrr; /**< delay since last receiver
report */ report */
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -157,54 +157,54 @@ struct xr_rb_dlrr {
struct xr_rb_stats { struct xr_rb_stats {
struct xr_report_block header; struct xr_report_block header;
u_int32_t ssrc; /**< Receiver SSRC */ uint32_t ssrc; /**< Receiver SSRC */
u_int16_t begin_seq; /**< Begin RTP sequence reported */ uint16_t begin_seq; /**< Begin RTP sequence reported */
u_int16_t end_seq; /**< End RTP sequence reported */ uint16_t end_seq; /**< End RTP sequence reported */
u_int32_t lost; /**< Number of packet lost in this uint32_t lost; /**< Number of packet lost in this
interval */ interval */
u_int32_t dup; /**< Number of duplicated packet in uint32_t dup; /**< Number of duplicated packet in
this interval */ this interval */
u_int32_t jitter_min; /**< Minimum jitter in this interval */ uint32_t jitter_min; /**< Minimum jitter in this interval */
u_int32_t jitter_max; /**< Maximum jitter in this interval */ uint32_t jitter_max; /**< Maximum jitter in this interval */
u_int32_t jitter_mean; /**< Average jitter in this interval */ uint32_t jitter_mean; /**< Average jitter in this interval */
u_int32_t jitter_dev; /**< Jitter deviation in this uint32_t jitter_dev; /**< Jitter deviation in this
interval */ interval */
u_int32_t toh_min:8; /**< Minimum ToH in this interval */ uint32_t toh_min:8; /**< Minimum ToH in this interval */
u_int32_t toh_max:8; /**< Maximum ToH in this interval */ uint32_t toh_max:8; /**< Maximum ToH in this interval */
u_int32_t toh_mean:8; /**< Average ToH in this interval */ uint32_t toh_mean:8; /**< Average ToH in this interval */
u_int32_t toh_dev:8; /**< ToH deviation in this interval */ uint32_t toh_dev:8; /**< ToH deviation in this interval */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct xr_rb_voip_metrics { struct xr_rb_voip_metrics {
struct xr_report_block header; struct xr_report_block header;
u_int32_t ssrc; /**< Receiver SSRC */ uint32_t ssrc; /**< Receiver SSRC */
u_int8_t loss_rate; /**< Packet loss rate */ uint8_t loss_rate; /**< Packet loss rate */
u_int8_t discard_rate; /**< Packet discarded rate */ uint8_t discard_rate; /**< Packet discarded rate */
u_int8_t burst_den; /**< Burst density */ uint8_t burst_den; /**< Burst density */
u_int8_t gap_den; /**< Gap density */ uint8_t gap_den; /**< Gap density */
u_int16_t burst_dur; /**< Burst duration */ uint16_t burst_dur; /**< Burst duration */
u_int16_t gap_dur; /**< Gap duration */ uint16_t gap_dur; /**< Gap duration */
u_int16_t rnd_trip_delay;/**< Round trip delay */ uint16_t rnd_trip_delay;/**< Round trip delay */
u_int16_t end_sys_delay; /**< End system delay */ uint16_t end_sys_delay; /**< End system delay */
u_int8_t signal_lvl; /**< Signal level */ uint8_t signal_lvl; /**< Signal level */
u_int8_t noise_lvl; /**< Noise level */ uint8_t noise_lvl; /**< Noise level */
u_int8_t rerl; /**< Residual Echo Return Loss */ uint8_t rerl; /**< Residual Echo Return Loss */
u_int8_t gmin; /**< The gap threshold */ uint8_t gmin; /**< The gap threshold */
u_int8_t r_factor; /**< Voice quality metric carried uint8_t r_factor; /**< Voice quality metric carried
over this RTP session */ over this RTP session */
u_int8_t ext_r_factor; /**< Voice quality metric carried uint8_t ext_r_factor; /**< Voice quality metric carried
outside of this RTP session*/ outside of this RTP session*/
u_int8_t mos_lq; /**< Mean Opinion Score for uint8_t mos_lq; /**< Mean Opinion Score for
Listening Quality */ Listening Quality */
u_int8_t mos_cq; /**< Mean Opinion Score for uint8_t mos_cq; /**< Mean Opinion Score for
Conversation Quality */ Conversation Quality */
u_int8_t rx_config; /**< Receiver configuration */ uint8_t rx_config; /**< Receiver configuration */
u_int8_t reserved2; /**< Not used */ uint8_t reserved2; /**< Not used */
u_int16_t jb_nom; /**< Current delay by jitter uint16_t jb_nom; /**< Current delay by jitter
buffer */ buffer */
u_int16_t jb_max; /**< Maximum delay by jitter uint16_t jb_max; /**< Maximum delay by jitter
buffer */ buffer */
u_int16_t jb_abs_max; /**< Maximum possible delay by uint16_t jb_abs_max; /**< Maximum possible delay by
jitter buffer */ jitter buffer */
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -238,7 +238,7 @@ struct rtcp_process_ctx {
struct ssrc_xr_rr_time xr_rr; struct ssrc_xr_rr_time xr_rr;
struct ssrc_xr_dlrr xr_dlrr; struct ssrc_xr_dlrr xr_dlrr;
} scratch; } scratch;
u_int32_t scratch_common_ssrc; uint32_t scratch_common_ssrc;
// RTCP syslog output // RTCP syslog output
GString *log; GString *log;
@ -846,7 +846,7 @@ error:
/* rfc 3711 section 3.4 */ /* rfc 3711 section 3.4 */
int rtcp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { int rtcp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
struct rtcp_packet *rtcp; struct rtcp_packet *rtcp;
u_int32_t *idx; uint32_t *idx;
str to_auth, payload; str to_auth, payload;
if (G_UNLIKELY(!ssrc_ctx)) if (G_UNLIKELY(!ssrc_ctx))
@ -896,7 +896,7 @@ int rtcp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
int rtcp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { int rtcp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
struct rtcp_packet *rtcp; struct rtcp_packet *rtcp;
str payload, to_auth, to_decrypt, auth_tag; str payload, to_auth, to_decrypt, auth_tag;
u_int32_t idx, *idx_p; uint32_t idx, *idx_p;
char hmac[20]; char hmac[20];
const char *err; const char *err;

@ -45,8 +45,8 @@ error:
return -1; return -1;
} }
static u_int64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp) { static uint64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp) {
u_int16_t seq; uint16_t seq;
seq = ntohs(rtp->seq_num); seq = ntohs(rtp->seq_num);
@ -58,9 +58,9 @@ static u_int64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp)
ssrc_ctx->srtp_index = seq; ssrc_ctx->srtp_index = seq;
/* rfc 3711 appendix A, modified, and sections 3.3 and 3.3.1 */ /* rfc 3711 appendix A, modified, and sections 3.3 and 3.3.1 */
u_int16_t s_l = (ssrc_ctx->srtp_index & 0x00000000ffffULL); uint16_t s_l = (ssrc_ctx->srtp_index & 0x00000000ffffULL);
u_int32_t roc = (ssrc_ctx->srtp_index & 0xffffffff0000ULL) >> 16; uint32_t roc = (ssrc_ctx->srtp_index & 0xffffffff0000ULL) >> 16;
u_int32_t v = 0; uint32_t v = 0;
crypto_debug_printf(", prev seq %" PRIu64 ", s_l %" PRIu16 ", ROC %" PRIu32, crypto_debug_printf(", prev seq %" PRIu64 ", s_l %" PRIu16 ", ROC %" PRIu32,
ssrc_ctx->srtp_index, s_l, roc); ssrc_ctx->srtp_index, s_l, roc);
@ -77,7 +77,7 @@ static u_int64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp)
v = roc; v = roc;
} }
ssrc_ctx->srtp_index = (u_int64_t)(((v << 16) | seq) & 0xffffffffffffULL); ssrc_ctx->srtp_index = (uint64_t)(((v << 16) | seq) & 0xffffffffffffULL);
crypto_debug_printf(", v %" PRIu32 ", ext seq %" PRIu64, v, ssrc_ctx->srtp_index); crypto_debug_printf(", v %" PRIu32 ", ext seq %" PRIu64, v, ssrc_ctx->srtp_index);
@ -103,7 +103,7 @@ void rtp_append_mki(str *s, struct crypto_context *c) {
int rtp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { int rtp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
struct rtp_header *rtp; struct rtp_header *rtp;
str payload, to_auth; str payload, to_auth;
u_int64_t index; uint64_t index;
if (G_UNLIKELY(!ssrc_ctx)) if (G_UNLIKELY(!ssrc_ctx))
return -1; return -1;
@ -145,7 +145,7 @@ int rtp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
/* rfc 3711, section 3.3 */ /* rfc 3711, section 3.3 */
int rtp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { int rtp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
struct rtp_header *rtp; struct rtp_header *rtp;
u_int64_t index; uint64_t index;
str payload, to_auth, to_decrypt, auth_tag; str payload, to_auth, to_decrypt, auth_tag;
char hmac[20]; char hmac[20];

@ -116,7 +116,7 @@ struct attribute_crypto {
str master_key; str master_key;
str salt; str salt;
char key_salt_buf[SRTP_MAX_MASTER_KEY_LEN + SRTP_MAX_MASTER_SALT_LEN]; char key_salt_buf[SRTP_MAX_MASTER_KEY_LEN + SRTP_MAX_MASTER_SALT_LEN];
u_int64_t lifetime; uint64_t lifetime;
unsigned char mki[256]; unsigned char mki[256];
unsigned int mki_len; unsigned int mki_len;
unsigned int unencrypted_srtcp:1, unsigned int unencrypted_srtcp:1,
@ -128,7 +128,7 @@ struct attribute_ssrc {
str id_str; str id_str;
str attr_str; str attr_str;
u_int32_t id; uint32_t id;
str attr; str attr;
str value; str value;
}; };
@ -461,7 +461,7 @@ static int parse_attribute_crypto(struct sdp_attribute *output) {
unsigned int b64_save = 0; unsigned int b64_save = 0;
gsize ret; gsize ret;
str s; str s;
u_int32_t u32; uint32_t u32;
const char *err; const char *err;
output->attr = ATTR_CRYPTO; output->attr = ATTR_CRYPTO;
@ -2141,7 +2141,7 @@ static void new_priority(struct sdp_media *media, enum ice_candidate_type type,
{ {
GQueue *cands; GQueue *cands;
unsigned int lpref, tpref; unsigned int lpref, tpref;
u_int32_t prio; uint32_t prio;
GList *l; GList *l;
struct sdp_attribute *a; struct sdp_attribute *a;
struct attribute_candidate *c; struct attribute_candidate *c;

@ -16,7 +16,7 @@ static void init_ssrc_ctx(struct ssrc_ctx *c, struct ssrc_entry_call *parent) {
while (!c->ssrc_map_out) while (!c->ssrc_map_out)
c->ssrc_map_out = ssl_random(); c->ssrc_map_out = ssl_random();
} }
static void init_ssrc_entry(struct ssrc_entry *ent, u_int32_t ssrc) { static void init_ssrc_entry(struct ssrc_entry *ent, uint32_t ssrc) {
ent->ssrc = ssrc; ent->ssrc = ssrc;
ent->last_used = rtpe_now.tv_sec; ent->last_used = rtpe_now.tv_sec;
mutex_init(&ent->lock); mutex_init(&ent->lock);
@ -30,7 +30,7 @@ static struct ssrc_entry *create_ssrc_entry_call(void *uptr) {
//ent->ts_out = ssl_random(); //ent->ts_out = ssl_random();
return &ent->h; return &ent->h;
} }
static void add_ssrc_entry(u_int32_t ssrc, struct ssrc_entry *ent, struct ssrc_hash *ht) { static void add_ssrc_entry(uint32_t ssrc, struct ssrc_entry *ent, struct ssrc_hash *ht) {
init_ssrc_entry(ent, ssrc); init_ssrc_entry(ent, ssrc);
g_hash_table_replace(ht->ht, &ent->ssrc, ent); g_hash_table_replace(ht->ht, &ent->ssrc, ent);
obj_hold(ent); // HT entry obj_hold(ent); // HT entry
@ -84,7 +84,7 @@ static void mos_calc(struct ssrc_stats_block *ssb) {
ssb->mos = intmos; ssb->mos = intmos;
} }
static struct ssrc_entry *find_ssrc(u_int32_t ssrc, struct ssrc_hash *ht) { static struct ssrc_entry *find_ssrc(uint32_t ssrc, struct ssrc_hash *ht) {
rwlock_lock_r(&ht->lock); rwlock_lock_r(&ht->lock);
struct ssrc_entry *ret = g_atomic_pointer_get(&ht->cache); struct ssrc_entry *ret = g_atomic_pointer_get(&ht->cache);
if (!ret || ret->ssrc != ssrc) { if (!ret || ret->ssrc != ssrc) {
@ -114,7 +114,7 @@ static int ssrc_time_cmp(const void *aa, const void *bb, void *pp) {
} }
// returns a new reference // returns a new reference
void *get_ssrc(u_int32_t ssrc, struct ssrc_hash *ht /* , int *created */) { void *get_ssrc(uint32_t ssrc, struct ssrc_hash *ht /* , int *created */) {
struct ssrc_entry *ent; struct ssrc_entry *ent;
if (!ht) if (!ht)
@ -207,7 +207,7 @@ struct ssrc_hash *create_ssrc_hash_call(void) {
return create_ssrc_hash_full(create_ssrc_entry_call, NULL); return create_ssrc_hash_full(create_ssrc_entry_call, NULL);
} }
struct ssrc_ctx *get_ssrc_ctx(u_int32_t ssrc, struct ssrc_hash *ht, enum ssrc_dir dir, void *ref) { struct ssrc_ctx *get_ssrc_ctx(uint32_t ssrc, struct ssrc_hash *ht, enum ssrc_dir dir, void *ref) {
struct ssrc_entry *s = get_ssrc(ssrc, ht /* , NULL */); struct ssrc_entry *s = get_ssrc(ssrc, ht /* , NULL */);
if (G_UNLIKELY(!s)) if (G_UNLIKELY(!s))
return NULL; return NULL;
@ -220,7 +220,7 @@ struct ssrc_ctx *get_ssrc_ctx(u_int32_t ssrc, struct ssrc_hash *ht, enum ssrc_di
static void *__do_time_report_item(struct call_media *m, size_t struct_size, size_t reports_queue_offset, static void *__do_time_report_item(struct call_media *m, size_t struct_size, size_t reports_queue_offset,
const struct timeval *tv, u_int32_t ssrc, u_int32_t ntp_msw, u_int32_t ntp_lsw, const struct timeval *tv, uint32_t ssrc, uint32_t ntp_msw, uint32_t ntp_lsw,
GDestroyNotify free_func, struct ssrc_entry **e_p) GDestroyNotify free_func, struct ssrc_entry **e_p)
{ {
struct call *c = m->call; struct call *c = m->call;
@ -250,8 +250,8 @@ static void *__do_time_report_item(struct call_media *m, size_t struct_size, siz
return sti; return sti;
} }
static long long __calc_rtt(struct call *c, u_int32_t ssrc, u_int32_t ntp_middle_bits, static long long __calc_rtt(struct call *c, uint32_t ssrc, uint32_t ntp_middle_bits,
u_int32_t delay, size_t reports_queue_offset, const struct timeval *tv, int *pt_p) uint32_t delay, size_t reports_queue_offset, const struct timeval *tv, int *pt_p)
{ {
if (pt_p) if (pt_p)
*pt_p = -1; *pt_p = -1;

@ -461,7 +461,7 @@ GQueue *statistics_gather_metrics(void) {
GQueue *ret = g_queue_new(); GQueue *ret = g_queue_new();
struct timeval avg, calls_dur_iv; struct timeval avg, calls_dur_iv;
u_int64_t cur_sessions, num_sessions, min_sess_iv, max_sess_iv; uint64_t cur_sessions, num_sessions, min_sess_iv, max_sess_iv;
struct request_time offer_iv, answer_iv, delete_iv; struct request_time offer_iv, answer_iv, delete_iv;
struct requests_ps offers_ps, answers_ps, deletes_ps; struct requests_ps offers_ps, answers_ps, deletes_ps;

@ -54,15 +54,15 @@
struct header { struct header {
u_int16_t msg_type; uint16_t msg_type;
u_int16_t msg_len; uint16_t msg_len;
u_int32_t cookie; uint32_t cookie;
u_int32_t transaction[3]; uint32_t transaction[3];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct tlv { struct tlv {
u_int16_t type; uint16_t type;
u_int16_t len; uint16_t len;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct generic { struct generic {
@ -71,12 +71,12 @@ struct generic {
struct error_code { struct error_code {
struct tlv tlv; struct tlv tlv;
u_int32_t codes; uint32_t codes;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct fingerprint { struct fingerprint {
struct tlv tlv; struct tlv tlv;
u_int32_t crc; uint32_t crc;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct msg_integrity { struct msg_integrity {
@ -86,19 +86,19 @@ struct msg_integrity {
struct xor_mapped_address { struct xor_mapped_address {
struct tlv tlv; struct tlv tlv;
u_int16_t family; uint16_t family;
u_int16_t port; uint16_t port;
u_int32_t address[4]; uint32_t address[4];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct controlled_ing { struct controlled_ing {
struct tlv tlv; struct tlv tlv;
u_int64_t tiebreaker; uint64_t tiebreaker;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct priority { struct priority {
struct tlv tlv; struct tlv tlv;
u_int32_t priority; uint32_t priority;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct software { struct software {
@ -112,7 +112,7 @@ struct software {
/* XXX add const in functions */ /* XXX add const in functions */
static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns, struct header *req) { static int stun_attributes(struct stun_attrs *out, str *s, uint16_t *unknowns, struct header *req) {
struct tlv *tlv; struct tlv *tlv;
int len, type, uc; int len, type, uc;
str attr; str attr;
@ -157,7 +157,7 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns,
if (attr.len != 4) if (attr.len != 4)
return -1; return -1;
out->fingerprint_attr = (void *) tlv; out->fingerprint_attr = (void *) tlv;
out->fingerprint = ntohl(*(u_int32_t *) attr.s); out->fingerprint = ntohl(*(uint32_t *) attr.s);
goto out; goto out;
case STUN_USE_CANDIDATE: case STUN_USE_CANDIDATE:
@ -169,7 +169,7 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns,
return -1; return -1;
if (attr.len != 8) if (attr.len != 8)
return -1; return -1;
out->tiebreaker = be64toh(*((u_int64_t *) attr.s)); out->tiebreaker = be64toh(*((uint64_t *) attr.s));
out->controlled = 1; out->controlled = 1;
break; break;
@ -178,14 +178,14 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns,
return -1; return -1;
if (attr.len != 8) if (attr.len != 8)
return -1; return -1;
out->tiebreaker = be64toh(*((u_int64_t *) attr.s)); out->tiebreaker = be64toh(*((uint64_t *) attr.s));
out->controlling = 1; out->controlling = 1;
break; break;
case STUN_PRIORITY: case STUN_PRIORITY:
if (attr.len != 4) if (attr.len != 4)
return -1; return -1;
out->priority = ntohl(*((u_int32_t *) attr.s)); out->priority = ntohl(*((uint32_t *) attr.s));
break; break;
case STUN_SOFTWARE: case STUN_SOFTWARE:
@ -194,29 +194,29 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns,
case STUN_XOR_MAPPED_ADDRESS: case STUN_XOR_MAPPED_ADDRESS:
if (attr.len < 8) if (attr.len < 8)
return -1; return -1;
out->mapped.port = ntohs(*((u_int16_t *) (&attr.s[2]))) ^ (STUN_COOKIE >> 16); out->mapped.port = ntohs(*((uint16_t *) (&attr.s[2]))) ^ (STUN_COOKIE >> 16);
if (attr.len == 8 && ntohs(*((u_int16_t *) attr.s)) == 1) { if (attr.len == 8 && ntohs(*((uint16_t *) attr.s)) == 1) {
out->mapped.address.family = get_socket_family_enum(SF_IP4); out->mapped.address.family = get_socket_family_enum(SF_IP4);
out->mapped.address.u.ipv4.s_addr = out->mapped.address.u.ipv4.s_addr =
ntohl(*((u_int32_t *) (&attr.s[4]))) ^ STUN_COOKIE; ntohl(*((uint32_t *) (&attr.s[4]))) ^ STUN_COOKIE;
} }
else if (attr.len == 20 && ntohs(*((u_int16_t *) attr.s)) == 1) { else if (attr.len == 20 && ntohs(*((uint16_t *) attr.s)) == 1) {
out->mapped.address.family = get_socket_family_enum(SF_IP6); out->mapped.address.family = get_socket_family_enum(SF_IP6);
out->mapped.address.u.ipv6.s6_addr32[0] out->mapped.address.u.ipv6.s6_addr32[0]
= *((u_int32_t *) (&attr.s[4])) ^ htonl(STUN_COOKIE); = *((uint32_t *) (&attr.s[4])) ^ htonl(STUN_COOKIE);
out->mapped.address.u.ipv6.s6_addr32[1] out->mapped.address.u.ipv6.s6_addr32[1]
= *((u_int32_t *) (&attr.s[8])) ^ req->transaction[0]; = *((uint32_t *) (&attr.s[8])) ^ req->transaction[0];
out->mapped.address.u.ipv6.s6_addr32[2] out->mapped.address.u.ipv6.s6_addr32[2]
= *((u_int32_t *) (&attr.s[12])) ^ req->transaction[1]; = *((uint32_t *) (&attr.s[12])) ^ req->transaction[1];
out->mapped.address.u.ipv6.s6_addr32[3] out->mapped.address.u.ipv6.s6_addr32[3]
= *((u_int32_t *) (&attr.s[16])) ^ req->transaction[2]; = *((uint32_t *) (&attr.s[16])) ^ req->transaction[2];
} }
break; break;
case STUN_ERROR_CODE: case STUN_ERROR_CODE:
if (attr.len < 4) if (attr.len < 4)
return -1; return -1;
out->error_code = ntohl(*((u_int32_t *) attr.s)); out->error_code = ntohl(*((uint32_t *) attr.s));
out->error_code = ((out->error_code & 0x700) >> 8) * 100 out->error_code = ((out->error_code & 0x700) >> 8) * 100
+ (out->error_code & 0x0ff); + (out->error_code & 0x0ff);
break; break;
@ -257,7 +257,7 @@ static void output_init(struct msghdr *mh, struct iovec *iov,
memcpy(&hdr->transaction, transaction, sizeof(hdr->transaction)); memcpy(&hdr->transaction, transaction, sizeof(hdr->transaction));
} }
INLINE void __output_add(struct msghdr *mh, struct tlv *tlv, unsigned int len, u_int16_t code, INLINE void __output_add(struct msghdr *mh, struct tlv *tlv, unsigned int len, uint16_t code,
void *append, unsigned int append_len, int writable) void *append, unsigned int append_len, int writable)
{ {
struct iovec *iov; struct iovec *iov;
@ -373,7 +373,7 @@ static void integrity(struct msghdr *mh, struct msg_integrity *mi, str *pwd) {
static void stun_error_len(struct stream_fd *sfd, const endpoint_t *sin, static void stun_error_len(struct stream_fd *sfd, const endpoint_t *sin,
struct header *req, struct header *req,
int code, char *reason, int len, u_int16_t add_attr, void *attr_cont, int code, char *reason, int len, uint16_t add_attr, void *attr_cont,
int attr_len) int attr_len)
{ {
struct header hdr; struct header hdr;
@ -411,7 +411,7 @@ static void stun_error_len(struct stream_fd *sfd, const endpoint_t *sin,
static int check_fingerprint(const str *msg, struct stun_attrs *attrs) { static int check_fingerprint(const str *msg, struct stun_attrs *attrs) {
int len; int len;
u_int32_t crc; uint32_t crc;
len = attrs->fingerprint_attr - msg->s; len = attrs->fingerprint_attr - msg->s;
crc = crc32(0, (void *) msg->s, len); crc = crc32(0, (void *) msg->s, len);
@ -423,7 +423,7 @@ static int check_fingerprint(const str *msg, struct stun_attrs *attrs) {
} }
static int check_auth(const str *msg, struct stun_attrs *attrs, struct call_media *media, int dst, int src) { static int check_auth(const str *msg, struct stun_attrs *attrs, struct call_media *media, int dst, int src) {
u_int16_t lenX; uint16_t lenX;
char digest[20]; char digest[20];
str ufrag[2]; str ufrag[2];
struct iovec iov[3]; struct iovec iov[3];
@ -503,7 +503,7 @@ static int stun_binding_success(struct stream_fd *sfd, struct header *req, struc
return 0; return 0;
} }
INLINE int u_int16_t_arr_len(u_int16_t *arr) { INLINE int uint16_t_arr_len(uint16_t *arr) {
int i; int i;
for (i = 0; arr[i] != 0xffff; i++) for (i = 0; arr[i] != 0xffff; i++)
; ;
@ -558,7 +558,7 @@ int stun(const str *b, struct stream_fd *sfd, const endpoint_t *sin) {
int msglen, method, class; int msglen, method, class;
str attr_str; str attr_str;
struct stun_attrs attrs; struct stun_attrs attrs;
u_int16_t unknowns[UNKNOWNS_COUNT]; uint16_t unknowns[UNKNOWNS_COUNT];
const char *err; const char *err;
int dst_idx, src_idx; int dst_idx, src_idx;
struct packet_stream *ps = sfd->stream; struct packet_stream *ps = sfd->stream;
@ -587,7 +587,7 @@ int stun(const str *b, struct stream_fd *sfd, const endpoint_t *sin) {
"\"comprehension required\" attribute(s)" SLF, SLP); "\"comprehension required\" attribute(s)" SLF, SLP);
stun_error_attrs(sfd, sin, req, 420, "Unknown attribute", stun_error_attrs(sfd, sin, req, 420, "Unknown attribute",
STUN_UNKNOWN_ATTRIBUTES, unknowns, STUN_UNKNOWN_ATTRIBUTES, unknowns,
u_int16_t_arr_len(unknowns) * 2); uint16_t_arr_len(unknowns) * 2);
return 0; return 0;
} }
@ -643,8 +643,8 @@ ignore:
return -1; return -1;
} }
int stun_binding_request(const endpoint_t *dst, u_int32_t transaction[3], str *pwd, int stun_binding_request(const endpoint_t *dst, uint32_t transaction[3], str *pwd,
str ufrags[2], int controlling, u_int64_t tiebreaker, u_int32_t priority, str ufrags[2], int controlling, uint64_t tiebreaker, uint32_t priority,
socket_t *sock, int to_use) socket_t *sock, int to_use)
{ {
struct header hdr; struct header hdr;

@ -258,14 +258,14 @@ taint_func(srandom, "use RAND_seed() instead");
#define IPF "%u.%u.%u.%u" #define IPF "%u.%u.%u.%u"
#define IPP(x) ((unsigned char *) (&(x)))[0], ((unsigned char *) (&(x)))[1], ((unsigned char *) (&(x)))[2], ((unsigned char *) (&(x)))[3] #define IPP(x) ((unsigned char *) (&(x)))[0], ((unsigned char *) (&(x)))[1], ((unsigned char *) (&(x)))[2], ((unsigned char *) (&(x)))[3]
#define IP6F "%x:%x:%x:%x:%x:%x:%x:%x" #define IP6F "%x:%x:%x:%x:%x:%x:%x:%x"
#define IP6P(x) ntohs(((u_int16_t *) (x))[0]), \ #define IP6P(x) ntohs(((uint16_t *) (x))[0]), \
ntohs(((u_int16_t *) (x))[1]), \ ntohs(((uint16_t *) (x))[1]), \
ntohs(((u_int16_t *) (x))[2]), \ ntohs(((uint16_t *) (x))[2]), \
ntohs(((u_int16_t *) (x))[3]), \ ntohs(((uint16_t *) (x))[3]), \
ntohs(((u_int16_t *) (x))[4]), \ ntohs(((uint16_t *) (x))[4]), \
ntohs(((u_int16_t *) (x))[5]), \ ntohs(((uint16_t *) (x))[5]), \
ntohs(((u_int16_t *) (x))[6]), \ ntohs(((uint16_t *) (x))[6]), \
ntohs(((u_int16_t *) (x))[7]) ntohs(((uint16_t *) (x))[7])
#define D6F "["IP6F"]:%u" #define D6F "["IP6F"]:%u"
#define D6P(x) IP6P((x).sin6_addr.s6_addr), ntohs((x).sin6_port) #define D6P(x) IP6P((x).sin6_addr.s6_addr), ntohs((x).sin6_port)
#define DF IPF ":%u" #define DF IPF ":%u"
@ -358,26 +358,26 @@ typedef struct {
volatile void *p; volatile void *p;
} atomic64; } atomic64;
INLINE u_int64_t atomic64_get(const atomic64 *u) { INLINE uint64_t atomic64_get(const atomic64 *u) {
return (u_int64_t) g_atomic_pointer_get(&u->p); return (uint64_t) g_atomic_pointer_get(&u->p);
} }
INLINE u_int64_t atomic64_get_na(const atomic64 *u) { INLINE uint64_t atomic64_get_na(const atomic64 *u) {
return (u_int64_t) u->p; return (uint64_t) u->p;
} }
INLINE void atomic64_set(atomic64 *u, u_int64_t a) { INLINE void atomic64_set(atomic64 *u, uint64_t a) {
g_atomic_pointer_set(&u->p, (void *) a); g_atomic_pointer_set(&u->p, (void *) a);
} }
INLINE void atomic64_set_na(atomic64 *u, u_int64_t a) { INLINE void atomic64_set_na(atomic64 *u, uint64_t a) {
u->p = (void *) a; u->p = (void *) a;
} }
INLINE void atomic64_add(atomic64 *u, u_int64_t a) { INLINE void atomic64_add(atomic64 *u, uint64_t a) {
g_atomic_pointer_add(&u->p, a); g_atomic_pointer_add(&u->p, a);
} }
INLINE void atomic64_add_na(atomic64 *u, u_int64_t a) { INLINE void atomic64_add_na(atomic64 *u, uint64_t a) {
u->p = (void *) (((u_int64_t) u->p) + a); u->p = (void *) (((uint64_t) u->p) + a);
} }
INLINE u_int64_t atomic64_get_set(atomic64 *u, u_int64_t a) { INLINE uint64_t atomic64_get_set(atomic64 *u, uint64_t a) {
u_int64_t old; uint64_t old;
do { do {
old = atomic64_get(u); old = atomic64_get(u);
if (g_atomic_pointer_compare_and_exchange(&u->p, (void *) old, (void *) a)) if (g_atomic_pointer_compare_and_exchange(&u->p, (void *) old, (void *) a))
@ -391,40 +391,40 @@ INLINE u_int64_t atomic64_get_set(atomic64 *u, u_int64_t a) {
* Bad performance possible, thus not recommended. */ * Bad performance possible, thus not recommended. */
typedef struct { typedef struct {
u_int64_t u; uint64_t u;
} atomic64; } atomic64;
#define NEED_ATOMIC64_MUTEX #define NEED_ATOMIC64_MUTEX
extern mutex_t __atomic64_mutex; extern mutex_t __atomic64_mutex;
INLINE u_int64_t atomic64_get(const atomic64 *u) { INLINE uint64_t atomic64_get(const atomic64 *u) {
u_int64_t ret; uint64_t ret;
mutex_lock(&__atomic64_mutex); mutex_lock(&__atomic64_mutex);
ret = u->u; ret = u->u;
mutex_unlock(&__atomic64_mutex); mutex_unlock(&__atomic64_mutex);
return ret; return ret;
} }
INLINE u_int64_t atomic64_get_na(const atomic64 *u) { INLINE uint64_t atomic64_get_na(const atomic64 *u) {
return u->u; return u->u;
} }
INLINE void atomic64_set(atomic64 *u, u_int64_t a) { INLINE void atomic64_set(atomic64 *u, uint64_t a) {
mutex_lock(&__atomic64_mutex); mutex_lock(&__atomic64_mutex);
u->u = a; u->u = a;
mutex_unlock(&__atomic64_mutex); mutex_unlock(&__atomic64_mutex);
} }
INLINE void atomic64_set_na(atomic64 *u, u_int64_t a) { INLINE void atomic64_set_na(atomic64 *u, uint64_t a) {
u->u = a; u->u = a;
} }
INLINE void atomic64_add(atomic64 *u, u_int64_t a) { INLINE void atomic64_add(atomic64 *u, uint64_t a) {
mutex_lock(&__atomic64_mutex); mutex_lock(&__atomic64_mutex);
u->u += a; u->u += a;
mutex_unlock(&__atomic64_mutex); mutex_unlock(&__atomic64_mutex);
} }
INLINE void atomic64_add_na(atomic64 *u, u_int64_t a) { INLINE void atomic64_add_na(atomic64 *u, uint64_t a) {
u->u += a; u->u += a;
} }
INLINE u_int64_t atomic64_get_set(atomic64 *u, u_int64_t a) { INLINE uint64_t atomic64_get_set(atomic64 *u, uint64_t a) {
u_int64_t old; uint64_t old;
mutex_lock(&__atomic64_mutex); mutex_lock(&__atomic64_mutex);
old = u->u; old = u->u;
u->u = a; u->u = a;

@ -23,9 +23,9 @@ struct crypto_context;
struct rtp_header; struct rtp_header;
struct rtcp_packet; struct rtcp_packet;
typedef int (*crypto_func_rtp)(struct crypto_context *, struct rtp_header *, str *, u_int64_t); typedef int (*crypto_func_rtp)(struct crypto_context *, struct rtp_header *, str *, uint64_t);
typedef int (*crypto_func_rtcp)(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); typedef int (*crypto_func_rtcp)(struct crypto_context *, struct rtcp_packet *, str *, uint64_t);
typedef int (*hash_func_rtp)(struct crypto_context *, char *out, str *in, u_int64_t); typedef int (*hash_func_rtp)(struct crypto_context *, char *out, str *in, uint64_t);
typedef int (*hash_func_rtcp)(struct crypto_context *, char *out, str *in); typedef int (*hash_func_rtcp)(struct crypto_context *, char *out, str *in);
typedef int (*session_key_init_func)(struct crypto_context *); typedef int (*session_key_init_func)(struct crypto_context *);
typedef int (*session_key_cleanup_func)(struct crypto_context *); typedef int (*session_key_cleanup_func)(struct crypto_context *);
@ -116,22 +116,22 @@ char *crypto_params_sdes_dump(const struct crypto_params_sdes *, char **);
INLINE int crypto_encrypt_rtp(struct crypto_context *c, struct rtp_header *rtp, INLINE int crypto_encrypt_rtp(struct crypto_context *c, struct rtp_header *rtp,
str *payload, u_int64_t index) str *payload, uint64_t index)
{ {
return c->params.crypto_suite->encrypt_rtp(c, rtp, payload, index); return c->params.crypto_suite->encrypt_rtp(c, rtp, payload, index);
} }
INLINE int crypto_decrypt_rtp(struct crypto_context *c, struct rtp_header *rtp, INLINE int crypto_decrypt_rtp(struct crypto_context *c, struct rtp_header *rtp,
str *payload, u_int64_t index) str *payload, uint64_t index)
{ {
return c->params.crypto_suite->decrypt_rtp(c, rtp, payload, index); return c->params.crypto_suite->decrypt_rtp(c, rtp, payload, index);
} }
INLINE int crypto_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *rtcp, INLINE int crypto_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *rtcp,
str *payload, u_int64_t index) str *payload, uint64_t index)
{ {
return c->params.crypto_suite->encrypt_rtcp(c, rtcp, payload, index); return c->params.crypto_suite->encrypt_rtcp(c, rtcp, payload, index);
} }
INLINE int crypto_decrypt_rtcp(struct crypto_context *c, struct rtcp_packet *rtcp, INLINE int crypto_decrypt_rtcp(struct crypto_context *c, struct rtcp_packet *rtcp,
str *payload, u_int64_t index) str *payload, uint64_t index)
{ {
return c->params.crypto_suite->decrypt_rtcp(c, rtcp, payload, index); return c->params.crypto_suite->decrypt_rtcp(c, rtcp, payload, index);
} }

@ -93,12 +93,12 @@ struct ice_candidate_pair {
const struct local_intf *local_intf; const struct local_intf *local_intf;
struct stream_fd *sfd; struct stream_fd *sfd;
volatile unsigned int pair_flags; volatile unsigned int pair_flags;
u_int32_t stun_transaction[3]; /* belongs to transaction_hash, thus agent->lock */ uint32_t stun_transaction[3]; /* belongs to transaction_hash, thus agent->lock */
unsigned int retransmit_ms; unsigned int retransmit_ms;
struct timeval retransmit; struct timeval retransmit;
unsigned int retransmits; unsigned int retransmits;
struct ice_agent *agent; struct ice_agent *agent;
u_int64_t pair_priority; uint64_t pair_priority;
unsigned int was_controlling:1, unsigned int was_controlling:1,
was_nominated:1; was_nominated:1;
}; };
@ -199,16 +199,16 @@ INLINE unsigned int ice_type_preference(enum ice_candidate_type type) {
return ice_type_preferences[type]; return ice_type_preferences[type];
} }
/* local_pref starts with 0 */ /* local_pref starts with 0 */
INLINE u_int32_t ice_priority_pref(unsigned int type_pref, unsigned int local_pref, unsigned int component) { INLINE uint32_t ice_priority_pref(unsigned int type_pref, unsigned int local_pref, unsigned int component) {
return type_pref << 24 | (65535 - local_pref) << 8 | (256 - component); return type_pref << 24 | (65535 - local_pref) << 8 | (256 - component);
} }
INLINE u_int32_t ice_priority(enum ice_candidate_type type, unsigned int local_pref, unsigned int component) { INLINE uint32_t ice_priority(enum ice_candidate_type type, unsigned int local_pref, unsigned int component) {
return ice_priority_pref(ice_type_preference(type), local_pref, component); return ice_priority_pref(ice_type_preference(type), local_pref, component);
} }
INLINE unsigned int ice_type_pref_from_prio(u_int32_t prio) { INLINE unsigned int ice_type_pref_from_prio(uint32_t prio) {
return (prio & 0xff000000) >> 24; return (prio & 0xff000000) >> 24;
} }
INLINE unsigned int ice_local_pref_from_prio(u_int32_t prio) { INLINE unsigned int ice_local_pref_from_prio(uint32_t prio) {
return 65535 - ((prio & 0xffff00) >> 8); return 65535 - ((prio & 0xffff00) >> 8);
} }
INLINE const char *ice_candidate_type_str(enum ice_candidate_type type) { INLINE const char *ice_candidate_type_str(enum ice_candidate_type type) {

@ -25,7 +25,7 @@
struct obj { struct obj {
#if OBJ_DEBUG #if OBJ_DEBUG
u_int32_t magic; uint32_t magic;
char *type; char *type;
#endif #endif
volatile gint ref; volatile gint ref;

@ -49,12 +49,12 @@ struct ssrc_ctx {
void *ref; // points to the call_monologue but is opaque void *ref; // points to the call_monologue but is opaque
// XXX lock this? // XXX lock this?
u_int64_t srtp_index, uint64_t srtp_index,
srtcp_index; srtcp_index;
// XXX move entire crypto context in here? // XXX move entire crypto context in here?
// for transcoding // for transcoding
u_int32_t ssrc_map_out; uint32_t ssrc_map_out;
// RTCP stats // RTCP stats
atomic64 packets, atomic64 packets,
@ -69,17 +69,17 @@ struct ssrc_ctx {
struct ssrc_stats_block { struct ssrc_stats_block {
struct timeval reported; struct timeval reported;
u_int64_t jitter; // ms uint64_t jitter; // ms
u_int64_t rtt; // us - combined from both sides uint64_t rtt; // us - combined from both sides
u_int32_t rtt_leg; // RTT only for the leg receiving the RTCP report uint32_t rtt_leg; // RTT only for the leg receiving the RTCP report
u_int64_t packetloss; // percent uint64_t packetloss; // percent
u_int64_t mos; // nominal range of 10 - 50 for MOS values 1.0 to 5.0 uint64_t mos; // nominal range of 10 - 50 for MOS values 1.0 to 5.0
}; };
struct ssrc_entry { struct ssrc_entry {
struct obj obj; struct obj obj;
mutex_t lock; mutex_t lock;
u_int32_t ssrc; uint32_t ssrc;
time_t last_used; time_t last_used;
}; };
@ -112,16 +112,16 @@ enum ssrc_dir { // these values must not be used externally
struct ssrc_time_item { struct ssrc_time_item {
struct timeval received; struct timeval received;
u_int32_t ntp_middle_bits; // to match up with lsr/dlrr uint32_t ntp_middle_bits; // to match up with lsr/dlrr
double ntp_ts; // XXX convert to int? double ntp_ts; // XXX convert to int?
}; };
struct ssrc_sender_report { struct ssrc_sender_report {
u_int32_t ssrc; uint32_t ssrc;
u_int32_t ntp_msw; uint32_t ntp_msw;
u_int32_t ntp_lsw; uint32_t ntp_lsw;
u_int32_t timestamp; uint32_t timestamp;
u_int32_t packet_count; uint32_t packet_count;
u_int32_t octet_count; uint32_t octet_count;
}; };
struct ssrc_sender_report_item { struct ssrc_sender_report_item {
struct ssrc_time_item time_item; // must be first; struct ssrc_time_item time_item; // must be first;
@ -129,14 +129,14 @@ struct ssrc_sender_report_item {
}; };
struct ssrc_receiver_report { struct ssrc_receiver_report {
u_int32_t from; uint32_t from;
u_int32_t ssrc; uint32_t ssrc;
unsigned char fraction_lost; unsigned char fraction_lost;
u_int32_t packets_lost; uint32_t packets_lost;
u_int32_t high_seq_received; uint32_t high_seq_received;
u_int32_t jitter; uint32_t jitter;
u_int32_t lsr; uint32_t lsr;
u_int32_t dlsr; uint32_t dlsr;
}; };
//struct ssrc_receiver_report_item { //struct ssrc_receiver_report_item {
// struct timeval received; // struct timeval received;
@ -144,44 +144,44 @@ struct ssrc_receiver_report {
//}; //};
struct ssrc_xr_rr_time { struct ssrc_xr_rr_time {
u_int32_t ssrc; uint32_t ssrc;
u_int32_t ntp_msw; uint32_t ntp_msw;
u_int32_t ntp_lsw; uint32_t ntp_lsw;
}; };
struct ssrc_rr_time_item { struct ssrc_rr_time_item {
struct ssrc_time_item time_item; // must be first; struct ssrc_time_item time_item; // must be first;
}; };
struct ssrc_xr_dlrr { struct ssrc_xr_dlrr {
u_int32_t from; uint32_t from;
u_int32_t ssrc; uint32_t ssrc;
u_int32_t lrr; uint32_t lrr;
u_int32_t dlrr; uint32_t dlrr;
}; };
struct ssrc_xr_voip_metrics { struct ssrc_xr_voip_metrics {
u_int32_t from; uint32_t from;
u_int32_t ssrc; uint32_t ssrc;
u_int8_t loss_rate; uint8_t loss_rate;
u_int8_t discard_rate; uint8_t discard_rate;
u_int8_t burst_den; uint8_t burst_den;
u_int8_t gap_den; uint8_t gap_den;
u_int16_t burst_dur; uint16_t burst_dur;
u_int16_t gap_dur; uint16_t gap_dur;
u_int16_t rnd_trip_delay; uint16_t rnd_trip_delay;
u_int16_t end_sys_delay; uint16_t end_sys_delay;
u_int8_t signal_lvl; uint8_t signal_lvl;
u_int8_t noise_lvl; uint8_t noise_lvl;
u_int8_t rerl; uint8_t rerl;
u_int8_t gmin; uint8_t gmin;
u_int8_t r_factor; uint8_t r_factor;
u_int8_t ext_r_factor; uint8_t ext_r_factor;
u_int8_t mos_lq; uint8_t mos_lq;
u_int8_t mos_cq; uint8_t mos_cq;
u_int8_t rx_config; uint8_t rx_config;
u_int16_t jb_nom; uint16_t jb_nom;
u_int16_t jb_max; uint16_t jb_max;
u_int16_t jb_abs_max; uint16_t jb_abs_max;
}; };
@ -193,9 +193,9 @@ struct ssrc_hash *create_ssrc_hash_full(ssrc_create_func_t, void *uptr);
struct ssrc_hash *create_ssrc_hash_call(void); struct ssrc_hash *create_ssrc_hash_call(void);
void *get_ssrc(u_int32_t, struct ssrc_hash * /* , int *created */); // creates new entry if not found void *get_ssrc(uint32_t, struct ssrc_hash * /* , int *created */); // creates new entry if not found
struct ssrc_ctx *get_ssrc_ctx(u_int32_t, struct ssrc_hash *, enum ssrc_dir, void *ref); // creates new entry if not found struct ssrc_ctx *get_ssrc_ctx(uint32_t, struct ssrc_hash *, enum ssrc_dir, void *ref); // creates new entry if not found
void ssrc_sender_report(struct call_media *, const struct ssrc_sender_report *, const struct timeval *); void ssrc_sender_report(struct call_media *, const struct ssrc_sender_report *, const struct timeval *);

@ -11,10 +11,10 @@ struct stats {
atomic64 packets; atomic64 packets;
atomic64 bytes; atomic64 bytes;
atomic64 errors; atomic64 errors;
u_int64_t delay_min; uint64_t delay_min;
u_int64_t delay_avg; uint64_t delay_avg;
u_int64_t delay_max; uint64_t delay_max;
u_int8_t in_tos_tclass; /* XXX shouldn't be here - not stats */ uint8_t in_tos_tclass; /* XXX shouldn't be here - not stats */
atomic64 foreign_sessions; // unresponsible via redis notification atomic64 foreign_sessions; // unresponsible via redis notification
atomic64 offers; atomic64 offers;
atomic64 answers; atomic64 answers;
@ -28,16 +28,16 @@ struct stats {
struct request_time { struct request_time {
mutex_t lock; mutex_t lock;
u_int64_t count; uint64_t count;
struct timeval time_min, time_max, time_avg; struct timeval time_min, time_max, time_avg;
}; };
struct requests_ps { struct requests_ps {
mutex_t lock; mutex_t lock;
u_int64_t count; uint64_t count;
u_int64_t ps_min; uint64_t ps_min;
u_int64_t ps_max; uint64_t ps_max;
u_int64_t ps_avg; uint64_t ps_avg;
}; };
@ -57,17 +57,17 @@ struct totalstats {
atomic64 total_nopacket_relayed_sess; atomic64 total_nopacket_relayed_sess;
atomic64 total_oneway_stream_sess; atomic64 total_oneway_stream_sess;
u_int64_t foreign_sessions; uint64_t foreign_sessions;
u_int64_t own_sessions; uint64_t own_sessions;
u_int64_t total_sessions; uint64_t total_sessions;
mutex_t total_average_lock; /* for these two below */ mutex_t total_average_lock; /* for these two below */
u_int64_t total_managed_sess; uint64_t total_managed_sess;
struct timeval total_average_call_dur; struct timeval total_average_call_dur;
mutex_t managed_sess_lock; /* for these below */ mutex_t managed_sess_lock; /* for these below */
u_int64_t managed_sess_max; /* per graphite interval statistic */ uint64_t managed_sess_max; /* per graphite interval statistic */
u_int64_t managed_sess_min; /* per graphite interval statistic */ uint64_t managed_sess_min; /* per graphite interval statistic */
mutex_t total_calls_duration_lock; /* for these two below */ mutex_t total_calls_duration_lock; /* for these two below */
struct timeval total_calls_duration_interval; struct timeval total_calls_duration_interval;

@ -19,10 +19,10 @@ struct stun_attrs {
str username; str username;
char *msg_integrity_attr; char *msg_integrity_attr;
str msg_integrity; str msg_integrity;
u_int32_t priority; uint32_t priority;
char *fingerprint_attr; char *fingerprint_attr;
u_int32_t fingerprint; uint32_t fingerprint;
u_int64_t tiebreaker; uint64_t tiebreaker;
endpoint_t mapped; endpoint_t mapped;
unsigned int error_code; unsigned int error_code;
unsigned int use:1, unsigned int use:1,
@ -33,7 +33,7 @@ struct stun_attrs {
INLINE int is_stun(const str *s) { INLINE int is_stun(const str *s) {
const unsigned char *b = (const void *) s->s; const unsigned char *b = (const void *) s->s;
const u_int32_t *u; const uint32_t *u;
if (s->len < 20) if (s->len < 20)
return 0; return 0;
@ -51,8 +51,8 @@ INLINE int is_stun(const str *s) {
int stun(const str *, struct stream_fd *, const endpoint_t *); int stun(const str *, struct stream_fd *, const endpoint_t *);
int stun_binding_request(const endpoint_t *dst, u_int32_t transaction[3], str *pwd, int stun_binding_request(const endpoint_t *dst, uint32_t transaction[3], str *pwd,
str ufrags[2], int controlling, u_int64_t tiebreaker, u_int32_t priority, str ufrags[2], int controlling, uint64_t tiebreaker, uint32_t priority,
socket_t *, int); socket_t *, int);
#endif #endif

@ -239,13 +239,13 @@ static int is_valid_address(const struct re_address *rea);
static int aes_f8_session_key_init(struct re_crypto_context *, struct rtpengine_srtp *); static int aes_f8_session_key_init(struct re_crypto_context *, struct rtpengine_srtp *);
static int srtp_encrypt_aes_cm(struct re_crypto_context *, struct rtpengine_srtp *, static int srtp_encrypt_aes_cm(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
static int srtp_encrypt_aes_f8(struct re_crypto_context *, struct rtpengine_srtp *, static int srtp_encrypt_aes_f8(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
static int srtp_encrypt_aes_gcm(struct re_crypto_context *, struct rtpengine_srtp *, static int srtp_encrypt_aes_gcm(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
static int srtp_decrypt_aes_gcm(struct re_crypto_context *, struct rtpengine_srtp *, static int srtp_decrypt_aes_gcm(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
static void call_put(struct re_call *call); static void call_put(struct re_call *call);
static void del_stream(struct re_stream *stream, struct rtpengine_table *); static void del_stream(struct re_stream *stream, struct rtpengine_table *);
@ -264,7 +264,7 @@ struct re_crypto_context {
unsigned char session_key[32]; unsigned char session_key[32];
unsigned char session_salt[14]; unsigned char session_salt[14];
unsigned char session_auth_key[20]; unsigned char session_auth_key[20];
u_int32_t roc; uint32_t roc;
struct crypto_cipher *tfm[2]; struct crypto_cipher *tfm[2];
struct crypto_shash *shash; struct crypto_shash *shash;
struct crypto_aead *aead; struct crypto_aead *aead;
@ -276,9 +276,9 @@ struct rtpengine_stats_a {
atomic64_t packets; atomic64_t packets;
atomic64_t bytes; atomic64_t bytes;
atomic64_t errors; atomic64_t errors;
u_int64_t delay_min; uint64_t delay_min;
u_int64_t delay_avg; uint64_t delay_avg;
u_int64_t delay_max; uint64_t delay_max;
atomic_t in_tos; atomic_t in_tos;
}; };
struct rtpengine_rtp_stats_a { struct rtpengine_rtp_stats_a {
@ -287,7 +287,7 @@ struct rtpengine_rtp_stats_a {
}; };
struct rtpengine_target { struct rtpengine_target {
atomic_t refcnt; atomic_t refcnt;
u_int32_t table; uint32_t table;
struct rtpengine_target_info target; struct rtpengine_target_info target;
struct rtpengine_stats_a stats; struct rtpengine_stats_a stats;
@ -406,9 +406,9 @@ struct re_cipher {
const char *tfm_name; const char *tfm_name;
const char *aead_name; const char *aead_name;
int (*decrypt)(struct re_crypto_context *, struct rtpengine_srtp *, int (*decrypt)(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
int (*encrypt)(struct re_crypto_context *, struct rtpengine_srtp *, int (*encrypt)(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t); struct rtp_parsed *, uint64_t);
int (*session_key_init)(struct re_crypto_context *, struct rtpengine_srtp *); int (*session_key_init)(struct re_crypto_context *, struct rtpengine_srtp *);
}; };
@ -422,14 +422,14 @@ struct re_hmac {
struct rtp_header { struct rtp_header {
unsigned char v_p_x_cc; unsigned char v_p_x_cc;
unsigned char m_pt; unsigned char m_pt;
u_int16_t seq_num; uint16_t seq_num;
u_int32_t timestamp; uint32_t timestamp;
u_int32_t ssrc; uint32_t ssrc;
u_int32_t csrc[]; uint32_t csrc[];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct rtp_extension { struct rtp_extension {
u_int16_t undefined; uint16_t undefined;
u_int16_t length; uint16_t length;
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -760,7 +760,7 @@ static inline struct proc_dir_entry *proc_create_user(const char *name, umode_t
static int table_create_proc(struct rtpengine_table *t, u_int32_t id) { static int table_create_proc(struct rtpengine_table *t, uint32_t id) {
char num[10]; char num[10];
sprintf(num, "%u", id); sprintf(num, "%u", id);
@ -800,7 +800,7 @@ static int table_create_proc(struct rtpengine_table *t, u_int32_t id) {
static struct rtpengine_table *new_table_link(u_int32_t id) { static struct rtpengine_table *new_table_link(uint32_t id) {
struct rtpengine_table *t; struct rtpengine_table *t;
unsigned long flags; unsigned long flags;
@ -1100,7 +1100,7 @@ static ssize_t proc_status(struct file *f, char __user *b, size_t l, loff_t *o)
struct rtpengine_table *t; struct rtpengine_table *t;
int len = 0; int len = 0;
unsigned long flags; unsigned long flags;
u_int32_t id; uint32_t id;
if (*o > 0) if (*o > 0)
return 0; return 0;
@ -1110,7 +1110,7 @@ static ssize_t proc_status(struct file *f, char __user *b, size_t l, loff_t *o)
return -EINVAL; return -EINVAL;
inode = f->f_path.dentry->d_inode; inode = f->f_path.dentry->d_inode;
id = (u_int32_t) (unsigned long) PDE_DATA(inode); id = (uint32_t) (unsigned long) PDE_DATA(inode);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
@ -1155,7 +1155,7 @@ static void proc_main_list_stop(struct seq_file *f, void *v) {
static void *proc_main_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is invalid */ static void *proc_main_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is invalid */
struct rtpengine_table *t = NULL; struct rtpengine_table *t = NULL;
u_int32_t id; uint32_t id;
if (*o < 0) if (*o < 0)
return NULL; return NULL;
@ -1326,14 +1326,14 @@ next_rda:
static int proc_blist_open(struct inode *i, struct file *f) { static int proc_blist_open(struct inode *i, struct file *f) {
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
int err; int err;
if ((err = proc_generic_open_modref(i, f))) if ((err = proc_generic_open_modref(i, f)))
return err; return err;
id = (u_int32_t) (unsigned long) PDE_DATA(i); id = (uint32_t) (unsigned long) PDE_DATA(i);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
@ -1344,10 +1344,10 @@ static int proc_blist_open(struct inode *i, struct file *f) {
} }
static int proc_blist_close(struct inode *i, struct file *f) { static int proc_blist_close(struct inode *i, struct file *f) {
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
id = (u_int32_t) (unsigned long) PDE_DATA(i); id = (uint32_t) (unsigned long) PDE_DATA(i);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return 0; return 0;
@ -1361,7 +1361,7 @@ static int proc_blist_close(struct inode *i, struct file *f) {
static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t *o) { static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t *o) {
struct inode *inode; struct inode *inode;
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
struct rtpengine_list_entry *opp; struct rtpengine_list_entry *opp;
int err, port, addr_bucket, i; int err, port, addr_bucket, i;
@ -1374,7 +1374,7 @@ static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t
return -EINVAL; return -EINVAL;
inode = f->f_path.dentry->d_inode; inode = f->f_path.dentry->d_inode;
id = (u_int32_t) (unsigned long) PDE_DATA(inode); id = (uint32_t) (unsigned long) PDE_DATA(inode);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
@ -1433,13 +1433,13 @@ err:
static int proc_list_open(struct inode *i, struct file *f) { static int proc_list_open(struct inode *i, struct file *f) {
int err; int err;
struct seq_file *p; struct seq_file *p;
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
if ((err = proc_generic_open_modref(i, f))) if ((err = proc_generic_open_modref(i, f)))
return err; return err;
id = (u_int32_t) (unsigned long) PDE_DATA(i); id = (uint32_t) (unsigned long) PDE_DATA(i);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
@ -1466,7 +1466,7 @@ static void proc_list_stop(struct seq_file *f, void *v) {
} }
static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) { static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) {
u_int32_t id = (u_int32_t) (unsigned long) f->private; uint32_t id = (uint32_t) (unsigned long) f->private;
struct rtpengine_table *t; struct rtpengine_table *t;
struct rtpengine_target *g; struct rtpengine_target *g;
int port, addr_bucket; int port, addr_bucket;
@ -1624,7 +1624,7 @@ static int proc_list_show(struct seq_file *f, void *v) {
static unsigned int re_address_hash(const struct re_address *a) { static unsigned int re_address_hash(const struct re_address *a) {
u_int32_t ret = 0; uint32_t ret = 0;
if (!a) if (!a)
goto out; goto out;
@ -1830,7 +1830,7 @@ static void aes_ctr(unsigned char *out, const unsigned char *in, int in_len,
unsigned char *p, *q; unsigned char *p, *q;
unsigned int left; unsigned int left;
int i; int i;
u_int64_t *pi, *qi, *ki; uint64_t *pi, *qi, *ki;
if (!tfm) if (!tfm)
return; return;
@ -1879,10 +1879,10 @@ static void aes_f8(unsigned char *in_out, int in_len,
ivx[16], /* IV' */ ivx[16], /* IV' */
x[16]; x[16];
int i, left; int i, left;
u_int32_t j; uint32_t j;
unsigned char *p; unsigned char *p;
u_int64_t *pi, *ki, *lki, *xi; uint64_t *pi, *ki, *lki, *xi;
u_int32_t *xu; uint32_t *xu;
crypto_cipher_encrypt_one(iv_tfm, ivx, iv); crypto_cipher_encrypt_one(iv_tfm, ivx, iv);
@ -2402,7 +2402,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf
return -EINVAL; return -EINVAL;
if (id >= MAX_ID) if (id >= MAX_ID)
return -EINVAL; return -EINVAL;
t = new_table_link((u_int32_t) id); t = new_table_link((uint32_t) id);
if (!t) if (!t)
return -EEXIST; return -EEXIST;
table_put(t); table_put(t);
@ -2414,7 +2414,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf
return -EINVAL; return -EINVAL;
if (id >= MAX_ID) if (id >= MAX_ID)
return -EINVAL; return -EINVAL;
t = get_table((u_int32_t) id); t = get_table((uint32_t) id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
err = unlink_table(t); err = unlink_table(t);
@ -2434,7 +2434,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf
static int proc_control_open(struct inode *inode, struct file *file) { static int proc_control_open(struct inode *inode, struct file *file) {
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
unsigned long flags; unsigned long flags;
int err; int err;
@ -2442,7 +2442,7 @@ static int proc_control_open(struct inode *inode, struct file *file) {
if ((err = proc_generic_open_modref(inode, file))) if ((err = proc_generic_open_modref(inode, file)))
return err; return err;
id = (u_int32_t) (unsigned long) PDE_DATA(inode); id = (uint32_t) (unsigned long) PDE_DATA(inode);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
@ -2461,11 +2461,11 @@ static int proc_control_open(struct inode *inode, struct file *file) {
} }
static int proc_control_close(struct inode *inode, struct file *file) { static int proc_control_close(struct inode *inode, struct file *file) {
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
unsigned long flags; unsigned long flags;
id = (u_int32_t) (unsigned long) PDE_DATA(inode); id = (uint32_t) (unsigned long) PDE_DATA(inode);
t = get_table(id); t = get_table(id);
if (!t) if (!t)
return 0; return 0;
@ -3271,7 +3271,7 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub
int writeable) int writeable)
{ {
struct inode *inode; struct inode *inode;
u_int32_t id; uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
struct rtpengine_message msgbuf; struct rtpengine_message msgbuf;
struct rtpengine_message *msg; struct rtpengine_message *msg;
@ -3288,7 +3288,7 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub
} }
inode = file->f_path.dentry->d_inode; inode = file->f_path.dentry->d_inode;
id = (u_int32_t) (unsigned long) PDE_DATA(inode); id = (uint32_t) (unsigned long) PDE_DATA(inode);
t = get_table(id); t = get_table(id);
err = -ENOENT; err = -ENOENT;
if (!t) if (!t)
@ -3649,15 +3649,15 @@ error:
} }
/* XXX shared code */ /* XXX shared code */
static u_int64_t packet_index(struct re_crypto_context *c, static uint64_t packet_index(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_header *rtp) struct rtpengine_srtp *s, struct rtp_header *rtp)
{ {
u_int16_t seq; uint16_t seq;
u_int64_t index; uint64_t index;
unsigned long flags; unsigned long flags;
u_int16_t s_l; uint16_t s_l;
u_int32_t roc; uint32_t roc;
u_int32_t v; uint32_t v;
seq = ntohs(rtp->seq_num); seq = ntohs(rtp->seq_num);
@ -3694,7 +3694,7 @@ static u_int64_t packet_index(struct re_crypto_context *c,
} }
static void update_packet_index(struct re_crypto_context *c, static void update_packet_index(struct re_crypto_context *c,
struct rtpengine_srtp *s, u_int64_t idx) struct rtpengine_srtp *s, uint64_t idx)
{ {
unsigned long flags; unsigned long flags;
@ -3707,9 +3707,9 @@ static void update_packet_index(struct re_crypto_context *c,
static int srtp_hash(unsigned char *hmac, static int srtp_hash(unsigned char *hmac,
struct re_crypto_context *c, struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
u_int32_t roc; uint32_t roc;
struct shash_desc *dsc; struct shash_desc *dsc;
size_t alloc_size; size_t alloc_size;
@ -3764,7 +3764,7 @@ static void rtp_append_mki(struct rtp_parsed *r, struct rtpengine_srtp *c) {
static int srtp_authenticate(struct re_crypto_context *c, static int srtp_authenticate(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
unsigned char hmac[20]; unsigned char hmac[20];
@ -3792,11 +3792,11 @@ static int srtp_authenticate(struct re_crypto_context *c,
static int srtp_auth_validate(struct re_crypto_context *c, static int srtp_auth_validate(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t *pkt_idx_p) uint64_t *pkt_idx_p)
{ {
unsigned char *auth_tag; unsigned char *auth_tag;
unsigned char hmac[20]; unsigned char hmac[20];
u_int64_t pkt_idx = *pkt_idx_p; uint64_t pkt_idx = *pkt_idx_p;
if (s->hmac == REH_NULL) if (s->hmac == REH_NULL)
return 0; return 0;
@ -3863,11 +3863,11 @@ ok:
/* XXX shared code */ /* XXX shared code */
static int srtp_encrypt_aes_cm(struct re_crypto_context *c, static int srtp_encrypt_aes_cm(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
unsigned char iv[16]; unsigned char iv[16];
u_int32_t *ivi; uint32_t *ivi;
u_int32_t idxh, idxl; uint32_t idxh, idxl;
memcpy(iv, c->session_salt, 14); memcpy(iv, c->session_salt, 14);
iv[14] = iv[15] = '\0'; iv[14] = iv[15] = '\0';
@ -3887,10 +3887,10 @@ static int srtp_encrypt_aes_cm(struct re_crypto_context *c,
static int srtp_encrypt_aes_f8(struct re_crypto_context *c, static int srtp_encrypt_aes_f8(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
unsigned char iv[16]; unsigned char iv[16];
u_int32_t roc; uint32_t roc;
iv[0] = 0; iv[0] = 0;
memcpy(&iv[1], &r->header->m_pt, 11); memcpy(&iv[1], &r->header->m_pt, 11);
@ -3904,7 +3904,7 @@ static int srtp_encrypt_aes_f8(struct re_crypto_context *c,
static int srtp_encrypt_aes_gcm(struct re_crypto_context *c, static int srtp_encrypt_aes_gcm(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
unsigned char iv[12]; unsigned char iv[12];
@ -3917,9 +3917,9 @@ static int srtp_encrypt_aes_gcm(struct re_crypto_context *c,
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->header->ssrc; *(uint32_t*)(iv+2) ^= r->header->ssrc;
*(u_int32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); *(uint32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16);
*(u_int16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); *(uint16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL);
req = aead_request_alloc(c->aead, GFP_ATOMIC); req = aead_request_alloc(c->aead, GFP_ATOMIC);
if (!req) if (!req)
@ -3953,7 +3953,7 @@ static int srtp_encrypt_aes_gcm(struct re_crypto_context *c,
} }
static int srtp_decrypt_aes_gcm(struct re_crypto_context *c, static int srtp_decrypt_aes_gcm(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
unsigned char iv[12]; unsigned char iv[12];
@ -3968,9 +3968,9 @@ static int srtp_decrypt_aes_gcm(struct re_crypto_context *c,
memcpy(iv, c->session_salt, 12); memcpy(iv, c->session_salt, 12);
*(u_int32_t*)(iv+2) ^= r->header->ssrc; *(uint32_t*)(iv+2) ^= r->header->ssrc;
*(u_int32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); *(uint32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16);
*(u_int16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); *(uint16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL);
req = aead_request_alloc(c->aead, GFP_ATOMIC); req = aead_request_alloc(c->aead, GFP_ATOMIC);
if (!req) if (!req)
@ -4005,7 +4005,7 @@ static int srtp_decrypt_aes_gcm(struct re_crypto_context *c,
static inline int srtp_encrypt(struct re_crypto_context *c, static inline int srtp_encrypt(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
if (!r->header) if (!r->header)
return 0; return 0;
@ -4016,7 +4016,7 @@ static inline int srtp_encrypt(struct re_crypto_context *c,
static inline int srtp_decrypt(struct re_crypto_context *c, static inline int srtp_decrypt(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r, struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx) uint64_t pkt_idx)
{ {
if (!c->cipher->decrypt) if (!c->cipher->decrypt)
return 0; return 0;
@ -4120,15 +4120,15 @@ static struct sk_buff *intercept_skb_copy(struct sk_buff *oskb, const struct re_
static void rtp_stats(struct rtpengine_target *g, struct rtp_parsed *rtp, s64 arrival_time, int pt_idx) { static void rtp_stats(struct rtpengine_target *g, struct rtp_parsed *rtp, s64 arrival_time, int pt_idx) {
unsigned long flags; unsigned long flags;
struct rtpengine_ssrc_stats *s = &g->ssrc_stats; struct rtpengine_ssrc_stats *s = &g->ssrc_stats;
u_int16_t old_seq_trunc; uint16_t old_seq_trunc;
u_int32_t last_seq; uint32_t last_seq;
u_int16_t seq_diff; uint16_t seq_diff;
u_int32_t clockrate; uint32_t clockrate;
u_int32_t transit; uint32_t transit;
int32_t d; int32_t d;
u_int16_t seq = ntohs(rtp->header->seq_num); uint16_t seq = ntohs(rtp->header->seq_num);
u_int32_t ts = ntohl(rtp->header->timestamp); uint32_t ts = ntohl(rtp->header->timestamp);
spin_lock_irqsave(&g->ssrc_stats_lock, flags); spin_lock_irqsave(&g->ssrc_stats_lock, flags);
@ -4152,7 +4152,7 @@ static void rtp_stats(struct rtpengine_target *g, struct rtp_parsed *rtp, s64 ar
} }
else { else {
// seq wrap? // seq wrap?
u_int32_t new_seq = (last_seq & 0xffff0000) | seq; uint32_t new_seq = (last_seq & 0xffff0000) | seq;
while (new_seq < last_seq) { while (new_seq < last_seq) {
new_seq += 0x10000; new_seq += 0x10000;
if ((new_seq & 0xffff0000) == 0) // ext seq wrapped if ((new_seq & 0xffff0000) == 0) // ext seq wrapped
@ -4200,7 +4200,7 @@ static void rtp_stats(struct rtpengine_target *g, struct rtp_parsed *rtp, s64 ar
static unsigned int rtpengine46(struct sk_buff *skb, struct rtpengine_table *t, struct re_address *src, static unsigned int rtpengine46(struct sk_buff *skb, struct rtpengine_table *t, struct re_address *src,
struct re_address *dst, u_int8_t in_tos, const struct xt_action_param *par) struct re_address *dst, uint8_t in_tos, const struct xt_action_param *par)
{ {
struct udphdr *uh; struct udphdr *uh;
struct rtpengine_target *g; struct rtpengine_target *g;
@ -4209,15 +4209,15 @@ static unsigned int rtpengine46(struct sk_buff *skb, struct rtpengine_table *t,
int error_nf_action = XT_CONTINUE; int error_nf_action = XT_CONTINUE;
int rtp_pt_idx = -2; int rtp_pt_idx = -2;
unsigned int datalen, pllen; unsigned int datalen, pllen;
u_int32_t *u32; uint32_t *u32;
struct rtp_parsed rtp; struct rtp_parsed rtp;
u_int64_t pkt_idx; uint64_t pkt_idx;
struct re_stream *stream; struct re_stream *stream;
struct re_stream_packet *packet; struct re_stream_packet *packet;
const char *errstr = NULL; const char *errstr = NULL;
#if (RE_HAS_MEASUREDELAY) #if (RE_HAS_MEASUREDELAY)
u_int64_t starttime, endtime, delay; uint64_t starttime, endtime, delay;
#endif #endif
skb_reset_transport_header(skb); skb_reset_transport_header(skb);
@ -4462,7 +4462,7 @@ static unsigned int rtpengine4(struct sk_buff *oskb, const struct xt_action_para
dst.family = AF_INET; dst.family = AF_INET;
dst.u.ipv4 = ih->daddr; dst.u.ipv4 = ih->daddr;
return rtpengine46(skb, t, &src, &dst, (u_int8_t)ih->tos, par); return rtpengine46(skb, t, &src, &dst, (uint8_t)ih->tos, par);
skip2: skip2:
kfree_skb(skb); kfree_skb(skb);

@ -12,39 +12,39 @@ struct xt_rtpengine_info {
}; };
struct rtpengine_stats { struct rtpengine_stats {
u_int64_t packets; uint64_t packets;
u_int64_t bytes; uint64_t bytes;
u_int64_t errors; uint64_t errors;
u_int64_t delay_min; uint64_t delay_min;
u_int64_t delay_avg; uint64_t delay_avg;
u_int64_t delay_max; uint64_t delay_max;
u_int8_t in_tos; uint8_t in_tos;
}; };
struct rtpengine_rtp_stats { struct rtpengine_rtp_stats {
u_int64_t packets; uint64_t packets;
u_int64_t bytes; uint64_t bytes;
}; };
struct rtpengine_ssrc_stats { struct rtpengine_ssrc_stats {
struct rtpengine_rtp_stats basic_stats; struct rtpengine_rtp_stats basic_stats;
u_int32_t timestamp; uint32_t timestamp;
u_int32_t ext_seq; uint32_t ext_seq;
u_int32_t lost_bits; // sliding bitfield, [0] = ext_seq uint32_t lost_bits; // sliding bitfield, [0] = ext_seq
u_int32_t total_lost; uint32_t total_lost;
u_int32_t transit; uint32_t transit;
u_int32_t jitter; uint32_t jitter;
}; };
struct re_address { struct re_address {
int family; int family;
union { union {
unsigned char ipv6[16]; unsigned char ipv6[16];
u_int32_t ipv4; uint32_t ipv4;
unsigned char u8[16]; unsigned char u8[16];
u_int16_t u16[8]; uint16_t u16[8];
u_int32_t u32[4]; uint32_t u32[4];
} u; } u;
u_int16_t port; uint16_t port;
}; };
enum rtpengine_cipher { enum rtpengine_cipher {
@ -79,7 +79,7 @@ struct rtpengine_srtp {
unsigned int session_key_len; unsigned int session_key_len;
unsigned int session_salt_len; unsigned int session_salt_len;
unsigned char mki[256]; /* XXX uses too much memory? */ unsigned char mki[256]; /* XXX uses too much memory? */
u_int64_t last_index; uint64_t last_index;
unsigned int auth_tag_len; /* in bytes */ unsigned int auth_tag_len; /* in bytes */
unsigned int mki_len; unsigned int mki_len;
}; };
@ -104,11 +104,11 @@ struct rtpengine_target_info {
struct rtpengine_srtp decrypt; struct rtpengine_srtp decrypt;
struct rtpengine_srtp encrypt; struct rtpengine_srtp encrypt;
u_int32_t ssrc; // Expose the SSRC to userspace when we resync. uint32_t ssrc; // Expose the SSRC to userspace when we resync.
u_int32_t ssrc_out; // Rewrite SSRC uint32_t ssrc_out; // Rewrite SSRC
unsigned char payload_types[NUM_PAYLOAD_TYPES]; /* must be sorted */ unsigned char payload_types[NUM_PAYLOAD_TYPES]; /* must be sorted */
u_int32_t clock_rates[NUM_PAYLOAD_TYPES]; uint32_t clock_rates[NUM_PAYLOAD_TYPES];
unsigned int num_payload_types; unsigned int num_payload_types;
unsigned char tos; unsigned char tos;
@ -142,7 +142,7 @@ struct rtpengine_packet_info {
struct rtpengine_stats_info { struct rtpengine_stats_info {
struct re_address local; // input struct re_address local; // input
u_int32_t ssrc; // output uint32_t ssrc; // output
struct rtpengine_ssrc_stats ssrc_stats; // output struct rtpengine_ssrc_stats ssrc_stats; // output
}; };

@ -367,11 +367,11 @@ int in6_addr_eq(const void *a, const void *b) {
} }
unsigned int uint32_hash(const void *p) { unsigned int uint32_hash(const void *p) {
const u_int32_t *a = p; const uint32_t *a = p;
return *a; return *a;
} }
int uint32_eq(const void *a, const void *b) { int uint32_eq(const void *a, const void *b) {
const u_int32_t *A = a, *B = b; const uint32_t *A = a, *B = b;
return (*A == *B) ? TRUE : FALSE; return (*A == *B) ? TRUE : FALSE;
} }

@ -272,7 +272,7 @@ INLINE void timeval_lowest(struct timeval *l, const struct timeval *n) {
if (!l->tv_sec || timeval_cmp(l, n) == 1) if (!l->tv_sec || timeval_cmp(l, n) == 1)
*l = *n; *l = *n;
} }
INLINE double ntp_ts_to_double(u_int32_t whole, u_int32_t frac) { INLINE double ntp_ts_to_double(uint32_t whole, uint32_t frac) {
return (double) whole + (double) frac / 4294967296.0; return (double) whole + (double) frac / 4294967296.0;
} }

@ -704,7 +704,7 @@ static int __decoder_input_data(decoder_t *dec, const str *data, unsigned long t
} }
else { else {
// shift pts according to rtp ts shift // shift pts according to rtp ts shift
u_int64_t shift_ts = ts - dec->rtp_ts; uint64_t shift_ts = ts - dec->rtp_ts;
if ((shift_ts * 1000) / dec->in_format.clockrate > PACKET_TS_RESET_THRES) { if ((shift_ts * 1000) / dec->in_format.clockrate > PACKET_TS_RESET_THRES) {
ilog(LOG_DEBUG, "Timestamp discontinuity detected, resetting timestamp from " ilog(LOG_DEBUG, "Timestamp discontinuity detected, resetting timestamp from "
"%lu to %lu", "%lu to %lu",
@ -984,7 +984,7 @@ static void *__packet_sequencer_next_packet(packet_sequencer_t *ps, int num_wait
out: out:
; ;
u_int16_t l = packet->seq - ps->seq; uint16_t l = packet->seq - ps->seq;
ps->lost_count += l; ps->lost_count += l;
g_tree_steal(ps->packets, GINT_TO_POINTER(packet->seq)); g_tree_steal(ps->packets, GINT_TO_POINTER(packet->seq));
@ -2150,7 +2150,7 @@ static const char *bcg729_decoder_init(decoder_t *dec, const str *fmtp, const st
static int bcg729_decoder_input(decoder_t *dec, const str *data, GQueue *out) { static int bcg729_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
str input = *data; str input = *data;
u_int64_t pts = dec->pts; uint64_t pts = dec->pts;
while (input.len >= 2) { while (input.len >= 2) {
int frame_len = input.len >= 10 ? 10 : 2; int frame_len = input.len >= 10 ? 10 : 2;

@ -19,12 +19,12 @@ struct rtcp_header {
#error "byte order unknown" #error "byte order unknown"
#endif #endif
unsigned char pt; unsigned char pt;
u_int16_t length; uint16_t length;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct rtcp_packet { struct rtcp_packet {
struct rtcp_header header; struct rtcp_header header;
u_int32_t ssrc; uint32_t ssrc;
} __attribute__ ((packed)); } __attribute__ ((packed));

@ -7,8 +7,8 @@
struct rtp_extension { struct rtp_extension {
u_int16_t undefined; uint16_t undefined;
u_int16_t length; uint16_t length;
} __attribute__ ((packed)); } __attribute__ ((packed));

Loading…
Cancel
Save