common: Default initializers for struct member variables
Since compiler was complaining about them and its little bit more secure, I set all integers to 0 and pointers to nullptr. There is a small risk of reduced performance if the initialization is done frequently, but I think the risk is worth it since uvgRTP is already one of the fastest RTP libraries in the world and there are issues with reliability. The member variable initialization was introduced in C++11 which is the lowest we support at the moment.
This commit is contained in:
parent
7f83a7708a
commit
e739648923
|
@ -12,7 +12,7 @@
|
|||
#include <string>
|
||||
|
||||
// TODO constexpr??
|
||||
inline const char *className(const std::string& prettyFunction)
|
||||
inline const std::string className(const std::string& prettyFunction)
|
||||
{
|
||||
size_t colons = prettyFunction.find("::");
|
||||
if (colons == std::string::npos)
|
||||
|
@ -21,7 +21,9 @@ inline const char *className(const std::string& prettyFunction)
|
|||
size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1;
|
||||
size_t end = colons - begin;
|
||||
|
||||
return prettyFunction.substr(begin,end).c_str();
|
||||
std::string partialString = prettyFunction.substr(begin, end);
|
||||
|
||||
return partialString;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -40,16 +40,16 @@ namespace uvgrtp {
|
|||
uvgrtp::clock::hrc::hrc_t sframe_time;
|
||||
|
||||
/* sequence number of the frame with s-bit */
|
||||
uint32_t s_seq;
|
||||
uint32_t s_seq = 0;
|
||||
|
||||
/* sequence number of the frame with e-bit */
|
||||
uint32_t e_seq;
|
||||
uint32_t e_seq = 0;
|
||||
|
||||
/* how many fragments have been received */
|
||||
size_t pkts_received;
|
||||
size_t pkts_received = 0;
|
||||
|
||||
/* total size of all fragments */
|
||||
size_t total_size;
|
||||
size_t total_size = 0;
|
||||
|
||||
/* map of frame's fragments,
|
||||
* allows out-of-order insertion and loop-through in order */
|
||||
|
|
|
@ -41,16 +41,16 @@ namespace uvgrtp {
|
|||
uvgrtp::clock::hrc::hrc_t sframe_time;
|
||||
|
||||
/* sequence number of the frame with s-bit */
|
||||
uint32_t s_seq;
|
||||
uint32_t s_seq = 0;
|
||||
|
||||
/* sequence number of the frame with e-bit */
|
||||
uint32_t e_seq;
|
||||
uint32_t e_seq = 0;
|
||||
|
||||
/* how many fragments have been received */
|
||||
size_t pkts_received;
|
||||
size_t pkts_received = 0;
|
||||
|
||||
/* total size of all fragments */
|
||||
size_t total_size;
|
||||
size_t total_size = 0;
|
||||
|
||||
/* map of frame's fragments,
|
||||
* allows out-of-order insertion and loop-through in order */
|
||||
|
@ -64,7 +64,7 @@ namespace uvgrtp {
|
|||
std::deque<uvgrtp::frame::rtp_frame *> queued;
|
||||
std::unordered_map<uint32_t, h265_info_t> frames;
|
||||
std::unordered_set<uint32_t> dropped;
|
||||
uvgrtp::rtp *rtp_ctx;
|
||||
uvgrtp::rtp *rtp_ctx; // cannot be initialized because struct unnamed
|
||||
} h265_frame_info_t;
|
||||
|
||||
class h265 : public h26x {
|
||||
|
|
|
@ -41,16 +41,16 @@ namespace uvgrtp {
|
|||
uvgrtp::clock::hrc::hrc_t sframe_time;
|
||||
|
||||
/* sequence number of the frame with s-bit */
|
||||
uint32_t s_seq;
|
||||
uint32_t s_seq = 0;
|
||||
|
||||
/* sequence number of the frame with e-bit */
|
||||
uint32_t e_seq;
|
||||
uint32_t e_seq = 0;
|
||||
|
||||
/* how many fragments have been received */
|
||||
size_t pkts_received;
|
||||
size_t pkts_received = 0;
|
||||
|
||||
/* total size of all fragments */
|
||||
size_t total_size;
|
||||
size_t total_size = 0;
|
||||
|
||||
/* map of frame's fragments,
|
||||
* allows out-of-order insertion and loop-through in order */
|
||||
|
|
|
@ -20,10 +20,10 @@ namespace uvgrtp {
|
|||
namespace formats {
|
||||
|
||||
typedef struct media_info {
|
||||
uint32_t s_seq;
|
||||
uint32_t e_seq;
|
||||
size_t npkts;
|
||||
size_t size;
|
||||
uint32_t s_seq = 0;
|
||||
uint32_t e_seq = 0;
|
||||
size_t npkts = 0;
|
||||
size_t size = 0;
|
||||
std::map<uint32_t, uvgrtp::frame::rtp_frame *> fragments;
|
||||
} media_info_t;
|
||||
|
||||
|
|
|
@ -52,24 +52,24 @@ namespace uvgrtp {
|
|||
uint8_t cc:4;
|
||||
uint8_t marker:1;
|
||||
uint8_t payload:7;
|
||||
uint16_t seq;
|
||||
uint32_t timestamp;
|
||||
uint32_t ssrc;
|
||||
uint16_t seq = 0;
|
||||
uint32_t timestamp = 0;
|
||||
uint32_t ssrc = 0;
|
||||
});
|
||||
|
||||
PACK(struct ext_header {
|
||||
uint16_t type;
|
||||
uint16_t len;
|
||||
uint8_t *data;
|
||||
uint16_t type = 0;
|
||||
uint16_t len = 0;
|
||||
uint8_t *data = nullptr;
|
||||
});
|
||||
|
||||
struct rtp_frame {
|
||||
struct rtp_header header;
|
||||
uint32_t *csrc;
|
||||
uint32_t *csrc = nullptr;
|
||||
struct ext_header *ext;
|
||||
|
||||
size_t padding_len; /* non-zero if frame is padded */
|
||||
size_t payload_len; /* payload_len: total_len - header_len - padding length (if padded) */
|
||||
size_t padding_len = 0; /* non-zero if frame is padded */
|
||||
size_t payload_len = 0; /* payload_len: total_len - header_len - padding length (if padded) */
|
||||
|
||||
/* Probation zone is a small area of free-to-use memory for the frame receiver
|
||||
* when handling fragments. For example HEVC fragments that belong to future frames
|
||||
|
@ -80,86 +80,86 @@ namespace uvgrtp {
|
|||
* the internal fragmentation as this memory is not usable for anything else
|
||||
*
|
||||
* NOTE 2: This is a Linux-only optimization */
|
||||
size_t probation_len;
|
||||
size_t probation_off;
|
||||
uint8_t *probation;
|
||||
uint8_t *payload;
|
||||
size_t probation_len = 0;
|
||||
size_t probation_off = 0;
|
||||
uint8_t *probation = nullptr;
|
||||
uint8_t *payload = nullptr;
|
||||
|
||||
uint8_t *dgram; /* pointer to the UDP datagram (for internal use only) */
|
||||
size_t dgram_size; /* size of the UDP datagram */
|
||||
uint8_t *dgram = nullptr; /* pointer to the UDP datagram (for internal use only) */
|
||||
size_t dgram_size = 0; /* size of the UDP datagram */
|
||||
|
||||
rtp_format_t format;
|
||||
int type;
|
||||
rtp_format_t format = RTP_FORMAT_GENERIC;
|
||||
int type = 0;
|
||||
sockaddr_in src_addr;
|
||||
};
|
||||
|
||||
struct rtcp_header {
|
||||
uint8_t version;
|
||||
uint8_t padding;
|
||||
uint8_t version = 0;
|
||||
uint8_t padding = 0;
|
||||
union {
|
||||
uint8_t count;
|
||||
uint8_t pkt_subtype; /* for app packets */
|
||||
};
|
||||
uint8_t pkt_type;
|
||||
uint16_t length;
|
||||
uint8_t pkt_type = 0;
|
||||
uint16_t length = 0;
|
||||
};
|
||||
|
||||
struct rtcp_sender_info {
|
||||
uint32_t ntp_msw; /* NTP timestamp, most significant word */
|
||||
uint32_t ntp_lsw; /* NTP timestamp, least significant word */
|
||||
uint32_t rtp_ts; /* RTP timestamp corresponding to same time as NTP */
|
||||
uint32_t pkt_cnt;
|
||||
uint32_t byte_cnt;
|
||||
uint32_t ntp_msw = 0; /* NTP timestamp, most significant word */
|
||||
uint32_t ntp_lsw = 0; /* NTP timestamp, least significant word */
|
||||
uint32_t rtp_ts = 0; /* RTP timestamp corresponding to same time as NTP */
|
||||
uint32_t pkt_cnt = 0;
|
||||
uint32_t byte_cnt = 0;
|
||||
};
|
||||
|
||||
struct rtcp_report_block {
|
||||
uint32_t ssrc;
|
||||
uint8_t fraction;
|
||||
int32_t lost;
|
||||
uint32_t last_seq;
|
||||
uint32_t jitter;
|
||||
uint32_t lsr; /* last Sender Report */
|
||||
uint32_t dlsr; /* delay since last Sender Report */
|
||||
uint32_t ssrc = 0;
|
||||
uint8_t fraction = 0;
|
||||
int32_t lost = 0;
|
||||
uint32_t last_seq = 0;
|
||||
uint32_t jitter = 0;
|
||||
uint32_t lsr = 0; /* last Sender Report */
|
||||
uint32_t dlsr = 0; /* delay since last Sender Report */
|
||||
};
|
||||
|
||||
struct rtcp_receiver_report {
|
||||
struct rtcp_header header;
|
||||
uint32_t ssrc;
|
||||
uint32_t ssrc = 0;
|
||||
std::vector<rtcp_report_block> report_blocks;
|
||||
};
|
||||
|
||||
struct rtcp_sender_report {
|
||||
struct rtcp_header header;
|
||||
uint32_t ssrc;
|
||||
uint32_t ssrc = 0;
|
||||
struct rtcp_sender_info sender_info;
|
||||
std::vector<rtcp_report_block> report_blocks;
|
||||
};
|
||||
|
||||
struct rtcp_sdes_item {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
void *data;
|
||||
uint8_t type = 0;
|
||||
uint8_t length = 0;
|
||||
void *data = nullptr;
|
||||
};
|
||||
|
||||
struct rtcp_sdes_packet {
|
||||
struct rtcp_header header;
|
||||
uint32_t ssrc;
|
||||
uint32_t ssrc = 0;
|
||||
std::vector<rtcp_sdes_item> items;
|
||||
};
|
||||
|
||||
struct rtcp_app_packet {
|
||||
struct rtcp_header header;
|
||||
uint32_t ssrc;
|
||||
uint32_t ssrc = 0;
|
||||
uint8_t name[4];
|
||||
uint8_t *payload;
|
||||
uint8_t *payload = nullptr;
|
||||
};
|
||||
|
||||
PACK(struct zrtp_frame {
|
||||
uint8_t version:4;
|
||||
uint16_t unused:12;
|
||||
uint16_t seq;
|
||||
uint32_t magic;
|
||||
uint32_t ssrc;
|
||||
uint16_t seq = 0;
|
||||
uint32_t magic = 0;
|
||||
uint32_t ssrc = 0;
|
||||
uint8_t payload[1];
|
||||
});
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace uvgrtp {
|
|||
typedef rtp_error_t (*frame_getter)(void *, uvgrtp::frame::rtp_frame **);
|
||||
|
||||
struct auxiliary_handler {
|
||||
void *arg;
|
||||
packet_handler_aux handler;
|
||||
frame_getter getter;
|
||||
void *arg = nullptr;
|
||||
packet_handler_aux handler = nullptr;
|
||||
frame_getter getter = nullptr;
|
||||
};
|
||||
|
||||
struct packet_handlers {
|
||||
packet_handler primary;
|
||||
packet_handler primary = nullptr;
|
||||
std::vector<auxiliary_handler> auxiliary;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace uvgrtp {
|
|||
typedef struct transaction {
|
||||
/* Each transaction has a unique key which is used by the SCD (if enabled)
|
||||
* when moving the transactions betwen "queued_" and "free_" */
|
||||
uint32_t key;
|
||||
uint32_t key = 0;
|
||||
|
||||
/* To provide true scatter/gather I/O, each transaction has a buf_vec
|
||||
* structure which may contain differents buffers and their sizes.
|
||||
|
@ -51,14 +51,14 @@ namespace uvgrtp {
|
|||
* Keeping a separate common RTP header and then just copying this is cleaner than initializing
|
||||
* RTP header for each packet */
|
||||
uvgrtp::frame::rtp_header rtp_common;
|
||||
uvgrtp::frame::rtp_header *rtp_headers;
|
||||
uvgrtp::frame::rtp_header *rtp_headers = nullptr;
|
||||
|
||||
#ifdef __linux__
|
||||
struct mmsghdr *headers;
|
||||
struct iovec *chunks;
|
||||
struct mmsghdr *headers = nullptr;
|
||||
struct iovec *chunks = nullptr;
|
||||
#else
|
||||
char *headers;
|
||||
char *chunks;
|
||||
char *headers = nullptr;
|
||||
char *chunks = nullptr;
|
||||
#endif
|
||||
|
||||
/* Media may need space for additional buffers,
|
||||
|
@ -66,21 +66,21 @@ namespace uvgrtp {
|
|||
* when the transaction is initialized for the first time
|
||||
*
|
||||
* See src/formats/hevc.hh for example */
|
||||
void *media_headers;
|
||||
void *media_headers = nullptr;
|
||||
|
||||
/* Pointer to RTP authentication (if enabled) */
|
||||
uint8_t *rtp_auth_tags;
|
||||
uint8_t *rtp_auth_tags = nullptr;
|
||||
|
||||
size_t chunk_ptr;
|
||||
size_t hdr_ptr;
|
||||
size_t rtphdr_ptr;
|
||||
size_t rtpauth_ptr;
|
||||
size_t chunk_ptr = 0;
|
||||
size_t hdr_ptr = 0;
|
||||
size_t rtphdr_ptr = 0;
|
||||
size_t rtpauth_ptr = 0;
|
||||
|
||||
/* Address of receiver, used by sendmmsg(2) */
|
||||
sockaddr_in out_addr;
|
||||
|
||||
/* Used by the system call dispatcher for transaction deinitialization */
|
||||
uvgrtp::frame_queue *fqueue;
|
||||
uvgrtp::frame_queue *fqueue = nullptr;
|
||||
|
||||
/* If SCD is used, it's absolutely essential to initialize transaction
|
||||
* by giving the data pointer to frame queue
|
||||
|
@ -94,7 +94,7 @@ namespace uvgrtp {
|
|||
* If callback is not provided, SCD will check if "flags" field contains the flag "RTP_COPY"
|
||||
* which means that uvgRTP has a made a copy of the original chunk and it can be safely freed */
|
||||
std::unique_ptr<uint8_t[]> data_smart;
|
||||
uint8_t *data_raw;
|
||||
uint8_t *data_raw = nullptr;
|
||||
|
||||
/* If the application code provided us a deallocation hook, this points to it.
|
||||
* When SCD finishes processing a transaction, it will call this hook with "data_raw" pointer */
|
||||
|
|
|
@ -32,45 +32,45 @@ namespace uvgrtp {
|
|||
|
||||
struct rtcp_statistics {
|
||||
/* receiver stats */
|
||||
uint32_t received_pkts; /* Number of packets received */
|
||||
uint32_t dropped_pkts; /* Number of dropped RTP packets */
|
||||
uint32_t received_bytes; /* Number of bytes received excluding RTP Header */
|
||||
uint32_t received_pkts = 0; /* Number of packets received */
|
||||
uint32_t dropped_pkts = 0; /* Number of dropped RTP packets */
|
||||
uint32_t received_bytes = 0; /* Number of bytes received excluding RTP Header */
|
||||
|
||||
/* sender stats */
|
||||
uint32_t sent_pkts; /* Number of sent RTP packets */
|
||||
uint32_t sent_bytes; /* Number of sent bytes excluding RTP Header */
|
||||
uint32_t sent_pkts = 0; /* Number of sent RTP packets */
|
||||
uint32_t sent_bytes = 0; /* Number of sent bytes excluding RTP Header */
|
||||
|
||||
uint32_t jitter; /* TODO: */
|
||||
uint32_t transit; /* TODO: */
|
||||
uint32_t jitter = 0; /* TODO: */
|
||||
uint32_t transit = 0; /* TODO: */
|
||||
|
||||
/* Receiver clock related stuff */
|
||||
uint64_t initial_ntp; /* Wallclock reading when the first RTP packet was received */
|
||||
uint32_t initial_rtp; /* RTP timestamp of the first RTP packet received */
|
||||
uint32_t clock_rate; /* Rate of the clock (used for jitter calculations) */
|
||||
uint64_t initial_ntp = 0; /* Wallclock reading when the first RTP packet was received */
|
||||
uint32_t initial_rtp = 0; /* RTP timestamp of the first RTP packet received */
|
||||
uint32_t clock_rate = 0; /* Rate of the clock (used for jitter calculations) */
|
||||
|
||||
uint32_t lsr; /* Middle 32 bits of the 64-bit NTP timestamp of previous SR */
|
||||
uint32_t lsr = 0; /* Middle 32 bits of the 64-bit NTP timestamp of previous SR */
|
||||
uvgrtp::clock::hrc::hrc_t sr_ts; /* When the last SR was received (used to calculate delay) */
|
||||
|
||||
uint16_t max_seq; /* Highest sequence number received */
|
||||
uint16_t base_seq; /* First sequence number received */
|
||||
uint16_t bad_seq; /* TODO: */
|
||||
uint16_t cycles; /* Number of sequence cycles */
|
||||
uint16_t max_seq = 0; /* Highest sequence number received */
|
||||
uint16_t base_seq = 0; /* First sequence number received */
|
||||
uint16_t bad_seq = 0; /* TODO: */
|
||||
uint16_t cycles = 0; /* Number of sequence cycles */
|
||||
};
|
||||
|
||||
struct rtcp_participant {
|
||||
uvgrtp::socket *socket; /* socket associated with this participant */
|
||||
sockaddr_in address; /* address of the participant */
|
||||
uvgrtp::socket *socket = nullptr; /* socket associated with this participant */
|
||||
sockaddr_in address; /* address of the participant */
|
||||
struct rtcp_statistics stats; /* RTCP session statistics of the participant */
|
||||
|
||||
int probation; /* has the participant been fully accepted to the session */
|
||||
int role; /* is the participant a sender or a receiver */
|
||||
int probation = 0; /* has the participant been fully accepted to the session */
|
||||
int role = 0; /* is the participant a sender or a receiver */
|
||||
|
||||
/* Save the latest RTCP packets received from this participant
|
||||
* Users can query these packets using the SSRC of participant */
|
||||
uvgrtp::frame::rtcp_sender_report *s_frame;
|
||||
uvgrtp::frame::rtcp_receiver_report *r_frame;
|
||||
uvgrtp::frame::rtcp_sdes_packet *sdes_frame;
|
||||
uvgrtp::frame::rtcp_app_packet *app_frame;
|
||||
uvgrtp::frame::rtcp_sender_report *s_frame = nullptr;
|
||||
uvgrtp::frame::rtcp_receiver_report *r_frame = nullptr;
|
||||
uvgrtp::frame::rtcp_sdes_packet *sdes_frame = nullptr;
|
||||
uvgrtp::frame::rtcp_app_packet *app_frame = nullptr;
|
||||
};
|
||||
/// \endcond
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace uvgrtp {
|
|||
typedef rtp_error_t (*packet_handler_vec)(void *, buf_vec&);
|
||||
|
||||
struct socket_packet_handler {
|
||||
void *arg;
|
||||
packet_handler_vec handler;
|
||||
void *arg = nullptr;
|
||||
packet_handler_vec handler = nullptr;
|
||||
};
|
||||
|
||||
class socket {
|
||||
|
|
|
@ -74,24 +74,24 @@ namespace uvgrtp {
|
|||
/* Keys negotiated by ZRTP */
|
||||
struct {
|
||||
/* Our master key and salt */
|
||||
uint8_t *local_key;
|
||||
uint8_t *local_key = nullptr;
|
||||
uint8_t local_salt[UVG_SALT_LENGTH];
|
||||
|
||||
/* Remote's master key and salt */
|
||||
uint8_t *remote_key;
|
||||
uint8_t *remote_key = nullptr;
|
||||
uint8_t remote_salt[UVG_SALT_LENGTH];
|
||||
} master;
|
||||
|
||||
/* Used to encrypt/authenticate packets sent by us */
|
||||
struct {
|
||||
uint8_t *enc_key;
|
||||
uint8_t *enc_key = nullptr;
|
||||
uint8_t auth_key[UVG_AUTH_LENGTH];
|
||||
uint8_t salt_key[UVG_SALT_LENGTH];
|
||||
} local;
|
||||
|
||||
/* Used to decrypt/Authenticate packets sent by remote */
|
||||
struct {
|
||||
uint8_t *enc_key;
|
||||
uint8_t *enc_key = nullptr;
|
||||
uint8_t auth_key[UVG_AUTH_LENGTH];
|
||||
uint8_t salt_key[UVG_SALT_LENGTH];
|
||||
} remote;
|
||||
|
@ -99,29 +99,29 @@ namespace uvgrtp {
|
|||
} srtp_key_ctx_t;
|
||||
|
||||
typedef struct srtp_ctx {
|
||||
int type; /* srtp or srtcp */
|
||||
uint32_t roc; /* roll-over counter */
|
||||
uint32_t rts; /* timestamp of the frame that causes ROC update */
|
||||
int type = 0; /* srtp or srtcp */
|
||||
uint32_t roc = 0; /* roll-over counter */
|
||||
uint32_t rts = 0; /* timestamp of the frame that causes ROC update */
|
||||
|
||||
int enc; /* identifier for encryption algorithm */
|
||||
int hmac; /* identifier for message authentication algorithm */
|
||||
int enc = 0; /* identifier for encryption algorithm */
|
||||
int hmac = 0; /* identifier for message authentication algorithm */
|
||||
|
||||
bool mki_present; /* is MKI present in SRTP packets */
|
||||
size_t mki_size; /* length of the MKI field in bytes if it's present */
|
||||
uint8_t *mki; /* master key identifier */
|
||||
bool mki_present = 0; /* is MKI present in SRTP packets */
|
||||
size_t mki_size = 0; /* length of the MKI field in bytes if it's present */
|
||||
uint8_t *mki = nullptr; /* master key identifier */
|
||||
|
||||
uint8_t *master_key; /* master key */
|
||||
uint8_t *master_salt; /* master salt */
|
||||
size_t mk_cnt; /* how many packets have been encrypted with master key */
|
||||
uint8_t *master_key = nullptr; /* master key */
|
||||
uint8_t *master_salt = nullptr; /* master salt */
|
||||
size_t mk_cnt = 0; /* how many packets have been encrypted with master key */
|
||||
|
||||
size_t n_e; /* size of encryption key */
|
||||
size_t n_a; /* size of hmac key */
|
||||
size_t n_e = 0; /* size of encryption key */
|
||||
size_t n_a = 0; /* size of hmac key */
|
||||
|
||||
/* following fields are receiver-only */
|
||||
uint16_t s_l; /* highest received sequence number */
|
||||
uint8_t *replay; /* list of recently received and authenticated SRTP packets */
|
||||
uint16_t s_l = 0; /* highest received sequence number */
|
||||
uint8_t *replay = nullptr; /* list of recently received and authenticated SRTP packets */
|
||||
|
||||
int flags; /* context configuration flags */
|
||||
int flags = 0; /* context configuration flags */
|
||||
|
||||
srtp_key_ctx_t key_ctx;
|
||||
} srtp_ctx_t;
|
||||
|
|
|
@ -289,7 +289,7 @@ enum NOTIFY_REASON {
|
|||
|
||||
/* see src/util.hh for more information */
|
||||
typedef struct rtp_ctx_conf {
|
||||
int flags;
|
||||
int flags = 0;
|
||||
ssize_t ctx_values[RCC_LAST];
|
||||
} rtp_ctx_conf_t;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace uvgrtp {
|
|||
|
||||
typedef struct capabilities {
|
||||
/* Supported ZRTP version */
|
||||
uint32_t version;
|
||||
uint32_t version = 0;
|
||||
|
||||
/* Supported hash algorithms (empty for us) */
|
||||
std::vector<uint32_t> hash_algos;
|
||||
|
@ -66,9 +66,9 @@ namespace uvgrtp {
|
|||
} zrtp_capab_t;
|
||||
|
||||
typedef struct zrtp_crypto_ctx {
|
||||
uvgrtp::crypto::hmac::sha256 *hmac_sha256;
|
||||
uvgrtp::crypto::sha256 *sha256;
|
||||
uvgrtp::crypto::dh *dh;
|
||||
uvgrtp::crypto::hmac::sha256 *hmac_sha256 = nullptr;
|
||||
uvgrtp::crypto::sha256 *sha256 = nullptr;
|
||||
uvgrtp::crypto::dh *dh = nullptr;
|
||||
} zrtp_crypto_ctx_t;
|
||||
|
||||
typedef struct zrtp_secrets {
|
||||
|
@ -84,9 +84,9 @@ namespace uvgrtp {
|
|||
* Because uvgRTP supports only DH mode,
|
||||
* other shared secrets (s1 - s3) are null */
|
||||
uint8_t s0[32];
|
||||
uint8_t *s1;
|
||||
uint8_t *s2;
|
||||
uint8_t *s3;
|
||||
uint8_t *s1 = nullptr;
|
||||
uint8_t *s2 = nullptr;
|
||||
uint8_t *s3 = nullptr;
|
||||
} zrtp_secrets_t;
|
||||
|
||||
typedef struct zrtp_messages {
|
||||
|
@ -139,15 +139,15 @@ namespace uvgrtp {
|
|||
/* Collection of algorithms that are used by ZRTP
|
||||
* (based on information gathered from Hello message) */
|
||||
typedef struct zrtp_session {
|
||||
int role; /* initiator/responder */
|
||||
uint32_t ssrc;
|
||||
uint16_t seq;
|
||||
int role = 0; /* initiator/responder */
|
||||
uint32_t ssrc = 0;
|
||||
uint16_t seq = 0;
|
||||
|
||||
uint32_t hash_algo;
|
||||
uint32_t cipher_algo;
|
||||
uint32_t auth_tag_type;
|
||||
uint32_t key_agreement_type;
|
||||
uint32_t sas_type;
|
||||
uint32_t hash_algo = 0;
|
||||
uint32_t cipher_algo = 0;
|
||||
uint32_t auth_tag_type = 0;
|
||||
uint32_t key_agreement_type = 0;
|
||||
uint32_t sas_type = 0;
|
||||
|
||||
/* Session capabilities */
|
||||
zrtp_capab_t capabilities;
|
||||
|
|
|
@ -31,15 +31,15 @@ namespace uvgrtp {
|
|||
|
||||
uint32_t hash[8];
|
||||
uint32_t zid[3];
|
||||
uint32_t hash_algo;
|
||||
uint32_t cipher_algo;
|
||||
uint32_t auth_tag_type;
|
||||
uint32_t key_agreement_type;
|
||||
uint32_t sas_type;
|
||||
uint32_t hash_algo = 0;
|
||||
uint32_t cipher_algo = 0;
|
||||
uint32_t auth_tag_type = 0;
|
||||
uint32_t key_agreement_type = 0;
|
||||
uint32_t sas_type = 0;
|
||||
|
||||
uint32_t hvi[8];
|
||||
uint32_t mac[2];
|
||||
uint32_t crc;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class commit {
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace uvgrtp {
|
|||
|
||||
PACK(struct zrtp_confack {
|
||||
zrtp_msg msg_start;
|
||||
uint32_t crc;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class confack {
|
||||
|
|
|
@ -40,10 +40,10 @@ namespace uvgrtp {
|
|||
uint32_t d:1; /* */
|
||||
uint32_t a:1; /* */
|
||||
|
||||
uint32_t cache_expr; /* cache expiration interval */
|
||||
uint32_t cache_expr = 0; /* cache expiration interval */
|
||||
/* encrypted portion ends */
|
||||
|
||||
uint32_t crc;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class confirm {
|
||||
|
|
|
@ -14,16 +14,16 @@ namespace uvgrtp {
|
|||
PACK(struct zrtp_header {
|
||||
uint16_t version:4;
|
||||
uint16_t unused:12;
|
||||
uint16_t seq;
|
||||
uint32_t magic;
|
||||
uint32_t ssrc;
|
||||
uint16_t seq = 0;
|
||||
uint32_t magic = 0;
|
||||
uint32_t ssrc = 0;
|
||||
});
|
||||
|
||||
PACK(struct zrtp_msg {
|
||||
struct zrtp_header header;
|
||||
uint16_t magic;
|
||||
uint16_t length;
|
||||
uint64_t msgblock;
|
||||
uint16_t magic = 0;
|
||||
uint16_t length = 0;
|
||||
uint64_t msgblock = 0;
|
||||
});
|
||||
|
||||
enum ZRTP_FRAME_TYPE {
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace uvgrtp {
|
|||
uint8_t pbx_secret[8];
|
||||
uint8_t pk[384];
|
||||
uint8_t mac[8];
|
||||
uint32_t crc;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class dh_key_exchange {
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace uvgrtp {
|
|||
|
||||
PACK(struct zrtp_error {
|
||||
zrtp_msg msg_start;
|
||||
uint32_t error;
|
||||
uint32_t crc;
|
||||
uint32_t error = 0;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class error {
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace uvgrtp {
|
|||
PACK(struct zrtp_hello {
|
||||
zrtp_msg msg_start;
|
||||
|
||||
uint32_t version;
|
||||
uint32_t version = 0;
|
||||
uint32_t client[4];
|
||||
uint32_t hash[8];
|
||||
uint32_t zid[3];
|
||||
|
@ -35,15 +35,15 @@ namespace uvgrtp {
|
|||
uint8_t s:1;
|
||||
uint8_t m:1;
|
||||
uint8_t p:1;
|
||||
uint8_t unused;
|
||||
uint8_t unused = 0;
|
||||
uint8_t hc:4;
|
||||
uint8_t cc:4;
|
||||
uint8_t ac:4;
|
||||
uint8_t kc:4;
|
||||
uint8_t sc:4;
|
||||
|
||||
uint64_t mac;
|
||||
uint32_t crc;
|
||||
uint64_t mac = 0;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class hello {
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace uvgrtp {
|
|||
|
||||
PACK(struct zrtp_hello_ack {
|
||||
zrtp_msg msg_start;
|
||||
uint32_t crc;
|
||||
uint32_t crc = 0;
|
||||
});
|
||||
|
||||
class hello_ack {
|
||||
|
|
Loading…
Reference in New Issue