diff --git a/src/bridge/HostBridge.cpp b/src/bridge/HostBridge.cpp index d3504111..ec5f6e1a 100644 --- a/src/bridge/HostBridge.cpp +++ b/src/bridge/HostBridge.cpp @@ -2630,7 +2630,7 @@ void HostBridge::resetWithNullAudio(uint8_t* data, bool encrypted) } } -/* */ +/* Helper to send silence audio frames. */ void HostBridge::padSilenceAudio(uint32_t srcId, uint32_t dstId) { diff --git a/src/bridge/HostBridge.h b/src/bridge/HostBridge.h index d2640686..a0b52032 100644 --- a/src/bridge/HostBridge.h +++ b/src/bridge/HostBridge.h @@ -552,8 +552,8 @@ private: /** * @brief Helper to send silence audio frames. - * @param srcId - * @param dstId + * @param srcId Source ID. + * @param dstId Destination ID. */ void padSilenceAudio(uint32_t srcId, uint32_t dstId); diff --git a/src/common/AESCrypto.cpp b/src/common/AESCrypto.cpp index 6413d309..2ed9cd1b 100644 --- a/src/common/AESCrypto.cpp +++ b/src/common/AESCrypto.cpp @@ -421,7 +421,7 @@ uint8_t* AES::decryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[] // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Substitutes bytes in the state using the S-Box. */ void AES::subBytes(uint8_t state[4][AES_NB]) { @@ -433,7 +433,7 @@ void AES::subBytes(uint8_t state[4][AES_NB]) } } -/* */ +/* Inverse substitutes bytes in the state using the inverse S-Box. */ void AES::invSubBytes(uint8_t state[4][AES_NB]) { @@ -445,7 +445,7 @@ void AES::invSubBytes(uint8_t state[4][AES_NB]) } } -/* Shift row i on n positions. */ +/* Shifts the row of the state to the left by a certain number of positions. */ void AES::shiftRow(uint8_t state[4][AES_NB], uint32_t i, uint32_t n) { @@ -456,7 +456,7 @@ void AES::shiftRow(uint8_t state[4][AES_NB], uint32_t i, uint32_t n) memcpy(state[i], tmp, AES_NB * sizeof(uint8_t)); } -/* */ +/* Shifts the rows of the state to the left by a certain number of positions. */ void AES::shiftRows(uint8_t state[4][AES_NB]) { @@ -465,7 +465,7 @@ void AES::shiftRows(uint8_t state[4][AES_NB]) shiftRow(state, 3, 3); } -/* */ +/* Inverse shifts the rows of the state to the right by a certain number of positions. */ void AES::invShiftRows(uint8_t state[4][AES_NB]) { @@ -474,7 +474,7 @@ void AES::invShiftRows(uint8_t state[4][AES_NB]) shiftRow(state, 3, AES_NB - 3); } -/* */ +/* Mixes the columns of the state using the Galois field multiplication. */ void AES::mixColumns(uint8_t state[4][AES_NB]) { uint8_t tempState[4][AES_NB]; @@ -498,7 +498,7 @@ void AES::mixColumns(uint8_t state[4][AES_NB]) { } } -/* */ +/* Inverse mixes the columns of the state using the Galois field multiplication. */ void AES::invMixColumns(uint8_t state[4][AES_NB]) { uint8_t tempState[4][AES_NB]; @@ -519,7 +519,7 @@ void AES::invMixColumns(uint8_t state[4][AES_NB]) { } } -/* */ +/* Adds the round key to the state. */ void AES::addRoundKey(uint8_t state[4][AES_NB], uint8_t* key) { @@ -530,7 +530,7 @@ void AES::addRoundKey(uint8_t state[4][AES_NB], uint8_t* key) } } -/* */ +/* Substitutes a word using the S-Box. */ void AES::subWord(uint8_t* a) { @@ -539,7 +539,7 @@ void AES::subWord(uint8_t* a) } } -/* */ +/* Rotates a word by shifting its bytes to the left. */ void AES::rotWord(uint8_t* a) { @@ -550,7 +550,7 @@ void AES::rotWord(uint8_t* a) a[3] = c; } -/* */ +/* Performs the XOR operation on two words and stores the result in a third word. */ void AES::xorWords(uint8_t* a, uint8_t* b, uint8_t* c) { @@ -559,7 +559,7 @@ void AES::xorWords(uint8_t* a, uint8_t* b, uint8_t* c) } } -/* */ +/* Performs the round constants operation on a word. */ void AES::rCon(uint8_t *a, uint32_t n) { @@ -572,7 +572,7 @@ void AES::rCon(uint8_t *a, uint32_t n) a[1] = a[2] = a[3] = 0; } -/* */ +/* Expands the encryption key into round keys for the AES algorithm. */ void AES::keyExpansion(const uint8_t key[], uint8_t w[]) { uint8_t temp[4], rcon[4]; @@ -607,7 +607,7 @@ void AES::keyExpansion(const uint8_t key[], uint8_t w[]) { } } -/* */ +/* Encrypts a single block of data using the AES algorithm. */ void AES::encryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys) { @@ -638,7 +638,7 @@ void AES::encryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys) } } -/* */ +/* Decrypts a single block of data using the AES algorithm. */ void AES::decryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys) { @@ -669,7 +669,7 @@ void AES::decryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys) } } -/* */ +/* Performs the XOR operation on two blocks of data. */ void AES::xorBlocks(const uint8_t *a, const uint8_t *b, uint8_t *c, uint32_t len) { diff --git a/src/common/AESCrypto.h b/src/common/AESCrypto.h index ad012900..8f87a535 100644 --- a/src/common/AESCrypto.h +++ b/src/common/AESCrypto.h @@ -114,29 +114,116 @@ namespace crypto uint32_t m_Nk; uint32_t m_Nr; + /** + * @brief Substitutes bytes in the state using the S-Box. + * @param state The state array to substitute bytes in. + */ void subBytes(uint8_t state[4][AES_NB]); + /** + * @brief Inverse substitutes bytes in the state using the inverse S-Box. + * @param state The state array to inverse substitute bytes in. + */ void invSubBytes(uint8_t state[4][AES_NB]); + /** + * @brief Shifts the rows of the state to the left by a certain number of positions. + * @param state The state array to shift rows in. + * @param i The index of the row to shift. + * @param n The number of positions to shift the row. + */ void shiftRow(uint8_t state[4][AES_NB], uint32_t i, uint32_t n); // shift row i on n positions + /** + * @brief Inverse shifts the rows of the state to the right by a certain number of positions. + * @param state The state array to inverse shift rows in. + * @param i The index of the row to inverse shift. + * @param n The number of positions to inverse shift the row. + */ void shiftRows(uint8_t state[4][AES_NB]); + /** + * @brief Inverse shifts the rows of the state to the right by a certain number of positions. + * @param state The state array to inverse shift rows in. + */ void invShiftRows(uint8_t state[4][AES_NB]); + /** + * @brief Performs the xtime operation on a byte. + * @param b The byte to perform the xtime operation on. + * @returns uint8_t The result of the xtime operation. + */ uint8_t xtime(uint8_t b) { return (b << 1) ^ (((b >> 7) & 1) * 0x1BU); } + /** + * @brief Multiplies two bytes in the Galois field GF(2^8). + * @param a The first byte. + * @param b The second byte. + * @returns uint8_t The result of the multiplication in GF(2^8). + */ void mixColumns(uint8_t state[4][AES_NB]); + /** + * @brief Inverse multiplies the columns of the state in the Galois field GF(2^8). + * @param state The state array to inverse multiply columns in. + */ void invMixColumns(uint8_t state[4][AES_NB]); + /** + * @brief Adds the round key to the state. + * @param state The state array to add the round key to. + * @param key The round key to add to the state. + */ void addRoundKey(uint8_t state[4][AES_NB], uint8_t* key); + /** + * @brief Substitutes a word using the S-Box. + * @param a The word to substitute. + */ void subWord(uint8_t* a); + /** + * @brief Rotates a word by shifting its bytes to the left. + * @param a The word to rotate. + */ void rotWord(uint8_t* a); + /** + * @brief Performs the XOR operation on two words and stores the result in a third word. + * @param a The first word. + * @param b The second word. + * @param c The word to store the result of the XOR operation. + */ void xorWords(uint8_t* a, uint8_t* b, uint8_t* c); + /** + * @brief Performs the round constants operation on a word. + * @param a The word to perform the round constants operation on. + * @param n The round number for the round constants operation. + */ void rCon(uint8_t* a, uint32_t n); + /** + * @brief Expands the encryption key into round keys for the AES algorithm. + * @param key The encryption key. + * @param w The array to store the expanded round keys. + */ void keyExpansion(const uint8_t key[], uint8_t w[]); - + + /** + * @brief Encrypts a single block of data using the AES algorithm. + * @param in The input block to encrypt. + * @param out The output block to store the encrypted data. + * @param roundKeys The expanded round keys for the AES algorithm. + */ void encryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys); + /** + * @brief Decrypts a single block of data using the AES algorithm. + * @param in The input block to decrypt. + * @param out The output block to store the decrypted data. + * @param roundKeys The expanded round keys for the AES algorithm. + */ void decryptBlock(const uint8_t in[], uint8_t out[], uint8_t* roundKeys); + /** + * @brief Performs the XOR operation on two blocks of data. + * @param a The first block of data. + * @param b The second block of data. + * @param c The block to store the result of the XOR operation. + * @param len The length of the blocks in bytes. + */ void xorBlocks(const uint8_t* a, const uint8_t* b, uint8_t* c, uint32_t len); }; } // namespace crypto diff --git a/src/common/Clock.cpp b/src/common/Clock.cpp index 9143ac0b..63b8fca8 100644 --- a/src/common/Clock.cpp +++ b/src/common/Clock.cpp @@ -51,7 +51,7 @@ int gettimeofday(struct timeval* tv, struct timezone* tzp) } #endif // defined(_WIN32) -/* */ +/* Calculates the difference between two NTP timestamps in milliseconds. */ static inline uint32_t ntpDiffMS(uint64_t older, uint64_t newer) { diff --git a/src/common/DESCrypto.cpp b/src/common/DESCrypto.cpp index 7871ca88..99300d04 100644 --- a/src/common/DESCrypto.cpp +++ b/src/common/DESCrypto.cpp @@ -229,7 +229,7 @@ uint8_t* DES::fromValue(const ulong64_t value) return payload; } -/* */ +/* Generates the subkeys for the DES algorithm. */ void DES::generateSubkeys(uint64_t key) { @@ -262,7 +262,7 @@ void DES::generateSubkeys(uint64_t key) } } -/* */ +/* Encrypts or decrypts a block of data using the DES algorithm. */ ulong64_t DES::des(ulong64_t block, bool decrypt) { @@ -286,7 +286,7 @@ ulong64_t DES::des(ulong64_t block, bool decrypt) return finalPermutation(block); } -/* */ +/* Performs the initial permutation on a block of data. */ ulong64_t DES::intialPermutation(ulong64_t block) { @@ -300,7 +300,7 @@ ulong64_t DES::intialPermutation(ulong64_t block) return result; } -/* */ +/* Performs the final permutation on a block of data. */ ulong64_t DES::finalPermutation(ulong64_t block) { @@ -314,7 +314,7 @@ ulong64_t DES::finalPermutation(ulong64_t block) return result; } -/* */ +/* Performs the Feistel function on a block of data. */ void DES::feistel(uint32_t& L, uint32_t& R, uint32_t F) { @@ -323,7 +323,7 @@ void DES::feistel(uint32_t& L, uint32_t& R, uint32_t F) L = temp; } -/* */ +/* The f function used in the Feistel network. */ uint32_t DES::f(uint32_t R, ulong64_t k) { diff --git a/src/common/DESCrypto.h b/src/common/DESCrypto.h index d437d614..6d7fcbf3 100644 --- a/src/common/DESCrypto.h +++ b/src/common/DESCrypto.h @@ -53,17 +53,59 @@ namespace crypto private: uint64_t sub_key[16]; // 48 bits each + /** + * @brief Internal helper to convert payload bytes to a 64-bit long value. + * @param payload Pointer to the byte array. + * @returns ulong64_t The 64-bit value. + */ static ulong64_t toValue(const uint8_t* payload); + /** + * @brief Internal helper to convert a 64-bit long value to payload bytes. + * @param value The 64-bit value. + * @returns uint8_t* Pointer to the byte array. + */ static uint8_t* fromValue(const ulong64_t value); + /** + * @brief Generates the subkeys for the DES algorithm. + * @param key The encryption key. + */ void generateSubkeys(uint64_t key); + /** + * @brief Encrypts or decrypts a block of data using the DES algorithm. + * @param block The input block to encrypt or decrypt. + * @param decrypt A boolean indicating whether to decrypt (true) or encrypt (false). + * @returns ulong64_t The encrypted or decrypted block. + */ ulong64_t des(ulong64_t block, bool decrypt); + /** + * @brief Performs the initial permutation on a block of data. + * @param block The input block to permute. + * @returns ulong64_t The permuted block. + */ ulong64_t intialPermutation(ulong64_t block); + /** + * @brief Performs the final permutation on a block of data. + * @param block The input block to permute. + * @returns ulong64_t The permuted block. + */ ulong64_t finalPermutation(ulong64_t block); + /** + * @brief Performs the Feistel function on a block of data. + * @param L The left half of the block. + * @param R The right half of the block. + * @param F The output of the f function. + */ void feistel(uint32_t& L, uint32_t& R, uint32_t F); + /** + * @brief The f function used in the Feistel network. + * @param R The right half of the block. + * @param k The subkey for the current round. + * @returns uint32_t The output of the f function. + */ uint32_t f(uint32_t R, ulong64_t k); }; } // namespace crypto diff --git a/src/common/RC4Crypto.cpp b/src/common/RC4Crypto.cpp index 78c9e6cf..ad9825e5 100644 --- a/src/common/RC4Crypto.cpp +++ b/src/common/RC4Crypto.cpp @@ -62,7 +62,7 @@ uint8_t* RC4::keystream(uint32_t len, const uint8_t key[], uint32_t keyLen) // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Swaps two values in the permutation array. */ void RC4::swap(uint8_t* a, uint8_t i1, uint8_t i2) { @@ -71,7 +71,7 @@ void RC4::swap(uint8_t* a, uint8_t i1, uint8_t i2) a[i2] = temp; } -/* */ +/* Initializes the permutation array with the given key. */ void RC4::init(const uint8_t key[], uint8_t keyLen, uint8_t* permutation) { @@ -93,7 +93,7 @@ void RC4::init(const uint8_t key[], uint8_t keyLen, uint8_t* permutation) } } -/* */ +/* Transforms the input buffer using the given permutation array. */ void RC4::transform(const uint8_t* input, uint32_t length, uint8_t* permutation, uint8_t* output, bool ksOnly) { diff --git a/src/common/RC4Crypto.h b/src/common/RC4Crypto.h index c0927146..4b31b857 100644 --- a/src/common/RC4Crypto.h +++ b/src/common/RC4Crypto.h @@ -67,8 +67,28 @@ namespace crypto uint32_t m_i1; uint32_t m_i2; + /** + * @brief Swaps two values in the permutation array. + * @param a Pointer to the permutation array. + * @param i1 Index of the first value to swap. + * @param i2 Index of the second value to swap. + */ void swap(uint8_t* a, uint8_t i1, uint8_t i2); + /** + * @brief Initializes the permutation array with the given key. + * @param key Pointer to the encryption key. + * @param keyLen Length of the encryption key. + * @param permutation Pointer to the permutation array to initialize. + */ void init(const uint8_t key[], uint8_t keyLen, uint8_t* permutation); + /** + * @brief Transforms the input buffer using the given permutation array. + * @param input Pointer to the input buffer. + * @param length Length of the input buffer. + * @param permutation Pointer to the permutation array. + * @param output Pointer to the output buffer. + * @param ksOnly If true, only generates the keystream without modifying the input + */ void transform(const uint8_t* input, uint32_t length, uint8_t* permutation, uint8_t* output, bool ksOnly); }; } // namespace crypto diff --git a/src/common/dmr/lc/ShortLC.cpp b/src/common/dmr/lc/ShortLC.cpp index a61184a1..fe7b06b2 100644 --- a/src/common/dmr/lc/ShortLC.cpp +++ b/src/common/dmr/lc/ShortLC.cpp @@ -87,7 +87,7 @@ void ShortLC::encode(const uint8_t* in, uint8_t* out) // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Extracts the raw binary data from the input bytes. */ void ShortLC::decodeExtractBinary(const uint8_t* in) { @@ -104,7 +104,7 @@ void ShortLC::decodeExtractBinary(const uint8_t* in) Utils::byteToBitsBE(in[8U], m_rawData + 64U); } -/* */ +/* Helper function to deinterleave the raw binary data. */ void ShortLC::decodeDeInterleave() { @@ -121,7 +121,7 @@ void ShortLC::decodeDeInterleave() m_deInterData[67U] = m_rawData[67U]; } -/* */ +/* Helper function to perform error checking on the deinterleaved data. */ bool ShortLC::decodeErrorCheck() { @@ -140,7 +140,7 @@ bool ShortLC::decodeErrorCheck() return true; } -/* */ +/* Extracts the raw short-link control data from the deinterleaved data. */ void ShortLC::decodeExtractData(uint8_t* data) const { @@ -168,7 +168,7 @@ void ShortLC::decodeExtractData(uint8_t* data) const Utils::bitsToByteBE(bData + 32U, data[4U]); } -/* */ +/* Extracts the raw short-link control data from the input buffer and prepares it for encoding. */ void ShortLC::encodeExtractData(const uint8_t* in) const { @@ -195,7 +195,7 @@ void ShortLC::encodeExtractData(const uint8_t* in) const m_deInterData[a] = bData[pos]; } -/* */ +/* Helper function to perform error checking on the data before encoding. */ void ShortLC::encodeErrorCheck() { @@ -209,7 +209,7 @@ void ShortLC::encodeErrorCheck() m_deInterData[c + 51U] = m_deInterData[c + 0U] ^ m_deInterData[c + 17U] ^ m_deInterData[c + 34U]; } -/* */ +/* Helper function to interleave the data before encoding. */ void ShortLC::encodeInterleave() { @@ -227,7 +227,7 @@ void ShortLC::encodeInterleave() m_rawData[67U] = m_deInterData[67U]; } -/* */ +/* Extracts the encoded short-link control data from the interleaved data and prepares it for output. */ void ShortLC::encodeExtractBinary(uint8_t* data) { diff --git a/src/common/dmr/lc/ShortLC.h b/src/common/dmr/lc/ShortLC.h index 2dc4129c..f29cacb1 100644 --- a/src/common/dmr/lc/ShortLC.h +++ b/src/common/dmr/lc/ShortLC.h @@ -59,40 +59,41 @@ namespace dmr bool* m_deInterData; /** - * @brief - * @param[in] in + * @brief Extracts the raw binary data from the encoded short-link control data. + * @param[in] in Buffer containing encoded short-link control data. */ void decodeExtractBinary(const uint8_t* in); /** - * @brief + * @brief Helper function to deinterleave the raw binary data. */ void decodeDeInterleave(); /** - * @brief + * @brief Helper function to perform error checking on the deinterleaved data. + * @return True if the error check passes, false otherwise. */ bool decodeErrorCheck(); /** - * @brief - * @param[out] data + * @brief Extracts the raw short-link control data from the deinterleaved data. + * @param[out] data Buffer to copy raw short-link control data. */ void decodeExtractData(uint8_t* data) const; /** - * @brief - * @param[in] in + * @brief Extracts the raw short-link control data from the input buffer and prepares it for encoding. + * @param[in] in Buffer containing raw short-link control data. */ void encodeExtractData(const uint8_t* in) const; /** - * @brief + * @brief Helper function to perform error checking on the data before encoding. */ void encodeErrorCheck(); /** - * @brief + * @brief Helper function to interleave the data before encoding. */ void encodeInterleave(); /** - * @brief - * @param[out] data + * @brief Extracts the encoded short-link control data from the interleaved data and prepares it for output. + * @param[out] data Buffer to copy encoded short-link control data. */ void encodeExtractBinary(uint8_t* data); }; diff --git a/src/common/edac/AMBEFEC.cpp b/src/common/edac/AMBEFEC.cpp index 17c20f40..5aff0665 100644 --- a/src/common/edac/AMBEFEC.cpp +++ b/src/common/edac/AMBEFEC.cpp @@ -559,7 +559,7 @@ uint32_t AMBEFEC::measureNXDNBER(uint8_t* bytes) const // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Regenerates the AMBE FEC for the input words. */ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const { diff --git a/src/common/edac/AMBEFEC.h b/src/common/edac/AMBEFEC.h index 1a34b524..6e46bd0e 100644 --- a/src/common/edac/AMBEFEC.h +++ b/src/common/edac/AMBEFEC.h @@ -516,10 +516,10 @@ namespace edac private: /** - * @brief - * @param a - * @param b - * @param c + * @brief Regenerates the AMBE FEC for the input bytes. + * @param a Reference to the A word. + * @param b Reference to the B word. + * @param c Reference to the C word. * @returns uint32_t Count of errors. */ uint32_t regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const; diff --git a/src/common/edac/BPTC19696.cpp b/src/common/edac/BPTC19696.cpp index 122a5240..2ad9f5ba 100644 --- a/src/common/edac/BPTC19696.cpp +++ b/src/common/edac/BPTC19696.cpp @@ -83,7 +83,7 @@ void BPTC19696::encode(const uint8_t* in, uint8_t* out) // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Helper to extract the raw binary data from the input. */ void BPTC19696::decodeExtractBinary(const uint8_t* in) { @@ -123,7 +123,7 @@ void BPTC19696::decodeExtractBinary(const uint8_t* in) Utils::byteToBitsBE(in[32U], m_rawData + 188U); } -/* */ +/* Helper to deinterleave the raw binary data. */ void BPTC19696::decodeDeInterleave() { @@ -139,7 +139,7 @@ void BPTC19696::decodeDeInterleave() } } -/* */ +/* Helper to perform error checking and correction on the deinterleaved data. */ void BPTC19696::decodeErrorCheck() { @@ -179,7 +179,7 @@ void BPTC19696::decodeErrorCheck() } while (fixing && count < 5U); } -/* */ +/* Helper to extract the decoded data from the deinterleaved data. */ void BPTC19696::decodeExtractData(uint8_t* data) const { @@ -226,7 +226,7 @@ void BPTC19696::decodeExtractData(uint8_t* data) const Utils::bitsToByteBE(bData + 88U, data[11U]); } -/* */ +/* Helper to encode the input data into the deinterleaved data. */ void BPTC19696::encodeExtractData(const uint8_t* in) const { @@ -276,7 +276,7 @@ void BPTC19696::encodeExtractData(const uint8_t* in) const m_deInterData[a] = bData[pos]; } -/* */ +/* Helper to perform error checking and correction on the deinterleaved data. */ void BPTC19696::encodeErrorCheck() { @@ -305,7 +305,7 @@ void BPTC19696::encodeErrorCheck() } } -/* */ +/* Helper to interleave the deinterleaved data into the raw binary data. */ void BPTC19696::encodeInterleave() { @@ -321,7 +321,7 @@ void BPTC19696::encodeInterleave() } } -/* */ +/* Helper to extract the raw binary data from the deinterleaved data. */ void BPTC19696::encodeExtractBinary(uint8_t* data) { diff --git a/src/common/edac/BPTC19696.h b/src/common/edac/BPTC19696.h index 5cebd355..584e67f2 100644 --- a/src/common/edac/BPTC19696.h +++ b/src/common/edac/BPTC19696.h @@ -57,39 +57,40 @@ namespace edac bool* m_deInterData; /** - * @brief - * @param in + * @brief Helper to extract the raw binary data from the input. + * @param in Input data to extract. */ void decodeExtractBinary(const uint8_t* in); /** - * @brief + * @brief Helper to perform error checking and correction on the deinterleaved data. */ void decodeErrorCheck(); /** - * @brief + * @brief Helper to deinterleave the raw binary data. */ void decodeDeInterleave(); /** - * @brief - * @param data + * @brief Helper to extract the decoded data from the deinterleaved data. + * @param data Output data to extract. */ void decodeExtractData(uint8_t* data) const; /** - * @brief + * @brief Helper to encode the input data into the deinterleaved data. + * @param in Input data to encode. */ void encodeExtractData(const uint8_t* in) const; /** - * @brief + * @brief Helper to interleave the deinterleaved data into the raw binary data. */ void encodeInterleave(); /** - * @brief + * @brief Helper to perform error checking and correction on the deinterleaved data. */ void encodeErrorCheck(); /** - * @brief - * @param data + * @brief Helper to extract the raw binary data from the deinterleaved data. + * @param data Output data to extract. */ void encodeExtractBinary(uint8_t* data); }; diff --git a/src/common/edac/RS129.cpp b/src/common/edac/RS129.cpp index 89edde74..e8b32043 100644 --- a/src/common/edac/RS129.cpp +++ b/src/common/edac/RS129.cpp @@ -120,7 +120,7 @@ void RS129::encode(const uint8_t* msg, uint32_t nbytes, uint8_t* parity) // Private Static Class Members // --------------------------------------------------------------------------- -/* */ +/* Helper to multiply two numbers in GF(2^8) using the log and exponent tables. */ uint8_t RS129::gmult(uint8_t a, uint8_t b) { diff --git a/src/common/edac/RS129.h b/src/common/edac/RS129.h index 026b01a3..f1970f73 100644 --- a/src/common/edac/RS129.h +++ b/src/common/edac/RS129.h @@ -51,7 +51,10 @@ namespace edac private: /** - * @brief + * @brief Helper to multiply two numbers in GF(2^8) using the log and exponent tables. + * @param a First number. + * @param b Second number. + * @returns uint8_t Product of a and b. */ static uint8_t gmult(uint8_t a, uint8_t b); }; diff --git a/src/common/network/udp/Socket.cpp b/src/common/network/udp/Socket.cpp index 104089e3..ff0c282a 100644 --- a/src/common/network/udp/Socket.cpp +++ b/src/common/network/udp/Socket.cpp @@ -812,7 +812,7 @@ std::string Socket::getLocalAddress() #endif // defined(_WIN32) } -/* */ +/* Helper to match two socket addresses based on the specified match type. */ bool Socket::match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type) { diff --git a/src/common/network/udp/Socket.h b/src/common/network/udp/Socket.h index b094c4bf..a5753ef2 100644 --- a/src/common/network/udp/Socket.h +++ b/src/common/network/udp/Socket.h @@ -300,7 +300,7 @@ namespace network static std::string getLocalAddress(); /** - * @brief + * @brief Helper to match two socket addresses based on the specified match type. * @param addr1 Instance of sockaddr_storage socket address structure. * @param addr2 Instance of sockaddr_storage socket address structure. * @param type IPMATCHTYPE. diff --git a/src/common/nxdn/edac/Convolution.cpp b/src/common/nxdn/edac/Convolution.cpp index fc81ce78..62a767a7 100644 --- a/src/common/nxdn/edac/Convolution.cpp +++ b/src/common/nxdn/edac/Convolution.cpp @@ -69,7 +69,7 @@ void Convolution::start() m_dp = m_decisions; } -/* */ +/* Performs chainback to determine the most likely transmitted sequence. */ uint32_t Convolution::chainback(uint8_t* out, uint32_t nBits) { @@ -97,7 +97,7 @@ uint32_t Convolution::chainback(uint8_t* out, uint32_t nBits) return minCost / (M >> 1); } -/* */ +/* Starts convolution decoding for a single pair of received symbols. */ bool Convolution::decode(uint8_t s0, uint8_t s1) { @@ -134,7 +134,7 @@ bool Convolution::decode(uint8_t s0, uint8_t s1) return true; } -/* */ +/* Performs convolution encoding on the input bit sequence. */ void Convolution::encode(const uint8_t* in, uint8_t* out, uint32_t nBits) const { diff --git a/src/common/nxdn/edac/Convolution.h b/src/common/nxdn/edac/Convolution.h index 7254d17c..18862ddd 100644 --- a/src/common/nxdn/edac/Convolution.h +++ b/src/common/nxdn/edac/Convolution.h @@ -53,25 +53,25 @@ namespace nxdn */ void start(); /** - * @brief - * @param out - * @param nBits - * @returns uint32_t + * @brief Performs chainback to determine the most likely transmitted sequence. + * @param out Buffer to store the decoded output bits. + * @param nBits Number of bits to decode. + * @returns uint32_t Minimum path metric. */ uint32_t chainback(uint8_t* out, uint32_t nBits); /** - * @brief - * @param s0 - * @param s1 - * @returns bool + * @brief Starts convolution decoding for a single pair of received symbols. + * @param s0 First received symbol. + * @param s1 Second received symbol. + * @returns bool True if decoding was successful, false otherwise. */ bool decode(uint8_t s0, uint8_t s1); /** - * @brief - * @param[in] in - * @param[out] out - * @param nBits + * @brief Performs convolution encoding on the input bit sequence. + * @param[in] in Input buffer containing the bits to encode. + * @param[out] out Output buffer to store the encoded bits. + * @param nBits Number of bits to encode. */ void encode(const uint8_t* in, uint8_t* out, uint32_t nBits) const; diff --git a/src/common/p25/Crypto.cpp b/src/common/p25/Crypto.cpp index 3dbcf204..5c525fbf 100644 --- a/src/common/p25/Crypto.cpp +++ b/src/common/p25/Crypto.cpp @@ -819,7 +819,7 @@ void P25Crypto::clearKey() // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Helper to step the linear feedback shift register (LFSR). */ uint64_t P25Crypto::stepLFSR(uint64_t& lfsr) { diff --git a/src/common/p25/Crypto.h b/src/common/p25/Crypto.h index b267adac..81c08bb0 100644 --- a/src/common/p25/Crypto.h +++ b/src/common/p25/Crypto.h @@ -218,9 +218,10 @@ namespace p25 std::mt19937 m_random; /** - * @brief - * @param lfsr - * @return uint64_t + * @brief Helper to step the linear feedback shift register (LFSR). + * @note This uses the polynomial: x^64 + x^62 + x^46 + x^38 + x^27 + x^15 + 1 + * @param lfsr Linear feedback shift register value. + * @return uint64_t The next LFSR value. */ uint64_t stepLFSR(uint64_t& lfsr); /** diff --git a/src/common/p25/data/LowSpeedData.cpp b/src/common/p25/data/LowSpeedData.cpp index 1cd6c111..08004d9f 100644 --- a/src/common/p25/data/LowSpeedData.cpp +++ b/src/common/p25/data/LowSpeedData.cpp @@ -133,7 +133,7 @@ void LowSpeedData::encode(uint8_t* data) const // Private Class Members // --------------------------------------------------------------------------- -/* */ +/* Helper to encode a single byte using the CCS parity table. */ uint8_t LowSpeedData::encode(uint8_t in) const { diff --git a/src/common/p25/data/LowSpeedData.h b/src/common/p25/data/LowSpeedData.h index 03382913..04ee56e8 100644 --- a/src/common/p25/data/LowSpeedData.h +++ b/src/common/p25/data/LowSpeedData.h @@ -71,8 +71,9 @@ namespace p25 private: /** - * @brief - * @param in + * @brief Helper to encode a single byte using the CCS parity table. + * @param in Byte to encode. + * @returns uint8_t Encoded byte. */ uint8_t encode(const uint8_t in) const; }; diff --git a/src/common/p25/dfsi/frames/FullRateVoice.cpp b/src/common/p25/dfsi/frames/FullRateVoice.cpp index b9c67707..1eab396f 100644 --- a/src/common/p25/dfsi/frames/FullRateVoice.cpp +++ b/src/common/p25/dfsi/frames/FullRateVoice.cpp @@ -67,7 +67,7 @@ FullRateVoice::~FullRateVoice() delete[] additionalData; } -/* */ +/* Gets the length of the full rate voice frame. */ uint8_t FullRateVoice::getLength() { diff --git a/src/common/p25/dfsi/frames/FullRateVoice.h b/src/common/p25/dfsi/frames/FullRateVoice.h index ac34cd0d..f4e8eaf0 100644 --- a/src/common/p25/dfsi/frames/FullRateVoice.h +++ b/src/common/p25/dfsi/frames/FullRateVoice.h @@ -207,8 +207,8 @@ namespace p25 ~FullRateVoice(); /** - * @brief - * @returns uint8_t + * @brief Gets the length of the full rate voice frame. + * @returns uint8_t Length of the full rate voice frame. */ uint8_t getLength(); diff --git a/src/common/p25/dfsi/frames/MotFullRateVoice.cpp b/src/common/p25/dfsi/frames/MotFullRateVoice.cpp index 55279558..462a4377 100644 --- a/src/common/p25/dfsi/frames/MotFullRateVoice.cpp +++ b/src/common/p25/dfsi/frames/MotFullRateVoice.cpp @@ -67,7 +67,7 @@ MotFullRateVoice::~MotFullRateVoice() delete[] additionalData; } -/* */ +/* Gets the size of the full rate voice frame. */ uint32_t MotFullRateVoice::size() { diff --git a/src/common/p25/dfsi/frames/MotFullRateVoice.h b/src/common/p25/dfsi/frames/MotFullRateVoice.h index 06c43616..1c2e1349 100644 --- a/src/common/p25/dfsi/frames/MotFullRateVoice.h +++ b/src/common/p25/dfsi/frames/MotFullRateVoice.h @@ -74,7 +74,8 @@ namespace p25 ~MotFullRateVoice(); /** - * @brief + * @brief Gets the size of the full rate voice frame. + * @returns uint32_t Size of the full rate voice frame. */ uint32_t size(); /** diff --git a/src/host/dmr/packet/Voice.cpp b/src/host/dmr/packet/Voice.cpp index 272b1bf7..b93a6efe 100644 --- a/src/host/dmr/packet/Voice.cpp +++ b/src/host/dmr/packet/Voice.cpp @@ -1327,7 +1327,7 @@ bool Voice::checkNetTrafficCollision(uint32_t dstId) return false; } -/* */ +/* Logs the GPS position for a given source ID. */ void Voice::logGPSPosition(const uint32_t srcId, const uint8_t* data) { diff --git a/src/host/dmr/packet/Voice.h b/src/host/dmr/packet/Voice.h index 6a52d1c6..9638d3c9 100644 --- a/src/host/dmr/packet/Voice.h +++ b/src/host/dmr/packet/Voice.h @@ -127,7 +127,7 @@ namespace dmr bool checkNetTrafficCollision(uint32_t dstId); /** - * @brief Log GPS information. + * @brief Logs the GPS position for a given source ID. * @param srcId Source radio ID. * @param[in] data Buffer containing GPS data. */ diff --git a/src/host/setup/HostSetup.cpp b/src/host/setup/HostSetup.cpp index 60084852..98c75b90 100644 --- a/src/host/setup/HostSetup.cpp +++ b/src/host/setup/HostSetup.cpp @@ -2086,7 +2086,7 @@ bool HostSetup::writeFlash() return true; } -/* */ +/* Reboots the modem into ST bootloader mode. */ void HostSetup::writeBootload() { diff --git a/src/host/setup/HostSetup.h b/src/host/setup/HostSetup.h index 9f5b68e5..52f48365 100644 --- a/src/host/setup/HostSetup.h +++ b/src/host/setup/HostSetup.h @@ -325,7 +325,7 @@ protected: bool writeFlash(); /** - * @brief + * @brief Reboots the modem into ST bootloader mode. */ void writeBootload(); diff --git a/src/remote/RESTClient.cpp b/src/remote/RESTClient.cpp index 393fbbc5..c635d809 100644 --- a/src/remote/RESTClient.cpp +++ b/src/remote/RESTClient.cpp @@ -55,7 +55,7 @@ bool RESTClient::s_debug = false; // Global Functions // --------------------------------------------------------------------------- -/* */ +/* Parses the JSON response body from the HTTP response. */ bool parseResponseBody(const HTTPPayload& response, json::object& obj) { diff --git a/src/sysview/HostWS.cpp b/src/sysview/HostWS.cpp index ddab6aa5..ef473e4e 100644 --- a/src/sysview/HostWS.cpp +++ b/src/sysview/HostWS.cpp @@ -445,7 +445,7 @@ int HostWS::run() return EXIT_SUCCESS; } -/* */ +/* Sends a JSON object to all connected WebSocket clients. */ void HostWS::send(json::object obj) { diff --git a/src/sysview/HostWS.h b/src/sysview/HostWS.h index 4ec2c0ac..9bf1a186 100644 --- a/src/sysview/HostWS.h +++ b/src/sysview/HostWS.h @@ -60,8 +60,8 @@ public: int run(); /** - * @brief - * @param obj + * @brief Sends a JSON object to all connected WebSocket clients. + * @param obj JSON object to send. */ void send(json::object obj); diff --git a/src/sysview/SysViewMain.cpp b/src/sysview/SysViewMain.cpp index add3b900..949372b6 100644 --- a/src/sysview/SysViewMain.cpp +++ b/src/sysview/SysViewMain.cpp @@ -263,7 +263,7 @@ bool createPeerNetwork() return true; } -/* */ +/* Gets the current network instance. */ network::PeerNetwork* getNetwork() { diff --git a/src/sysview/SysViewMain.h b/src/sysview/SysViewMain.h index 783c591d..98c5754e 100644 --- a/src/sysview/SysViewMain.h +++ b/src/sysview/SysViewMain.h @@ -116,8 +116,8 @@ extern HOST_SW_API bool createPeerNetwork(); extern HOST_SW_API bool startNetworkPumpThread(); /** - * @brief - * @returns PeerNetwork* + * @brief Gets the current network instance. + * @returns PeerNetwork* Instance of the current network. */ extern HOST_SW_API network::PeerNetwork* getNetwork();