diff --git a/daemon/call.c b/daemon/call.c index fcb14ebae..af16640cb 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -488,7 +488,7 @@ destroy: #define DS(x) do { \ - u_int64_t ks_val; \ + uint64_t ks_val; \ ks_val = atomic64_get(&ps->kernel_stats.x); \ if (ke->stats.x < ks_val) \ diff_ ## x = 0; \ @@ -498,7 +498,7 @@ destroy: atomic64_add(&rtpe_statsps.x, diff_ ## x); \ } 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); request->count++; @@ -533,7 +533,7 @@ static void call_timer(void *ptr) { struct rtp_stats *rs; unsigned int pt; endpoint_t ep; - u_int64_t offers, answers, deletes; + uint64_t offers, answers, deletes; struct timeval tv_start; long long run_diff; diff --git a/daemon/codec.c b/daemon/codec.c index 380fc832f..ca6fadf4e 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -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); - 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); if (seq_ret < 0) { // dupe diff --git a/daemon/crypto.c b/daemon/crypto.c index abb812b6a..a67beb2a5 100644 --- a/daemon/crypto.c +++ b/daemon/crypto.c @@ -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_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); -static int aes_gcm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, u_int64_t); -static int aes_gcm_decrypt_rtp(struct crypto_context *, struct rtp_header *, str *, u_int64_t); -static int aes_gcm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); -static int aes_gcm_decrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); -static int hmac_sha1_rtp(struct crypto_context *, char *out, str *in, 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 *, uint64_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 *, uint64_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 *, uint64_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 aes_f8_encrypt_rtp(struct crypto_context *c, struct rtp_header *r, str *s, u_int64_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_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, uint64_t idx); 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_f8_session_key_init(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_rtcp(struct crypto_context *c, struct rtcp_packet *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, uint64_t idx); /* all lengths are in bytes */ 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; int outlen, i; gboolean aligned = TRUE; - u_int64_t *pi, *qi, *ki; + uint64_t *pi, *qi, *ki; if (!ecc) 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 */ -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]; - u_int32_t *ivi; - u_int32_t idxh, idxl; + uint32_t *ivi; + uint32_t idxh, idxl; memcpy(iv, c->session_salt, 14); 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 */ -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); } /* 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); } /* 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]; int len, ciphertext_len; memcpy(iv, c->session_salt, 12); - *(u_int32_t*)(iv+2) ^= r->ssrc; - *(u_int32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); - *(u_int16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); + *(uint32_t*)(iv+2) ^= r->ssrc; + *(uint32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); + *(uint16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, (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; } -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]; 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); - *(u_int32_t*)(iv+2) ^= r->ssrc; - *(u_int32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); - *(u_int16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); + *(uint32_t*)(iv+2) ^= r->ssrc; + *(uint32_t*)(iv+6) ^= htonl((idx & 0x00ffffffff0000ULL) >> 16); + *(uint16_t*)(iv+10) ^= htons(idx & 0x00ffffULL); EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, (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 */ -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 e_idx[4]; int len, ciphertext_len; memcpy(iv, c->session_salt, 12); - *(u_int32_t*)(iv+2) ^= r->ssrc; - *(u_int32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); - *(u_int32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); + *(uint32_t*)(iv+2) ^= r->ssrc; + *(uint32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); + *(uint32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); EVP_EncryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, (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; } -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 e_idx[4]; int len, plaintext_len; memcpy(iv, c->session_salt, 12); - *(u_int32_t*)(iv+2) ^= r->ssrc; - *(u_int32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); - *(u_int32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); + *(uint32_t*)(iv+2) ^= r->ssrc; + *(uint32_t*)(iv+8) ^= htonl(idx & 0x007fffffffULL); + *(uint32_t*)e_idx = htonl( (idx&0x007fffffffULL) | 0x80000000); EVP_DecryptInit_ex(c->session_key_ctx[0], c->params.crypto_suite->aead_evp(), NULL, (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' */ x[16]; int i, outlen, left; - u_int32_t j; + uint32_t j; unsigned char *p; - u_int64_t *pi, *ki, *lki, *xi; - u_int32_t *xu; + uint64_t *pi, *ki, *lki, *xi; + uint32_t *xu; EVP_EncryptUpdate(c->session_key_ctx[1], ivx, &outlen, iv, 16); assert(outlen == 16); @@ -747,9 +747,9 @@ done: } /* 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]; - u_int32_t roc; + uint32_t roc; iv[0] = '\0'; 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 */ -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]; - u_int32_t i; + uint32_t i; memset(iv, 0, 4); i = htonl(0x80000000ULL | idx); @@ -776,9 +776,9 @@ static int aes_f8_encrypt_rtcp(struct crypto_context *c, struct rtcp_packet *r, return 0; } /* 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]; - u_int32_t roc; + uint32_t roc; HMAC_CTX *hc; #if OPENSSL_VERSION_NUMBER >= 0x10100000L @@ -897,10 +897,10 @@ static int evp_session_key_cleanup(struct crypto_context *c) { 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; } -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; } diff --git a/daemon/homer.c b/daemon/homer.c index 71301d0d6..2b5322710 100644 --- a/daemon/homer.c +++ b/daemon/homer.c @@ -242,30 +242,30 @@ out: // from captagent transport_hep.[ch] struct hep_chunk { - u_int16_t vendor_id; - u_int16_t type_id; - u_int16_t length; + uint16_t vendor_id; + uint16_t type_id; + uint16_t length; } __attribute__((packed)); typedef struct hep_chunk hep_chunk_t; struct hep_chunk_uint8 { hep_chunk_t chunk; - u_int8_t data; + uint8_t data; } __attribute__((packed)); typedef struct hep_chunk_uint8 hep_chunk_uint8_t; struct hep_chunk_uint16 { hep_chunk_t chunk; - u_int16_t data; + uint16_t data; } __attribute__((packed)); typedef struct hep_chunk_uint16 hep_chunk_uint16_t; struct hep_chunk_uint32 { hep_chunk_t chunk; - u_int32_t data; + uint32_t data; } __attribute__((packed)); 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 { char id[4]; - u_int16_t length; + uint16_t length; } __attribute__((packed)); typedef struct hep_ctrl hep_ctrl_t; diff --git a/daemon/ice.c b/daemon/ice.c index 72570b104..364e1c388 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -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; @@ -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) { - u_int64_t g, d; + uint64_t g, d; g = ice_priority(ICT_HOST, ifa->unique_id, cand->component_id); d = cand->priority; if (!controlling) { - u_int64_t t = g; + uint64_t t = g; g = d; d = t; } @@ -200,11 +200,11 @@ static int __found_equal(const void *a, const void *b) { && A->component_id == B->component_id; } 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]; } 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]; } 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) { struct stream_fd *sfd = pair->sfd; struct ice_agent *ag = pair->agent; - u_int32_t prio, transact[3]; + uint32_t prio, transact[3]; if (AGENT_ISSET(ag, LITE_SELF)) PAIR_SET(pair, SUCCEEDED); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 5365870cb..51bab5878 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1448,11 +1448,11 @@ noop: // 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) { - u_int32_t in_ssrc = ntohl(ssrc_bs); - u_int32_t out_ssrc; + uint32_t in_ssrc = ntohl(ssrc_bs); + uint32_t out_ssrc; // input direction mutex_lock(&in_srtp->in_lock); diff --git a/daemon/redis.c b/daemon/redis.c index 82a01cfd1..131612e38 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -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 */ static atomic64 strtoa64(const char *c, char **endp, int base) { - u_int64_t u; + uint64_t u; atomic64 ret; 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(int, int, strtol); define_get_int_type(unsigned, unsigned int, strtol); -//define_get_int_type(u16, u_int16_t, strtol); -//define_get_int_type(u64, u_int64_t, strtoull); +//define_get_int_type(u16, uint16_t, strtol); +//define_get_int_type(u64, uint64_t, strtoull); define_get_int_type(a64, atomic64, strtoa64); define_get_type_format(str, str); define_get_type_format(int, int); //define_get_type_format(unsigned, unsigned int); -//define_get_type_format(u16, u_int16_t); -//define_get_type_format(u64, u_int64_t); +//define_get_type_format(u16, uint16_t); +//define_get_type_format(u64, uint64_t); 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, @@ -1697,7 +1697,7 @@ static int json_build_ssrc(struct call *c, JsonReader *root_reader) { if (!json_reader_read_element(root_reader, jidx)) 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); 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"); diff --git a/daemon/rtcp.c b/daemon/rtcp.c index 3b010479b..acf49590c 100644 --- a/daemon/rtcp.c +++ b/daemon/rtcp.c @@ -68,22 +68,22 @@ struct report_block { - u_int32_t ssrc; + uint32_t ssrc; unsigned char fraction_lost; unsigned char number_lost[3]; - u_int32_t high_seq_received; - u_int32_t jitter; - u_int32_t lsr; - u_int32_t dlsr; + uint32_t high_seq_received; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; } __attribute__ ((packed)); struct sender_report_packet { struct rtcp_packet rtcp; - u_int32_t ntp_msw; - u_int32_t ntp_lsw; - u_int32_t timestamp; - u_int32_t packet_count; - u_int32_t octet_count; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t timestamp; + uint32_t packet_count; + uint32_t octet_count; struct report_block reports[0]; } __attribute__ ((packed)); @@ -99,7 +99,7 @@ struct sdes_item { } __attribute__ ((packed)); struct sdes_chunk { - u_int32_t ssrc; + uint32_t ssrc; struct sdes_item items[0]; } __attribute__ ((packed)); @@ -110,7 +110,7 @@ struct source_description_packet { struct bye_packet { struct rtcp_header header; - u_int32_t ssrcs[0]; + uint32_t ssrcs[0]; } __attribute__ ((packed)); struct app_packet { @@ -121,14 +121,14 @@ struct app_packet { struct fb_packet { struct rtcp_packet rtcp; - u_int32_t media_ssrc; + uint32_t media_ssrc; unsigned char information[0]; } __attribute__ ((packed)); struct xr_report_block { - u_int8_t bt; /**< Block type. */ - u_int8_t specific; /**< Block specific data. */ - u_int16_t length; /**< Block length. */ + uint8_t bt; /**< Block type. */ + uint8_t specific; /**< Block specific data. */ + uint16_t length; /**< Block length. */ } __attribute__ ((packed)); struct xr_packet { @@ -138,14 +138,14 @@ struct xr_packet { struct xr_rb_rr_time { struct xr_report_block header; - u_int32_t ntp_msw; /**< NTP time, seconds part. */ - u_int32_t ntp_lsw; /**< NTP time, fractions part. */ + uint32_t ntp_msw; /**< NTP time, seconds part. */ + uint32_t ntp_lsw; /**< NTP time, fractions part. */ } __attribute__ ((packed)); struct xr_rb_dlrr_item { - u_int32_t ssrc; /**< receiver SSRC */ - u_int32_t lrr; /**< last receiver report */ - u_int32_t dlrr; /**< delay since last receiver + uint32_t ssrc; /**< receiver SSRC */ + uint32_t lrr; /**< last receiver report */ + uint32_t dlrr; /**< delay since last receiver report */ } __attribute__ ((packed)); @@ -157,54 +157,54 @@ struct xr_rb_dlrr { struct xr_rb_stats { struct xr_report_block header; - u_int32_t ssrc; /**< Receiver SSRC */ - u_int16_t begin_seq; /**< Begin RTP sequence reported */ - u_int16_t end_seq; /**< End RTP sequence reported */ - u_int32_t lost; /**< Number of packet lost in this + uint32_t ssrc; /**< Receiver SSRC */ + uint16_t begin_seq; /**< Begin RTP sequence reported */ + uint16_t end_seq; /**< End RTP sequence reported */ + uint32_t lost; /**< Number of packet lost in this interval */ - u_int32_t dup; /**< Number of duplicated packet in + uint32_t dup; /**< Number of duplicated packet in this interval */ - u_int32_t jitter_min; /**< Minimum jitter in this interval */ - u_int32_t jitter_max; /**< Maximum jitter in this interval */ - u_int32_t jitter_mean; /**< Average jitter in this interval */ - u_int32_t jitter_dev; /**< Jitter deviation in this + uint32_t jitter_min; /**< Minimum jitter in this interval */ + uint32_t jitter_max; /**< Maximum jitter in this interval */ + uint32_t jitter_mean; /**< Average jitter in this interval */ + uint32_t jitter_dev; /**< Jitter deviation in this interval */ - u_int32_t toh_min:8; /**< Minimum ToH in this interval */ - u_int32_t toh_max:8; /**< Maximum ToH in this interval */ - u_int32_t toh_mean:8; /**< Average ToH in this interval */ - u_int32_t toh_dev:8; /**< ToH deviation in this interval */ + uint32_t toh_min:8; /**< Minimum ToH in this interval */ + uint32_t toh_max:8; /**< Maximum ToH in this interval */ + uint32_t toh_mean:8; /**< Average ToH in this interval */ + uint32_t toh_dev:8; /**< ToH deviation in this interval */ } __attribute__ ((packed)); struct xr_rb_voip_metrics { struct xr_report_block header; - u_int32_t ssrc; /**< Receiver SSRC */ - u_int8_t loss_rate; /**< Packet loss rate */ - u_int8_t discard_rate; /**< Packet discarded rate */ - u_int8_t burst_den; /**< Burst density */ - u_int8_t gap_den; /**< Gap density */ - u_int16_t burst_dur; /**< Burst duration */ - u_int16_t gap_dur; /**< Gap duration */ - u_int16_t rnd_trip_delay;/**< Round trip delay */ - u_int16_t end_sys_delay; /**< End system delay */ - u_int8_t signal_lvl; /**< Signal level */ - u_int8_t noise_lvl; /**< Noise level */ - u_int8_t rerl; /**< Residual Echo Return Loss */ - u_int8_t gmin; /**< The gap threshold */ - u_int8_t r_factor; /**< Voice quality metric carried + uint32_t ssrc; /**< Receiver SSRC */ + uint8_t loss_rate; /**< Packet loss rate */ + uint8_t discard_rate; /**< Packet discarded rate */ + uint8_t burst_den; /**< Burst density */ + uint8_t gap_den; /**< Gap density */ + uint16_t burst_dur; /**< Burst duration */ + uint16_t gap_dur; /**< Gap duration */ + uint16_t rnd_trip_delay;/**< Round trip delay */ + uint16_t end_sys_delay; /**< End system delay */ + uint8_t signal_lvl; /**< Signal level */ + uint8_t noise_lvl; /**< Noise level */ + uint8_t rerl; /**< Residual Echo Return Loss */ + uint8_t gmin; /**< The gap threshold */ + uint8_t r_factor; /**< Voice quality metric carried 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*/ - u_int8_t mos_lq; /**< Mean Opinion Score for + uint8_t mos_lq; /**< Mean Opinion Score for Listening Quality */ - u_int8_t mos_cq; /**< Mean Opinion Score for + uint8_t mos_cq; /**< Mean Opinion Score for Conversation Quality */ - u_int8_t rx_config; /**< Receiver configuration */ - u_int8_t reserved2; /**< Not used */ - u_int16_t jb_nom; /**< Current delay by jitter + uint8_t rx_config; /**< Receiver configuration */ + uint8_t reserved2; /**< Not used */ + uint16_t jb_nom; /**< Current delay by jitter buffer */ - u_int16_t jb_max; /**< Maximum delay by jitter + uint16_t jb_max; /**< Maximum delay by jitter buffer */ - u_int16_t jb_abs_max; /**< Maximum possible delay by + uint16_t jb_abs_max; /**< Maximum possible delay by jitter buffer */ } __attribute__ ((packed)); @@ -238,7 +238,7 @@ struct rtcp_process_ctx { struct ssrc_xr_rr_time xr_rr; struct ssrc_xr_dlrr xr_dlrr; } scratch; - u_int32_t scratch_common_ssrc; + uint32_t scratch_common_ssrc; // RTCP syslog output GString *log; @@ -846,7 +846,7 @@ error: /* rfc 3711 section 3.4 */ int rtcp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { struct rtcp_packet *rtcp; - u_int32_t *idx; + uint32_t *idx; str to_auth, payload; 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) { struct rtcp_packet *rtcp; str payload, to_auth, to_decrypt, auth_tag; - u_int32_t idx, *idx_p; + uint32_t idx, *idx_p; char hmac[20]; const char *err; diff --git a/daemon/rtp.c b/daemon/rtp.c index beef983f2..36bdd9c6a 100644 --- a/daemon/rtp.c +++ b/daemon/rtp.c @@ -45,8 +45,8 @@ error: return -1; } -static u_int64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp) { - u_int16_t seq; +static uint64_t packet_index(struct ssrc_ctx *ssrc_ctx, struct rtp_header *rtp) { + uint16_t seq; 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; /* rfc 3711 appendix A, modified, and sections 3.3 and 3.3.1 */ - u_int16_t s_l = (ssrc_ctx->srtp_index & 0x00000000ffffULL); - u_int32_t roc = (ssrc_ctx->srtp_index & 0xffffffff0000ULL) >> 16; - u_int32_t v = 0; + uint16_t s_l = (ssrc_ctx->srtp_index & 0x00000000ffffULL); + uint32_t roc = (ssrc_ctx->srtp_index & 0xffffffff0000ULL) >> 16; + uint32_t v = 0; crypto_debug_printf(", prev seq %" PRIu64 ", s_l %" PRIu16 ", ROC %" PRIu32, 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; } - 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); @@ -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) { struct rtp_header *rtp; str payload, to_auth; - u_int64_t index; + uint64_t index; if (G_UNLIKELY(!ssrc_ctx)) 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 */ int rtp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) { struct rtp_header *rtp; - u_int64_t index; + uint64_t index; str payload, to_auth, to_decrypt, auth_tag; char hmac[20]; diff --git a/daemon/sdp.c b/daemon/sdp.c index f2a7b15f6..6d5638695 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -116,7 +116,7 @@ struct attribute_crypto { str master_key; str salt; 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 int mki_len; unsigned int unencrypted_srtcp:1, @@ -128,7 +128,7 @@ struct attribute_ssrc { str id_str; str attr_str; - u_int32_t id; + uint32_t id; str attr; str value; }; @@ -461,7 +461,7 @@ static int parse_attribute_crypto(struct sdp_attribute *output) { unsigned int b64_save = 0; gsize ret; str s; - u_int32_t u32; + uint32_t u32; const char *err; output->attr = ATTR_CRYPTO; @@ -2141,7 +2141,7 @@ static void new_priority(struct sdp_media *media, enum ice_candidate_type type, { GQueue *cands; unsigned int lpref, tpref; - u_int32_t prio; + uint32_t prio; GList *l; struct sdp_attribute *a; struct attribute_candidate *c; diff --git a/daemon/ssrc.c b/daemon/ssrc.c index bed21b050..d9bb0a264 100644 --- a/daemon/ssrc.c +++ b/daemon/ssrc.c @@ -16,7 +16,7 @@ static void init_ssrc_ctx(struct ssrc_ctx *c, struct ssrc_entry_call *parent) { while (!c->ssrc_map_out) 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->last_used = rtpe_now.tv_sec; mutex_init(&ent->lock); @@ -30,7 +30,7 @@ static struct ssrc_entry *create_ssrc_entry_call(void *uptr) { //ent->ts_out = ssl_random(); 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); g_hash_table_replace(ht->ht, &ent->ssrc, ent); obj_hold(ent); // HT entry @@ -84,7 +84,7 @@ static void mos_calc(struct ssrc_stats_block *ssb) { 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); struct ssrc_entry *ret = g_atomic_pointer_get(&ht->cache); 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 -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; if (!ht) @@ -207,7 +207,7 @@ struct ssrc_hash *create_ssrc_hash_call(void) { 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 */); if (G_UNLIKELY(!s)) 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, - 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) { 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; } -static long long __calc_rtt(struct call *c, u_int32_t ssrc, u_int32_t ntp_middle_bits, - u_int32_t delay, size_t reports_queue_offset, const struct timeval *tv, int *pt_p) +static long long __calc_rtt(struct call *c, uint32_t ssrc, uint32_t ntp_middle_bits, + uint32_t delay, size_t reports_queue_offset, const struct timeval *tv, int *pt_p) { if (pt_p) *pt_p = -1; diff --git a/daemon/statistics.c b/daemon/statistics.c index c171c0fc7..db439ed0a 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -461,7 +461,7 @@ GQueue *statistics_gather_metrics(void) { GQueue *ret = g_queue_new(); 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 requests_ps offers_ps, answers_ps, deletes_ps; diff --git a/daemon/stun.c b/daemon/stun.c index b96af5551..9d0f37bc6 100644 --- a/daemon/stun.c +++ b/daemon/stun.c @@ -54,15 +54,15 @@ struct header { - u_int16_t msg_type; - u_int16_t msg_len; - u_int32_t cookie; - u_int32_t transaction[3]; + uint16_t msg_type; + uint16_t msg_len; + uint32_t cookie; + uint32_t transaction[3]; } __attribute__ ((packed)); struct tlv { - u_int16_t type; - u_int16_t len; + uint16_t type; + uint16_t len; } __attribute__ ((packed)); struct generic { @@ -71,12 +71,12 @@ struct generic { struct error_code { struct tlv tlv; - u_int32_t codes; + uint32_t codes; } __attribute__ ((packed)); struct fingerprint { struct tlv tlv; - u_int32_t crc; + uint32_t crc; } __attribute__ ((packed)); struct msg_integrity { @@ -86,19 +86,19 @@ struct msg_integrity { struct xor_mapped_address { struct tlv tlv; - u_int16_t family; - u_int16_t port; - u_int32_t address[4]; + uint16_t family; + uint16_t port; + uint32_t address[4]; } __attribute__ ((packed)); struct controlled_ing { struct tlv tlv; - u_int64_t tiebreaker; + uint64_t tiebreaker; } __attribute__ ((packed)); struct priority { struct tlv tlv; - u_int32_t priority; + uint32_t priority; } __attribute__ ((packed)); struct software { @@ -112,7 +112,7 @@ struct software { /* 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; int len, type, uc; str attr; @@ -157,7 +157,7 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns, if (attr.len != 4) return -1; out->fingerprint_attr = (void *) tlv; - out->fingerprint = ntohl(*(u_int32_t *) attr.s); + out->fingerprint = ntohl(*(uint32_t *) attr.s); goto out; case STUN_USE_CANDIDATE: @@ -169,7 +169,7 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns, return -1; if (attr.len != 8) return -1; - out->tiebreaker = be64toh(*((u_int64_t *) attr.s)); + out->tiebreaker = be64toh(*((uint64_t *) attr.s)); out->controlled = 1; break; @@ -178,14 +178,14 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns, return -1; if (attr.len != 8) return -1; - out->tiebreaker = be64toh(*((u_int64_t *) attr.s)); + out->tiebreaker = be64toh(*((uint64_t *) attr.s)); out->controlling = 1; break; case STUN_PRIORITY: if (attr.len != 4) return -1; - out->priority = ntohl(*((u_int32_t *) attr.s)); + out->priority = ntohl(*((uint32_t *) attr.s)); break; 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: if (attr.len < 8) return -1; - out->mapped.port = ntohs(*((u_int16_t *) (&attr.s[2]))) ^ (STUN_COOKIE >> 16); - if (attr.len == 8 && ntohs(*((u_int16_t *) attr.s)) == 1) { + out->mapped.port = ntohs(*((uint16_t *) (&attr.s[2]))) ^ (STUN_COOKIE >> 16); + if (attr.len == 8 && ntohs(*((uint16_t *) attr.s)) == 1) { out->mapped.address.family = get_socket_family_enum(SF_IP4); 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.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] - = *((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] - = *((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] - = *((u_int32_t *) (&attr.s[16])) ^ req->transaction[2]; + = *((uint32_t *) (&attr.s[16])) ^ req->transaction[2]; } break; case STUN_ERROR_CODE: if (attr.len < 4) 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 & 0x0ff); break; @@ -257,7 +257,7 @@ static void output_init(struct msghdr *mh, struct iovec *iov, 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) { 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, 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) { 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) { int len; - u_int32_t crc; + uint32_t crc; len = attrs->fingerprint_attr - msg->s; 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) { - u_int16_t lenX; + uint16_t lenX; char digest[20]; str ufrag[2]; struct iovec iov[3]; @@ -503,7 +503,7 @@ static int stun_binding_success(struct stream_fd *sfd, struct header *req, struc return 0; } -INLINE int u_int16_t_arr_len(u_int16_t *arr) { +INLINE int uint16_t_arr_len(uint16_t *arr) { int 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; str attr_str; struct stun_attrs attrs; - u_int16_t unknowns[UNKNOWNS_COUNT]; + uint16_t unknowns[UNKNOWNS_COUNT]; const char *err; int dst_idx, src_idx; 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); stun_error_attrs(sfd, sin, req, 420, "Unknown attribute", STUN_UNKNOWN_ATTRIBUTES, unknowns, - u_int16_t_arr_len(unknowns) * 2); + uint16_t_arr_len(unknowns) * 2); return 0; } @@ -643,8 +643,8 @@ ignore: return -1; } -int stun_binding_request(const endpoint_t *dst, u_int32_t transaction[3], str *pwd, - str ufrags[2], int controlling, u_int64_t tiebreaker, u_int32_t priority, +int stun_binding_request(const endpoint_t *dst, uint32_t transaction[3], str *pwd, + str ufrags[2], int controlling, uint64_t tiebreaker, uint32_t priority, socket_t *sock, int to_use) { struct header hdr; diff --git a/include/aux.h b/include/aux.h index 56ed518de..99075a0dd 100644 --- a/include/aux.h +++ b/include/aux.h @@ -258,14 +258,14 @@ taint_func(srandom, "use RAND_seed() instead"); #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 IP6F "%x:%x:%x:%x:%x:%x:%x:%x" -#define IP6P(x) ntohs(((u_int16_t *) (x))[0]), \ - ntohs(((u_int16_t *) (x))[1]), \ - ntohs(((u_int16_t *) (x))[2]), \ - ntohs(((u_int16_t *) (x))[3]), \ - ntohs(((u_int16_t *) (x))[4]), \ - ntohs(((u_int16_t *) (x))[5]), \ - ntohs(((u_int16_t *) (x))[6]), \ - ntohs(((u_int16_t *) (x))[7]) +#define IP6P(x) ntohs(((uint16_t *) (x))[0]), \ + ntohs(((uint16_t *) (x))[1]), \ + ntohs(((uint16_t *) (x))[2]), \ + ntohs(((uint16_t *) (x))[3]), \ + ntohs(((uint16_t *) (x))[4]), \ + ntohs(((uint16_t *) (x))[5]), \ + ntohs(((uint16_t *) (x))[6]), \ + ntohs(((uint16_t *) (x))[7]) #define D6F "["IP6F"]:%u" #define D6P(x) IP6P((x).sin6_addr.s6_addr), ntohs((x).sin6_port) #define DF IPF ":%u" @@ -358,26 +358,26 @@ typedef struct { volatile void *p; } atomic64; -INLINE u_int64_t atomic64_get(const atomic64 *u) { - return (u_int64_t) g_atomic_pointer_get(&u->p); +INLINE uint64_t atomic64_get(const atomic64 *u) { + return (uint64_t) g_atomic_pointer_get(&u->p); } -INLINE u_int64_t atomic64_get_na(const atomic64 *u) { - return (u_int64_t) u->p; +INLINE uint64_t atomic64_get_na(const atomic64 *u) { + 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); } -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; } -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); } -INLINE void atomic64_add_na(atomic64 *u, u_int64_t a) { - u->p = (void *) (((u_int64_t) u->p) + a); +INLINE void atomic64_add_na(atomic64 *u, uint64_t a) { + u->p = (void *) (((uint64_t) u->p) + a); } -INLINE u_int64_t atomic64_get_set(atomic64 *u, u_int64_t a) { - u_int64_t old; +INLINE uint64_t atomic64_get_set(atomic64 *u, uint64_t a) { + uint64_t old; do { old = atomic64_get(u); 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. */ typedef struct { - u_int64_t u; + uint64_t u; } atomic64; #define NEED_ATOMIC64_MUTEX extern mutex_t __atomic64_mutex; -INLINE u_int64_t atomic64_get(const atomic64 *u) { - u_int64_t ret; +INLINE uint64_t atomic64_get(const atomic64 *u) { + uint64_t ret; mutex_lock(&__atomic64_mutex); ret = u->u; mutex_unlock(&__atomic64_mutex); return ret; } -INLINE u_int64_t atomic64_get_na(const atomic64 *u) { +INLINE uint64_t atomic64_get_na(const atomic64 *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); u->u = a; 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; } -INLINE void atomic64_add(atomic64 *u, u_int64_t a) { +INLINE void atomic64_add(atomic64 *u, uint64_t a) { mutex_lock(&__atomic64_mutex); u->u += a; 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; } -INLINE u_int64_t atomic64_get_set(atomic64 *u, u_int64_t a) { - u_int64_t old; +INLINE uint64_t atomic64_get_set(atomic64 *u, uint64_t a) { + uint64_t old; mutex_lock(&__atomic64_mutex); old = u->u; u->u = a; diff --git a/include/crypto.h b/include/crypto.h index 05666142b..6c849db86 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -23,9 +23,9 @@ struct crypto_context; struct rtp_header; struct rtcp_packet; -typedef int (*crypto_func_rtp)(struct crypto_context *, struct rtp_header *, str *, u_int64_t); -typedef int (*crypto_func_rtcp)(struct crypto_context *, struct rtcp_packet *, str *, u_int64_t); -typedef int (*hash_func_rtp)(struct crypto_context *, char *out, str *in, 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 *, uint64_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 (*session_key_init_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, - str *payload, u_int64_t index) + str *payload, uint64_t 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, - str *payload, u_int64_t index) + str *payload, uint64_t 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, - str *payload, u_int64_t index) + str *payload, uint64_t 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, - str *payload, u_int64_t index) + str *payload, uint64_t index) { return c->params.crypto_suite->decrypt_rtcp(c, rtcp, payload, index); } diff --git a/include/ice.h b/include/ice.h index 808ff1115..d2a52a4f1 100644 --- a/include/ice.h +++ b/include/ice.h @@ -93,12 +93,12 @@ struct ice_candidate_pair { const struct local_intf *local_intf; struct stream_fd *sfd; 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; struct timeval retransmit; unsigned int retransmits; struct ice_agent *agent; - u_int64_t pair_priority; + uint64_t pair_priority; unsigned int was_controlling:1, was_nominated:1; }; @@ -199,16 +199,16 @@ INLINE unsigned int ice_type_preference(enum ice_candidate_type type) { return ice_type_preferences[type]; } /* 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); } -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); } -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; } -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); } INLINE const char *ice_candidate_type_str(enum ice_candidate_type type) { diff --git a/include/obj.h b/include/obj.h index fcb08745f..57f1d885e 100644 --- a/include/obj.h +++ b/include/obj.h @@ -25,7 +25,7 @@ struct obj { #if OBJ_DEBUG - u_int32_t magic; + uint32_t magic; char *type; #endif volatile gint ref; diff --git a/include/ssrc.h b/include/ssrc.h index e1c4dd741..bd8737b30 100644 --- a/include/ssrc.h +++ b/include/ssrc.h @@ -49,12 +49,12 @@ struct ssrc_ctx { void *ref; // points to the call_monologue but is opaque // XXX lock this? - u_int64_t srtp_index, + uint64_t srtp_index, srtcp_index; // XXX move entire crypto context in here? // for transcoding - u_int32_t ssrc_map_out; + uint32_t ssrc_map_out; // RTCP stats atomic64 packets, @@ -69,17 +69,17 @@ struct ssrc_ctx { struct ssrc_stats_block { struct timeval reported; - u_int64_t jitter; // ms - u_int64_t rtt; // us - combined from both sides - u_int32_t rtt_leg; // RTT only for the leg receiving the RTCP report - u_int64_t packetloss; // percent - u_int64_t mos; // nominal range of 10 - 50 for MOS values 1.0 to 5.0 + uint64_t jitter; // ms + uint64_t rtt; // us - combined from both sides + uint32_t rtt_leg; // RTT only for the leg receiving the RTCP report + uint64_t packetloss; // percent + uint64_t mos; // nominal range of 10 - 50 for MOS values 1.0 to 5.0 }; struct ssrc_entry { struct obj obj; mutex_t lock; - u_int32_t ssrc; + uint32_t ssrc; time_t last_used; }; @@ -112,16 +112,16 @@ enum ssrc_dir { // these values must not be used externally struct ssrc_time_item { 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? }; struct ssrc_sender_report { - u_int32_t ssrc; - u_int32_t ntp_msw; - u_int32_t ntp_lsw; - u_int32_t timestamp; - u_int32_t packet_count; - u_int32_t octet_count; + uint32_t ssrc; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t timestamp; + uint32_t packet_count; + uint32_t octet_count; }; struct ssrc_sender_report_item { struct ssrc_time_item time_item; // must be first; @@ -129,14 +129,14 @@ struct ssrc_sender_report_item { }; struct ssrc_receiver_report { - u_int32_t from; - u_int32_t ssrc; + uint32_t from; + uint32_t ssrc; unsigned char fraction_lost; - u_int32_t packets_lost; - u_int32_t high_seq_received; - u_int32_t jitter; - u_int32_t lsr; - u_int32_t dlsr; + uint32_t packets_lost; + uint32_t high_seq_received; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; }; //struct ssrc_receiver_report_item { // struct timeval received; @@ -144,44 +144,44 @@ struct ssrc_receiver_report { //}; struct ssrc_xr_rr_time { - u_int32_t ssrc; - u_int32_t ntp_msw; - u_int32_t ntp_lsw; + uint32_t ssrc; + uint32_t ntp_msw; + uint32_t ntp_lsw; }; struct ssrc_rr_time_item { struct ssrc_time_item time_item; // must be first; }; struct ssrc_xr_dlrr { - u_int32_t from; - u_int32_t ssrc; - u_int32_t lrr; - u_int32_t dlrr; + uint32_t from; + uint32_t ssrc; + uint32_t lrr; + uint32_t dlrr; }; struct ssrc_xr_voip_metrics { - u_int32_t from; - u_int32_t ssrc; - u_int8_t loss_rate; - u_int8_t discard_rate; - u_int8_t burst_den; - u_int8_t gap_den; - u_int16_t burst_dur; - u_int16_t gap_dur; - u_int16_t rnd_trip_delay; - u_int16_t end_sys_delay; - u_int8_t signal_lvl; - u_int8_t noise_lvl; - u_int8_t rerl; - u_int8_t gmin; - u_int8_t r_factor; - u_int8_t ext_r_factor; - u_int8_t mos_lq; - u_int8_t mos_cq; - u_int8_t rx_config; - u_int16_t jb_nom; - u_int16_t jb_max; - u_int16_t jb_abs_max; + uint32_t from; + uint32_t ssrc; + uint8_t loss_rate; + uint8_t discard_rate; + uint8_t burst_den; + uint8_t gap_den; + uint16_t burst_dur; + uint16_t gap_dur; + uint16_t rnd_trip_delay; + uint16_t end_sys_delay; + uint8_t signal_lvl; + uint8_t noise_lvl; + uint8_t rerl; + uint8_t gmin; + uint8_t r_factor; + uint8_t ext_r_factor; + uint8_t mos_lq; + uint8_t mos_cq; + uint8_t rx_config; + uint16_t jb_nom; + uint16_t jb_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); -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 *); diff --git a/include/statistics.h b/include/statistics.h index 2a54d1c98..25fea176c 100644 --- a/include/statistics.h +++ b/include/statistics.h @@ -11,10 +11,10 @@ struct stats { atomic64 packets; atomic64 bytes; atomic64 errors; - u_int64_t delay_min; - u_int64_t delay_avg; - u_int64_t delay_max; - u_int8_t in_tos_tclass; /* XXX shouldn't be here - not stats */ + uint64_t delay_min; + uint64_t delay_avg; + uint64_t delay_max; + uint8_t in_tos_tclass; /* XXX shouldn't be here - not stats */ atomic64 foreign_sessions; // unresponsible via redis notification atomic64 offers; atomic64 answers; @@ -28,16 +28,16 @@ struct stats { struct request_time { mutex_t lock; - u_int64_t count; + uint64_t count; struct timeval time_min, time_max, time_avg; }; struct requests_ps { mutex_t lock; - u_int64_t count; - u_int64_t ps_min; - u_int64_t ps_max; - u_int64_t ps_avg; + uint64_t count; + uint64_t ps_min; + uint64_t ps_max; + uint64_t ps_avg; }; @@ -57,17 +57,17 @@ struct totalstats { atomic64 total_nopacket_relayed_sess; atomic64 total_oneway_stream_sess; - u_int64_t foreign_sessions; - u_int64_t own_sessions; - u_int64_t total_sessions; + uint64_t foreign_sessions; + uint64_t own_sessions; + uint64_t total_sessions; 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; mutex_t managed_sess_lock; /* for these below */ - u_int64_t managed_sess_max; /* per graphite interval statistic */ - u_int64_t managed_sess_min; /* per graphite interval statistic */ + uint64_t managed_sess_max; /* per graphite interval statistic */ + uint64_t managed_sess_min; /* per graphite interval statistic */ mutex_t total_calls_duration_lock; /* for these two below */ struct timeval total_calls_duration_interval; diff --git a/include/stun.h b/include/stun.h index f80a3aab9..eed7e133e 100644 --- a/include/stun.h +++ b/include/stun.h @@ -19,10 +19,10 @@ struct stun_attrs { str username; char *msg_integrity_attr; str msg_integrity; - u_int32_t priority; + uint32_t priority; char *fingerprint_attr; - u_int32_t fingerprint; - u_int64_t tiebreaker; + uint32_t fingerprint; + uint64_t tiebreaker; endpoint_t mapped; unsigned int error_code; unsigned int use:1, @@ -33,7 +33,7 @@ struct stun_attrs { INLINE int is_stun(const str *s) { const unsigned char *b = (const void *) s->s; - const u_int32_t *u; + const uint32_t *u; if (s->len < 20) 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_binding_request(const endpoint_t *dst, u_int32_t transaction[3], str *pwd, - str ufrags[2], int controlling, u_int64_t tiebreaker, u_int32_t priority, +int stun_binding_request(const endpoint_t *dst, uint32_t transaction[3], str *pwd, + str ufrags[2], int controlling, uint64_t tiebreaker, uint32_t priority, socket_t *, int); #endif diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index cd66d7660..c54cc6a97 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -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 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 *, - struct rtp_parsed *, u_int64_t); + struct rtp_parsed *, uint64_t); 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 *, - struct rtp_parsed *, u_int64_t); + struct rtp_parsed *, uint64_t); static void call_put(struct re_call *call); 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_salt[14]; unsigned char session_auth_key[20]; - u_int32_t roc; + uint32_t roc; struct crypto_cipher *tfm[2]; struct crypto_shash *shash; struct crypto_aead *aead; @@ -276,9 +276,9 @@ struct rtpengine_stats_a { atomic64_t packets; atomic64_t bytes; atomic64_t errors; - u_int64_t delay_min; - u_int64_t delay_avg; - u_int64_t delay_max; + uint64_t delay_min; + uint64_t delay_avg; + uint64_t delay_max; atomic_t in_tos; }; struct rtpengine_rtp_stats_a { @@ -287,7 +287,7 @@ struct rtpengine_rtp_stats_a { }; struct rtpengine_target { atomic_t refcnt; - u_int32_t table; + uint32_t table; struct rtpengine_target_info target; struct rtpengine_stats_a stats; @@ -406,9 +406,9 @@ struct re_cipher { const char *tfm_name; const char *aead_name; 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 *, - struct rtp_parsed *, u_int64_t); + struct rtp_parsed *, uint64_t); int (*session_key_init)(struct re_crypto_context *, struct rtpengine_srtp *); }; @@ -422,14 +422,14 @@ struct re_hmac { struct rtp_header { unsigned char v_p_x_cc; unsigned char m_pt; - u_int16_t seq_num; - u_int32_t timestamp; - u_int32_t ssrc; - u_int32_t csrc[]; + uint16_t seq_num; + uint32_t timestamp; + uint32_t ssrc; + uint32_t csrc[]; } __attribute__ ((packed)); struct rtp_extension { - u_int16_t undefined; - u_int16_t length; + uint16_t undefined; + uint16_t length; } __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]; 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; 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; int len = 0; unsigned long flags; - u_int32_t id; + uint32_t id; if (*o > 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; 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); if (!t) 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 */ struct rtpengine_table *t = NULL; - u_int32_t id; + uint32_t id; if (*o < 0) return NULL; @@ -1326,14 +1326,14 @@ next_rda: static int proc_blist_open(struct inode *i, struct file *f) { - u_int32_t id; + uint32_t id; struct rtpengine_table *t; int err; if ((err = proc_generic_open_modref(i, f))) return err; - id = (u_int32_t) (unsigned long) PDE_DATA(i); + id = (uint32_t) (unsigned long) PDE_DATA(i); t = get_table(id); if (!t) 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) { - u_int32_t id; + uint32_t id; 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); if (!t) 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) { struct inode *inode; - u_int32_t id; + uint32_t id; struct rtpengine_table *t; struct rtpengine_list_entry *opp; 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; 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); if (!t) return -ENOENT; @@ -1433,13 +1433,13 @@ err: static int proc_list_open(struct inode *i, struct file *f) { int err; struct seq_file *p; - u_int32_t id; + uint32_t id; struct rtpengine_table *t; if ((err = proc_generic_open_modref(i, f))) return err; - id = (u_int32_t) (unsigned long) PDE_DATA(i); + id = (uint32_t) (unsigned long) PDE_DATA(i); t = get_table(id); if (!t) 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) { - 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_target *g; 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) { - u_int32_t ret = 0; + uint32_t ret = 0; if (!a) 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 int left; int i; - u_int64_t *pi, *qi, *ki; + uint64_t *pi, *qi, *ki; if (!tfm) return; @@ -1879,10 +1879,10 @@ static void aes_f8(unsigned char *in_out, int in_len, ivx[16], /* IV' */ x[16]; int i, left; - u_int32_t j; + uint32_t j; unsigned char *p; - u_int64_t *pi, *ki, *lki, *xi; - u_int32_t *xu; + uint64_t *pi, *ki, *lki, *xi; + uint32_t *xu; 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; if (id >= MAX_ID) return -EINVAL; - t = new_table_link((u_int32_t) id); + t = new_table_link((uint32_t) id); if (!t) return -EEXIST; table_put(t); @@ -2414,7 +2414,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf return -EINVAL; if (id >= MAX_ID) return -EINVAL; - t = get_table((u_int32_t) id); + t = get_table((uint32_t) id); if (!t) return -ENOENT; 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) { - u_int32_t id; + uint32_t id; struct rtpengine_table *t; unsigned long flags; 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))) return err; - id = (u_int32_t) (unsigned long) PDE_DATA(inode); + id = (uint32_t) (unsigned long) PDE_DATA(inode); t = get_table(id); if (!t) 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) { - u_int32_t id; + uint32_t id; struct rtpengine_table *t; unsigned long flags; - id = (u_int32_t) (unsigned long) PDE_DATA(inode); + id = (uint32_t) (unsigned long) PDE_DATA(inode); t = get_table(id); if (!t) return 0; @@ -3271,7 +3271,7 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub int writeable) { struct inode *inode; - u_int32_t id; + uint32_t id; struct rtpengine_table *t; struct rtpengine_message msgbuf; 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; - id = (u_int32_t) (unsigned long) PDE_DATA(inode); + id = (uint32_t) (unsigned long) PDE_DATA(inode); t = get_table(id); err = -ENOENT; if (!t) @@ -3649,15 +3649,15 @@ error: } /* 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) { - u_int16_t seq; - u_int64_t index; + uint16_t seq; + uint64_t index; unsigned long flags; - u_int16_t s_l; - u_int32_t roc; - u_int32_t v; + uint16_t s_l; + uint32_t roc; + uint32_t v; 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, - struct rtpengine_srtp *s, u_int64_t idx) + struct rtpengine_srtp *s, uint64_t idx) { unsigned long flags; @@ -3707,9 +3707,9 @@ static void update_packet_index(struct re_crypto_context *c, static int srtp_hash(unsigned char *hmac, struct re_crypto_context *c, 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; 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, struct rtpengine_srtp *s, struct rtp_parsed *r, - u_int64_t pkt_idx) + uint64_t pkt_idx) { 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, 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 hmac[20]; - u_int64_t pkt_idx = *pkt_idx_p; + uint64_t pkt_idx = *pkt_idx_p; if (s->hmac == REH_NULL) return 0; @@ -3863,11 +3863,11 @@ ok: /* XXX shared code */ static int srtp_encrypt_aes_cm(struct re_crypto_context *c, struct rtpengine_srtp *s, struct rtp_parsed *r, - u_int64_t pkt_idx) + uint64_t pkt_idx) { unsigned char iv[16]; - u_int32_t *ivi; - u_int32_t idxh, idxl; + uint32_t *ivi; + uint32_t idxh, idxl; memcpy(iv, c->session_salt, 14); 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, struct rtpengine_srtp *s, struct rtp_parsed *r, - u_int64_t pkt_idx) + uint64_t pkt_idx) { unsigned char iv[16]; - u_int32_t roc; + uint32_t roc; iv[0] = 0; 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, 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) 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); - *(u_int32_t*)(iv+2) ^= r->header->ssrc; - *(u_int32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); - *(u_int16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); + *(uint32_t*)(iv+2) ^= r->header->ssrc; + *(uint32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); + *(uint16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); req = aead_request_alloc(c->aead, GFP_ATOMIC); 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, 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) 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); - *(u_int32_t*)(iv+2) ^= r->header->ssrc; - *(u_int32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); - *(u_int16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); + *(uint32_t*)(iv+2) ^= r->header->ssrc; + *(uint32_t*)(iv+6) ^= htonl((pkt_idx & 0x00ffffffff0000ULL) >> 16); + *(uint16_t*)(iv+10) ^= htons(pkt_idx & 0x00ffffULL); req = aead_request_alloc(c->aead, GFP_ATOMIC); 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, struct rtpengine_srtp *s, struct rtp_parsed *r, - u_int64_t pkt_idx) + uint64_t pkt_idx) { if (!r->header) 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, struct rtpengine_srtp *s, struct rtp_parsed *r, - u_int64_t pkt_idx) + uint64_t pkt_idx) { if (!c->cipher->decrypt) 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) { unsigned long flags; struct rtpengine_ssrc_stats *s = &g->ssrc_stats; - u_int16_t old_seq_trunc; - u_int32_t last_seq; - u_int16_t seq_diff; - u_int32_t clockrate; - u_int32_t transit; + uint16_t old_seq_trunc; + uint32_t last_seq; + uint16_t seq_diff; + uint32_t clockrate; + uint32_t transit; int32_t d; - u_int16_t seq = ntohs(rtp->header->seq_num); - u_int32_t ts = ntohl(rtp->header->timestamp); + uint16_t seq = ntohs(rtp->header->seq_num); + uint32_t ts = ntohl(rtp->header->timestamp); 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 { // seq wrap? - u_int32_t new_seq = (last_seq & 0xffff0000) | seq; + uint32_t new_seq = (last_seq & 0xffff0000) | seq; while (new_seq < last_seq) { new_seq += 0x10000; 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, - 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 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 rtp_pt_idx = -2; unsigned int datalen, pllen; - u_int32_t *u32; + uint32_t *u32; struct rtp_parsed rtp; - u_int64_t pkt_idx; + uint64_t pkt_idx; struct re_stream *stream; struct re_stream_packet *packet; const char *errstr = NULL; #if (RE_HAS_MEASUREDELAY) - u_int64_t starttime, endtime, delay; + uint64_t starttime, endtime, delay; #endif 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.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: kfree_skb(skb); diff --git a/kernel-module/xt_RTPENGINE.h b/kernel-module/xt_RTPENGINE.h index 107a413dc..d86f0cebd 100644 --- a/kernel-module/xt_RTPENGINE.h +++ b/kernel-module/xt_RTPENGINE.h @@ -12,39 +12,39 @@ struct xt_rtpengine_info { }; struct rtpengine_stats { - u_int64_t packets; - u_int64_t bytes; - u_int64_t errors; - u_int64_t delay_min; - u_int64_t delay_avg; - u_int64_t delay_max; - u_int8_t in_tos; + uint64_t packets; + uint64_t bytes; + uint64_t errors; + uint64_t delay_min; + uint64_t delay_avg; + uint64_t delay_max; + uint8_t in_tos; }; struct rtpengine_rtp_stats { - u_int64_t packets; - u_int64_t bytes; + uint64_t packets; + uint64_t bytes; }; struct rtpengine_ssrc_stats { struct rtpengine_rtp_stats basic_stats; - u_int32_t timestamp; - u_int32_t ext_seq; - u_int32_t lost_bits; // sliding bitfield, [0] = ext_seq - u_int32_t total_lost; - u_int32_t transit; - u_int32_t jitter; + uint32_t timestamp; + uint32_t ext_seq; + uint32_t lost_bits; // sliding bitfield, [0] = ext_seq + uint32_t total_lost; + uint32_t transit; + uint32_t jitter; }; struct re_address { int family; union { unsigned char ipv6[16]; - u_int32_t ipv4; + uint32_t ipv4; unsigned char u8[16]; - u_int16_t u16[8]; - u_int32_t u32[4]; + uint16_t u16[8]; + uint32_t u32[4]; } u; - u_int16_t port; + uint16_t port; }; enum rtpengine_cipher { @@ -79,7 +79,7 @@ struct rtpengine_srtp { unsigned int session_key_len; unsigned int session_salt_len; 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 mki_len; }; @@ -104,11 +104,11 @@ struct rtpengine_target_info { struct rtpengine_srtp decrypt; struct rtpengine_srtp encrypt; - u_int32_t ssrc; // Expose the SSRC to userspace when we resync. - u_int32_t ssrc_out; // Rewrite SSRC + uint32_t ssrc; // Expose the SSRC to userspace when we resync. + uint32_t ssrc_out; // Rewrite SSRC 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 char tos; @@ -142,7 +142,7 @@ struct rtpengine_packet_info { struct rtpengine_stats_info { struct re_address local; // input - u_int32_t ssrc; // output + uint32_t ssrc; // output struct rtpengine_ssrc_stats ssrc_stats; // output }; diff --git a/lib/auxlib.c b/lib/auxlib.c index a05cad0d3..4ef076690 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -367,11 +367,11 @@ int in6_addr_eq(const void *a, const void *b) { } unsigned int uint32_hash(const void *p) { - const u_int32_t *a = p; + const uint32_t *a = p; return *a; } 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; } diff --git a/lib/auxlib.h b/lib/auxlib.h index 294a6b4b7..dd68f8f1e 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -272,7 +272,7 @@ INLINE void timeval_lowest(struct timeval *l, const struct timeval *n) { if (!l->tv_sec || timeval_cmp(l, n) == 1) *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; } diff --git a/lib/codeclib.c b/lib/codeclib.c index 04c1b1780..0a9d5bc1e 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -704,7 +704,7 @@ static int __decoder_input_data(decoder_t *dec, const str *data, unsigned long t } else { // 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) { ilog(LOG_DEBUG, "Timestamp discontinuity detected, resetting timestamp from " "%lu to %lu", @@ -984,7 +984,7 @@ static void *__packet_sequencer_next_packet(packet_sequencer_t *ps, int num_wait out: ; - u_int16_t l = packet->seq - ps->seq; + uint16_t l = packet->seq - ps->seq; ps->lost_count += l; 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) { str input = *data; - u_int64_t pts = dec->pts; + uint64_t pts = dec->pts; while (input.len >= 2) { int frame_len = input.len >= 10 ? 10 : 2; diff --git a/lib/rtcplib.h b/lib/rtcplib.h index f8e382253..2f40747a8 100644 --- a/lib/rtcplib.h +++ b/lib/rtcplib.h @@ -19,12 +19,12 @@ struct rtcp_header { #error "byte order unknown" #endif unsigned char pt; - u_int16_t length; + uint16_t length; } __attribute__ ((packed)); struct rtcp_packet { struct rtcp_header header; - u_int32_t ssrc; + uint32_t ssrc; } __attribute__ ((packed)); diff --git a/lib/rtplib.c b/lib/rtplib.c index 037302a46..cabccd5f2 100644 --- a/lib/rtplib.c +++ b/lib/rtplib.c @@ -7,8 +7,8 @@ struct rtp_extension { - u_int16_t undefined; - u_int16_t length; + uint16_t undefined; + uint16_t length; } __attribute__ ((packed));