Browse Source

MT#55283 update all flags to 64 bit

Change-Id: I8635c29cab5843b5bf8092f30a093871eeb37f29
pull/1776/head
Richard Fuchs 2 years ago
parent
commit
c9c6117c66
8 changed files with 41 additions and 38 deletions
  1. +2
    -2
      daemon/call.c
  2. +1
    -1
      daemon/ice.c
  3. +2
    -2
      daemon/recording.c
  4. +12
    -10
      daemon/redis.c
  5. +6
    -6
      include/call.h
  6. +13
    -13
      include/helpers.h
  7. +2
    -2
      include/ice.h
  8. +3
    -2
      recording-daemon/metafile.c

+ 2
- 2
daemon/call.c View File

@ -2085,11 +2085,11 @@ get:
static void __dtls_logic(const sdp_ng_flags *flags,
struct call_media *other_media, struct stream_params *sp)
{
unsigned int tmp;
uint64_t tmp;
call_t *call = other_media->call;
/* active and passive are from our POV */
tmp = other_media->media_flags;
tmp = atomic64_get_na(&other_media->media_flags);
bf_copy(&other_media->media_flags, MEDIA_FLAG_SETUP_PASSIVE,
&sp->sp_flags, SP_FLAG_SETUP_ACTIVE);
bf_copy(&other_media->media_flags, MEDIA_FLAG_SETUP_ACTIVE,


+ 1
- 1
daemon/ice.c View File

@ -423,7 +423,7 @@ static void __ice_agent_initialize(struct ice_agent *ag) {
ag->pair_hash = candidate_pair_ht_new();
ag->transaction_hash = transaction_ht_new();
ag->foundation_hash = foundation_ht_new();
ag->agent_flags = 0;
atomic64_set_na(&ag->agent_flags, 0);
bf_copy(&ag->agent_flags, ICE_AGENT_CONTROLLING, &media->media_flags, MEDIA_FLAG_ICE_CONTROLLING);
bf_copy(&ag->agent_flags, ICE_AGENT_LITE_SELF, &media->media_flags, MEDIA_FLAG_ICE_LITE_SELF);
ag->logical_intf = media->logical_intf;


+ 2
- 2
daemon/recording.c View File

@ -897,9 +897,9 @@ static void setup_stream_proc(struct packet_stream *stream) {
if (ML_ISSET(ml, NO_RECORDING))
return;
len = snprintf(buf, sizeof(buf), "TAG %u MEDIA %u TAG-MEDIA %u COMPONENT %u FLAGS %u",
len = snprintf(buf, sizeof(buf), "TAG %u MEDIA %u TAG-MEDIA %u COMPONENT %u FLAGS %" PRIu64,
ml->unique_id, media->unique_id, media->index, stream->component,
stream->ps_flags);
atomic64_get_na(&stream->ps_flags));
append_meta_chunk(recording, buf, len, "STREAM %u details", stream->unique_id);
len = snprintf(buf, sizeof(buf), "tag-%u-media-%u-component-%u-%s-id-%u",


+ 12
- 10
daemon/redis.c View File

@ -1460,7 +1460,7 @@ static int redis_streams(call_t *c, struct redis_list *streams) {
return -1;
atomic64_set_na(&ps->last_packet, time(NULL));
if (redis_hash_get_unsigned((unsigned int *) &ps->ps_flags, rh, "ps_flags"))
if (redis_hash_get_a64(&ps->ps_flags, rh, "ps_flags"))
return -1;
if (redis_hash_get_unsigned((unsigned int *) &ps->component, rh, "component"))
return -1;
@ -1483,6 +1483,7 @@ static int redis_streams(call_t *c, struct redis_list *streams) {
static int redis_tags(call_t *c, struct redis_list *tags, JsonReader *root_reader) {
unsigned int i;
int ii;
atomic64 a64;
struct redis_hash *rh;
struct call_monologue *ml;
str s;
@ -1507,8 +1508,8 @@ static int redis_tags(call_t *c, struct redis_list *tags, JsonReader *root_reade
redis_hash_get_time_t(&ml->deleted, rh, "deleted");
if (!redis_hash_get_int(&ii, rh, "block_dtmf"))
ml->block_dtmf = ii;
if (!redis_hash_get_int(&ii, rh, "ml_flags"))
ml->ml_flags = ii;
if (!redis_hash_get_a64(&a64, rh, "ml_flags"))
ml->ml_flags = a64;
if (redis_hash_get_str(&s, rh, "desired_family"))
return -1;
@ -1590,7 +1591,7 @@ static int json_medias(call_t *c, struct redis_list *medias, struct redis_list *
med->logical_intf = get_logical_interface(NULL, med->desired_family, 0);
}
if (redis_hash_get_unsigned((unsigned int *) &med->media_flags, rh,
if (redis_hash_get_a64(&med->media_flags, rh,
"media_flags"))
return -1;
@ -1952,6 +1953,7 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
const char *err = 0;
int i;
atomic64 a64;
JsonReader *root_reader =0;
JsonParser *parser =0;
@ -2033,8 +2035,8 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
sockaddr_parse_any_str(&c->created_from_addr, &id);
if (!redis_hash_get_int(&i, &call, "block_dtmf"))
c->block_dtmf = i;
if (!redis_hash_get_int(&i, &call, "call_flags"))
c->call_flags = i;
if (!redis_hash_get_a64(&a64, &call, "call_flags"))
c->call_flags = a64;
err = "missing 'redis_hosted_db' value";
if (redis_hash_get_unsigned((unsigned int *) &c->redis_hosted_db, &call, "redis_hosted_db"))
@ -2363,7 +2365,7 @@ char* redis_encode_json(call_t *c) {
JSON_SET_SIMPLE("redis_hosted_db","%u", c->redis_hosted_db);
JSON_SET_SIMPLE_STR("recording_metadata", &c->metadata);
JSON_SET_SIMPLE("block_dtmf","%i", c->block_dtmf);
JSON_SET_SIMPLE("call_flags","%i", c->call_flags);
JSON_SET_SIMPLE("call_flags", "%" PRIu64, atomic64_get_na(&c->call_flags));
if ((rec = c->recording))
JSON_SET_SIMPLE_CSTR("recording_meta_prefix", rec->meta_prefix);
@ -2410,7 +2412,7 @@ char* redis_encode_json(call_t *c) {
JSON_SET_SIMPLE("sfd","%u",ps->selected_sfd ? ps->selected_sfd->unique_id : -1);
JSON_SET_SIMPLE("rtcp_sibling","%u",ps->rtcp_sibling ? ps->rtcp_sibling->unique_id : -1);
JSON_SET_SIMPLE("last_packet",UINT64F,atomic64_get(&ps->last_packet));
JSON_SET_SIMPLE("ps_flags","%u",ps->ps_flags);
JSON_SET_SIMPLE("ps_flags", "%" PRIu64, atomic64_get_na(&ps->ps_flags));
JSON_SET_SIMPLE("component","%u",ps->component);
JSON_SET_SIMPLE_CSTR("endpoint",endpoint_print_buf(&ps->endpoint));
JSON_SET_SIMPLE_CSTR("advertised_endpoint",endpoint_print_buf(&ps->advertised_endpoint));
@ -2478,7 +2480,7 @@ char* redis_encode_json(call_t *c) {
JSON_SET_SIMPLE("created", "%llu", (long long unsigned) ml->created);
JSON_SET_SIMPLE("deleted", "%llu", (long long unsigned) ml->deleted);
JSON_SET_SIMPLE("block_dtmf", "%i", ml->block_dtmf);
JSON_SET_SIMPLE("ml_flags","%u", ml->ml_flags);
JSON_SET_SIMPLE("ml_flags", "%" PRIu64, atomic64_get_na(&ml->ml_flags));
JSON_SET_SIMPLE_CSTR("desired_family", ml->desired_family ? ml->desired_family->rfc_name : "");
if (ml->logical_intf)
JSON_SET_SIMPLE_STR("logical_intf", &ml->logical_intf->name);
@ -2589,7 +2591,7 @@ char* redis_encode_json(call_t *c) {
JSON_SET_SIMPLE_CSTR("desired_family", media->desired_family ? media->desired_family->rfc_name : "");
JSON_SET_SIMPLE_STR("logical_intf", &media->logical_intf->name);
JSON_SET_SIMPLE("ptime","%i", media->ptime);
JSON_SET_SIMPLE("media_flags","%u", media->media_flags);
JSON_SET_SIMPLE("media_flags", "%" PRIu64, atomic64_get_na(&media->media_flags));
json_update_sdes_params(builder, "media", media->unique_id, "sdes_in",
&media->sdes_in);


+ 6
- 6
include/call.h View File

@ -334,7 +334,7 @@ struct stream_params {
str direction[2];
sockfamily_t *desired_family;
struct dtls_fingerprint fingerprint;
unsigned int sp_flags;
atomic64 sp_flags;
struct codec_store codecs;
candidate_q ice_candidates; /* slice-alloc'd */
str ice_ufrag;
@ -419,7 +419,7 @@ struct packet_stream {
atomic64 last_packet;
GHashTable *rtp_stats; /* LOCK: call->master_lock */
struct rtp_stats *rtp_stats_cache;
unsigned int stats_flags;
atomic64 stats_flags;
enum endpoint_learning el_flags;
#if RTP_LOOP_PROTECT
@ -432,7 +432,7 @@ struct packet_stream {
X509 *dtls_cert; /* LOCK: in_lock */
/* in_lock must be held for SETTING these: */
volatile unsigned int ps_flags;
atomic64 ps_flags;
};
/**
@ -502,7 +502,7 @@ struct call_media {
int ptime; /* either from SDP or overridden */
volatile unsigned int media_flags;
atomic64 media_flags;
};
TYPED_GPTRARRAY(medias_arr, struct call_media)
@ -575,7 +575,7 @@ struct call_monologue {
/* carry `sdp_session` attributes into resulting call monologue SDP */
str_q sdp_attributes;
volatile unsigned int ml_flags;
atomic64 ml_flags;
};
TYPED_GQUEUE(monologues, struct call_monologue)
@ -711,7 +711,7 @@ struct call {
int cpu_affinity;
enum block_dtmf_mode block_dtmf;
unsigned int call_flags;
atomic64 call_flags;
};


+ 13
- 13
include/helpers.h View File

@ -427,41 +427,41 @@ INLINE double atomic64_div(const atomic64 *n, const atomic64 *d) {
/*** ATOMIC BITFIELD OPERATIONS ***/
/* checks if at least one of the flags is set */
INLINE bool bf_isset(const volatile unsigned int *u, unsigned int f) {
if ((g_atomic_int_get(u) & f))
INLINE bool bf_isset(const atomic64 *u, const uint64_t f) {
if ((atomic64_get(u) & f))
return true;
return false;
}
/* checks if all of the flags are set */
INLINE bool bf_areset(const volatile unsigned int *u, unsigned int f) {
if ((g_atomic_int_get(u) & f) == f)
INLINE bool bf_areset(const atomic64 *u, const uint64_t f) {
if ((atomic64_get(u) & f) == f)
return true;
return false;
}
/* returns true if at least one of the flags was set already */
INLINE bool bf_set(volatile unsigned int *u, unsigned int f) {
return (g_atomic_int_or(u, f) & f) ? true : false;
INLINE bool bf_set(atomic64 *u, const uint64_t f) {
return (atomic64_or(u, f) & f) ? true : false;
}
/* returns true if at least one of the flags was set */
INLINE bool bf_clear(volatile unsigned int *u, unsigned int f) {
return (g_atomic_int_and(u, ~f) & f) ? true : false;
INLINE bool bf_clear(atomic64 *u, const uint64_t f) {
return (atomic64_and(u, ~f) & f) ? true : false;
}
INLINE void bf_set_clear(volatile unsigned int *u, unsigned int f, bool cond) {
INLINE void bf_set_clear(atomic64 *u, const uint64_t f, bool cond) {
if (cond)
bf_set(u, f);
else
bf_clear(u, f);
}
/* works only for single flags */
INLINE void bf_copy(volatile unsigned int *u, unsigned int f,
const volatile unsigned int *s, unsigned int g)
INLINE void bf_copy(atomic64 *u, const uint64_t f,
const atomic64 *s, const uint64_t g)
{
bf_set_clear(u, f, bf_isset(s, g));
}
/* works for multiple flags */
INLINE void bf_copy_same(volatile unsigned int *u, const volatile unsigned int *s, unsigned int g) {
INLINE void bf_copy_same(atomic64 *u, const atomic64 *s, const uint64_t g) {
unsigned int old, set, clear;
old = g_atomic_int_get(s);
old = atomic64_get(s);
set = old & g;
clear = ~old & g;
bf_set(u, set);


+ 2
- 2
include/ice.h View File

@ -95,7 +95,7 @@ struct ice_candidate_pair {
struct ice_candidate *remote_candidate;
const struct local_intf *local_intf;
stream_fd *sfd;
volatile unsigned int pair_flags;
atomic64 pair_flags;
uint32_t stun_transaction[3]; /* belongs to transaction_hash, thus agent->lock */
unsigned int retransmit_ms;
struct timeval retransmit;
@ -141,7 +141,7 @@ struct ice_agent {
str ufrag[2]; /* 0 = remote, 1 = local */
str pwd[2]; /* ditto */
volatile unsigned int agent_flags;
atomic64 agent_flags;
};


+ 3
- 2
recording-daemon/metafile.c View File

@ -104,8 +104,9 @@ static void meta_stream_interface(metafile_t *mf, unsigned long snum, char *cont
// mf is locked
static void meta_stream_details(metafile_t *mf, unsigned long snum, char *content) {
dbg("stream %lu details %s", snum, content);
unsigned int tag, media, tm, cmp, flags;
if (sscanf_match(content, "TAG %u MEDIA %u TAG-MEDIA %u COMPONENT %u FLAGS %u",
unsigned int tag, media, tm, cmp;
uint64_t flags;
if (sscanf_match(content, "TAG %u MEDIA %u TAG-MEDIA %u COMPONENT %u FLAGS %" PRIu64,
&tag, &media, &tm, &cmp, &flags) != 5)
return;
stream_details(mf, snum, tag);


Loading…
Cancel
Save