diff --git a/examples/apps/cli/cli_uart.cpp b/examples/apps/cli/cli_uart.cpp index b7fa5028d..96fa9dc5e 100644 --- a/examples/apps/cli/cli_uart.cpp +++ b/examples/apps/cli/cli_uart.cpp @@ -137,7 +137,7 @@ static void ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength) static const char sEraseString[] = {'\b', ' ', '\b'}; static const char CRNL[] = {'\r', '\n'}; static uint8_t sLastChar = '\0'; - const uint8_t * end; + const uint8_t *end; end = aBuf + aBufLength; diff --git a/examples/platforms/simulation/crypto.c b/examples/platforms/simulation/crypto.c index 36cf89be6..b220f7cb5 100644 --- a/examples/platforms/simulation/crypto.c +++ b/examples/platforms/simulation/crypto.c @@ -38,12 +38,12 @@ // crypto key storage stubs -otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef, +otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, - const uint8_t * aKey, + const uint8_t *aKey, size_t aKeyLen) { OT_UNUSED_VARIABLE(aKeyRef); diff --git a/examples/platforms/simulation/entropy.c b/examples/platforms/simulation/entropy.c index bcb04a420..b567b0b63 100644 --- a/examples/platforms/simulation/entropy.c +++ b/examples/platforms/simulation/entropy.c @@ -93,7 +93,7 @@ otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) #if __SANITIZE_ADDRESS__ == 0 - FILE * file = NULL; + FILE *file = NULL; size_t readLength; otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS); diff --git a/examples/platforms/simulation/infra_if.c b/examples/platforms/simulation/infra_if.c index 67cb9f752..1904d75d6 100644 --- a/examples/platforms/simulation/infra_if.c +++ b/examples/platforms/simulation/infra_if.c @@ -41,7 +41,7 @@ bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddres otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address *aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength) { OT_UNUSED_VARIABLE(aInfraIfIndex); diff --git a/examples/platforms/simulation/radio.c b/examples/platforms/simulation/radio.c index 4d6ab8810..922a50b0f 100644 --- a/examples/platforms/simulation/radio.c +++ b/examples/platforms/simulation/radio.c @@ -207,7 +207,7 @@ otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[]) else if (!strcmp(aArgs[0], "deny")) { uint16_t nodeId; - char * endptr; + char *endptr; otEXPECT_ACTION(aArgsLength == 2, error = OT_ERROR_INVALID_ARGS); @@ -1276,7 +1276,7 @@ static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData, uint8_t aLinkMetri #endif #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE -otError otPlatRadioEnableCsl(otInstance * aInstance, +otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr) @@ -1307,7 +1307,7 @@ uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance) } #endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE -void otPlatRadioSetMacKey(otInstance * aInstance, +void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKeyMaterial *aPrevKey, @@ -1351,10 +1351,10 @@ exit: } #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, +otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, const otShortAddress aShortAddress, - const otExtAddress * aExtAddress) + const otExtAddress *aExtAddress) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/simulation/spi-stubs.c b/examples/platforms/simulation/spi-stubs.c index 585bca7b0..cb1f16b26 100644 --- a/examples/platforms/simulation/spi-stubs.c +++ b/examples/platforms/simulation/spi-stubs.c @@ -40,7 +40,7 @@ otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback, otPlatSpiSlaveTransactionProcessCallback aProcessCallback, - void * aContext) + void *aContext) { OT_UNUSED_VARIABLE(aCompleteCallback); OT_UNUSED_VARIABLE(aProcessCallback); diff --git a/examples/platforms/simulation/system.c b/examples/platforms/simulation/system.c index f9282a64a..01ab61ef4 100644 --- a/examples/platforms/simulation/system.c +++ b/examples/platforms/simulation/system.c @@ -94,7 +94,7 @@ static void PrintUsage(const char *aProgramName, int aExitCode) void otSysInit(int aArgCount, char *aArgVector[]) { - char * endptr; + char *endptr; uint32_t speedUpFactor = 1; static const struct option long_options[] = { diff --git a/examples/platforms/simulation/trel.c b/examples/platforms/simulation/trel.c index 20c6b3057..d43a1542c 100644 --- a/examples/platforms/simulation/trel.c +++ b/examples/platforms/simulation/trel.c @@ -366,8 +366,8 @@ void otPlatTrelRegisterService(otInstance *aInstance, uint16_t aPort, const uint #endif } -void otPlatTrelSend(otInstance * aInstance, - const uint8_t * aUdpPayload, +void otPlatTrelSend(otInstance *aInstance, + const uint8_t *aUdpPayload, uint16_t aUdpPayloadLen, const otSockAddr *aDestSockAddr) { diff --git a/examples/platforms/simulation/uart.c b/examples/platforms/simulation/uart.c index 3bbcface5..fb150c4d5 100644 --- a/examples/platforms/simulation/uart.c +++ b/examples/platforms/simulation/uart.c @@ -241,8 +241,8 @@ void platformUartProcess(void) ssize_t rval; const int error_flags = POLLERR | POLLNVAL | POLLHUP; struct pollfd pollfd[] = { - {s_in_fd, POLLIN | error_flags, 0}, - {s_out_fd, POLLOUT | error_flags, 0}, + {s_in_fd, POLLIN | error_flags, 0}, + {s_out_fd, POLLOUT | error_flags, 0}, }; errno = 0; diff --git a/examples/platforms/utils/mac_frame.cpp b/examples/platforms/utils/mac_frame.cpp index de238832c..2a5192bba 100644 --- a/examples/platforms/utils/mac_frame.cpp +++ b/examples/platforms/utils/mac_frame.cpp @@ -164,9 +164,9 @@ void otMacFrameGenerateImmAck(const otRadioFrame *aFrame, bool aIsFramePending, #if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame, bool aIsFramePending, - const uint8_t * aIeData, + const uint8_t *aIeData, uint8_t aIeLength, - otRadioFrame * aAckFrame) + otRadioFrame *aAckFrame) { assert(aFrame != nullptr && aAckFrame != nullptr); diff --git a/examples/platforms/utils/mac_frame.h b/examples/platforms/utils/mac_frame.h index 8f0c6794f..1853ed1a1 100644 --- a/examples/platforms/utils/mac_frame.h +++ b/examples/platforms/utils/mac_frame.h @@ -221,9 +221,9 @@ void otMacFrameGenerateImmAck(const otRadioFrame *aFrame, bool aIsFramePending, */ otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame, bool aIsFramePending, - const uint8_t * aIeData, + const uint8_t *aIeData, uint8_t aIeLength, - otRadioFrame * aAckFrame); + otRadioFrame *aAckFrame); /** * Set CSL IE content into the frame. diff --git a/include/openthread/backbone_router_ftd.h b/include/openthread/backbone_router_ftd.h index 6001d7454..d4041d68a 100644 --- a/include/openthread/backbone_router_ftd.h +++ b/include/openthread/backbone_router_ftd.h @@ -207,7 +207,7 @@ otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterCon * * */ -void otBackboneRouterConfigNextDuaRegistrationResponse(otInstance * aInstance, +void otBackboneRouterConfigNextDuaRegistrationResponse(otInstance *aInstance, const otIp6InterfaceIdentifier *aMlIid, uint8_t aStatus); @@ -242,9 +242,9 @@ typedef enum * @param[in] aAddress The IPv6 multicast address of the Multicast Listener. * */ -typedef void (*otBackboneRouterMulticastListenerCallback)(void * aContext, +typedef void (*otBackboneRouterMulticastListenerCallback)(void *aContext, otBackboneRouterMulticastListenerEvent aEvent, - const otIp6Address * aAddress); + const otIp6Address *aAddress); /** * This method sets the Backbone Router Multicast Listener callback. @@ -254,9 +254,9 @@ typedef void (*otBackboneRouterMulticastListenerCallback)(void * * @param[in] aContext A user context pointer. * */ -void otBackboneRouterSetMulticastListenerCallback(otInstance * aInstance, +void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance, otBackboneRouterMulticastListenerCallback aCallback, - void * aContext); + void *aContext); /** * Clears the Multicast Listeners. @@ -329,9 +329,9 @@ typedef struct otBackboneRouterMulticastListenerInfo * @sa otBackboneRouterMulticastListenerAdd * */ -otError otBackboneRouterMulticastListenerGetNext(otInstance * aInstance, +otError otBackboneRouterMulticastListenerGetNext(otInstance *aInstance, otBackboneRouterMulticastListenerIterator *aIterator, - otBackboneRouterMulticastListenerInfo * aListenerInfo); + otBackboneRouterMulticastListenerInfo *aListenerInfo); /** * Represents the ND Proxy events. @@ -354,9 +354,9 @@ typedef enum * `OT_BACKBONE_ROUTER_NDPROXY_CLEARED`. * */ -typedef void (*otBackboneRouterNdProxyCallback)(void * aContext, +typedef void (*otBackboneRouterNdProxyCallback)(void *aContext, otBackboneRouterNdProxyEvent aEvent, - const otIp6Address * aDua); + const otIp6Address *aDua); /** * This method sets the Backbone Router ND Proxy callback. @@ -366,9 +366,9 @@ typedef void (*otBackboneRouterNdProxyCallback)(void * aCo * @param[in] aContext A user context pointer. * */ -void otBackboneRouterSetNdProxyCallback(otInstance * aInstance, +void otBackboneRouterSetNdProxyCallback(otInstance *aInstance, otBackboneRouterNdProxyCallback aCallback, - void * aContext); + void *aContext); /** * Represents the Backbone Router ND Proxy info. @@ -392,8 +392,8 @@ typedef struct otBackboneRouterNdProxyInfo * @retval OT_ERROR_NOT_FOUND Failed to find the Domain Unicast Address in the ND Proxy table. * */ -otError otBackboneRouterGetNdProxyInfo(otInstance * aInstance, - const otIp6Address * aDua, +otError otBackboneRouterGetNdProxyInfo(otInstance *aInstance, + const otIp6Address *aDua, otBackboneRouterNdProxyInfo *aNdProxyInfo); /** @@ -415,9 +415,9 @@ typedef enum * @param[in] aDomainPrefix The new Domain Prefix if added or changed, nullptr otherwise. * */ -typedef void (*otBackboneRouterDomainPrefixCallback)(void * aContext, +typedef void (*otBackboneRouterDomainPrefixCallback)(void *aContext, otBackboneRouterDomainPrefixEvent aEvent, - const otIp6Prefix * aDomainPrefix); + const otIp6Prefix *aDomainPrefix); /** * This method sets the Backbone Router Domain Prefix callback. * @@ -426,9 +426,9 @@ typedef void (*otBackboneRouterDomainPrefixCallback)(void * * @param[in] aContext A user context pointer. * */ -void otBackboneRouterSetDomainPrefixCallback(otInstance * aInstance, +void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance, otBackboneRouterDomainPrefixCallback aCallback, - void * aContext); + void *aContext); /** * @} diff --git a/include/openthread/border_router.h b/include/openthread/border_router.h index fb7dab065..a945f91fb 100644 --- a/include/openthread/border_router.h +++ b/include/openthread/border_router.h @@ -105,9 +105,9 @@ otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefi * @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data. * */ -otError otBorderRouterGetNextOnMeshPrefix(otInstance * aInstance, +otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterator *aIterator, - otBorderRouterConfig * aConfig); + otBorderRouterConfig *aConfig); /** * Add an external route configuration to the local network data. @@ -150,7 +150,7 @@ otError otBorderRouterRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPre * @retval OT_ERROR_NOT_FOUND No subsequent external route entry exists in the Thread Network Data. * */ -otError otBorderRouterGetNextRoute(otInstance * aInstance, +otError otBorderRouterGetNextRoute(otInstance *aInstance, otNetworkDataIterator *aIterator, otExternalRouteConfig *aConfig); diff --git a/include/openthread/border_routing.h b/include/openthread/border_routing.h index d403d050f..ba8d40ee1 100644 --- a/include/openthread/border_routing.h +++ b/include/openthread/border_routing.h @@ -240,8 +240,8 @@ otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefi * @retval OT_ERROR_NONE Successfully retrieved the favored NAT64 prefix. * */ -otError otBorderRoutingGetFavoredNat64Prefix(otInstance * aInstance, - otIp6Prefix * aPrefix, +otError otBorderRoutingGetFavoredNat64Prefix(otInstance *aInstance, + otIp6Prefix *aPrefix, otRoutePreference *aPreference); /** @@ -271,9 +271,9 @@ void otBorderRoutingPrefixTableInitIterator(otInstance *aInstance, otBorderRouti * @retval OT_ERROR_NOT_FOUND No more entries in the table. * */ -otError otBorderRoutingGetNextPrefixTableEntry(otInstance * aInstance, +otError otBorderRoutingGetNextPrefixTableEntry(otInstance *aInstance, otBorderRoutingPrefixTableIterator *aIterator, - otBorderRoutingPrefixTableEntry * aEntry); + otBorderRoutingPrefixTableEntry *aEntry); /** * @} diff --git a/include/openthread/cli.h b/include/openthread/cli.h index dcc33411a..4a80c9e14 100644 --- a/include/openthread/cli.h +++ b/include/openthread/cli.h @@ -52,9 +52,9 @@ extern "C" { typedef struct otCliCommand { const char *mName; ///< A pointer to the command string. - otError (*mCommand)(void * aContext, + otError (*mCommand)(void *aContext, uint8_t aArgsLength, - char * aArgs[]); ///< A function pointer to process the command. + char *aArgs[]); ///< A function pointer to process the command. } otCliCommand; /** diff --git a/include/openthread/coap.h b/include/openthread/coap.h index c2e036bb2..30faca6f8 100644 --- a/include/openthread/coap.h +++ b/include/openthread/coap.h @@ -341,8 +341,8 @@ typedef enum otCoapBlockSzx * @retval OT_ERROR_RESPONSE_TIMEOUT No response or acknowledgment received during timeout period. * */ -typedef void (*otCoapResponseHandler)(void * aContext, - otMessage * aMessage, +typedef void (*otCoapResponseHandler)(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aResult); @@ -375,7 +375,7 @@ typedef void (*otCoapRequestHandler)(void *aContext, otMessage *aMessage, const * @retval OT_ERROR_NO_FRAME_RECEIVED Block segment missing. * */ -typedef otError (*otCoapBlockwiseReceiveHook)(void * aContext, +typedef otError (*otCoapBlockwiseReceiveHook)(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, @@ -402,11 +402,11 @@ typedef otError (*otCoapBlockwiseReceiveHook)(void * aContext, * @retval OT_ERROR_INVALID_ARGS Block at @p aPosition does not exist. * */ -typedef otError (*otCoapBlockwiseTransmitHook)(void * aContext, - uint8_t * aBlock, +typedef otError (*otCoapBlockwiseTransmitHook)(void *aContext, + uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, - bool * aMore); + bool *aMore); /** * This structure represents a CoAP resource. @@ -414,9 +414,9 @@ typedef otError (*otCoapBlockwiseTransmitHook)(void * aContext, */ typedef struct otCoapResource { - const char * mUriPath; ///< The URI Path string + const char *mUriPath; ///< The URI Path string otCoapRequestHandler mHandler; ///< The callback for handling a received request - void * mContext; ///< Application-specific context + void *mContext; ///< Application-specific context struct otCoapResource *mNext; ///< The next CoAP resource in the list } otCoapResource; @@ -426,7 +426,7 @@ typedef struct otCoapResource */ typedef struct otCoapBlockwiseResource { - const char * mUriPath; ///< The URI Path string + const char *mUriPath; ///< The URI Path string otCoapRequestHandler mHandler; ///< The callback for handling a received request /** The callback for handling incoming block-wise transfer. @@ -440,7 +440,7 @@ typedef struct otCoapBlockwiseResource * configuration is enabled. */ otCoapBlockwiseTransmitHook mTransmitHook; - void * mContext; ///< Application-specific context + void *mContext; ///< Application-specific context struct otCoapBlockwiseResource *mNext; ///< The next CoAP resource in the list } otCoapBlockwiseResource; @@ -883,11 +883,11 @@ otMessage *otCoapNewMessage(otInstance *aInstance, const otMessageSettings *aSet * @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data. * */ -otError otCoapSendRequestWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendRequestWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext, + void *aContext, const otCoapTxParameters *aTxParameters); /** @@ -913,12 +913,12 @@ otError otCoapSendRequestWithParameters(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data. * */ -otError otCoapSendRequestBlockWiseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendRequestBlockWiseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext, - const otCoapTxParameters * aTxParameters, + void *aContext, + const otCoapTxParameters *aTxParameters, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook); @@ -944,11 +944,11 @@ otError otCoapSendRequestBlockWiseWithParameters(otInstance * aIn * @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data. * */ -static inline otError otCoapSendRequestBlockWise(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +static inline otError otCoapSendRequestBlockWise(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) { @@ -973,11 +973,11 @@ static inline otError otCoapSendRequestBlockWise(otInstance * aIn * @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data. * */ -static inline otError otCoapSendRequest(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +static inline otError otCoapSendRequest(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext) + void *aContext) { // NOLINTNEXTLINE(modernize-use-nullptr) return otCoapSendRequestWithParameters(aInstance, aMessage, aMessageInfo, aHandler, aContext, NULL); @@ -1063,9 +1063,9 @@ void otCoapSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandle * @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response. * */ -otError otCoapSendResponseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendResponseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters); /** @@ -1085,11 +1085,11 @@ otError otCoapSendResponseWithParameters(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response. * */ -otError otCoapSendResponseBlockWiseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, - const otCoapTxParameters * aTxParameters, - void * aContext, +otError otCoapSendResponseBlockWiseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, + const otCoapTxParameters *aTxParameters, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook); /** @@ -1108,10 +1108,10 @@ otError otCoapSendResponseBlockWiseWithParameters(otInstance * aI * @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response. * */ -static inline otError otCoapSendResponseBlockWise(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, - void * aContext, +static inline otError otCoapSendResponseBlockWise(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook) { // NOLINTNEXTLINE(modernize-use-nullptr) diff --git a/include/openthread/coap_secure.h b/include/openthread/coap_secure.h index 5cb6bd9a0..6f424096a 100644 --- a/include/openthread/coap_secure.h +++ b/include/openthread/coap_secure.h @@ -108,7 +108,7 @@ void otCoapSecureStop(otInstance *aInstance); * @param[in] aPskIdLength The PSK Identity Length. * */ -void otCoapSecureSetPsk(otInstance * aInstance, +void otCoapSecureSetPsk(otInstance *aInstance, const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, @@ -130,9 +130,9 @@ void otCoapSecureSetPsk(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS Can't allocate memory for certificate. * */ -otError otCoapSecureGetPeerCertificateBase64(otInstance * aInstance, +otError otCoapSecureGetPeerCertificateBase64(otInstance *aInstance, unsigned char *aPeerCert, - size_t * aCertLength, + size_t *aCertLength, size_t aCertBufferSize); /** @@ -160,7 +160,7 @@ void otCoapSecureSetSslAuthMode(otInstance *aInstance, bool aVerifyPeerCertifica * @param[in] aPrivateKeyLength The length of the private key. * */ -void otCoapSecureSetCertificate(otInstance * aInstance, +void otCoapSecureSetCertificate(otInstance *aInstance, const uint8_t *aX509Cert, uint32_t aX509Length, const uint8_t *aPrivateKey, @@ -179,7 +179,7 @@ void otCoapSecureSetCertificate(otInstance * aInstance, * @param[in] aX509CaCertChainLength The length of chain. * */ -void otCoapSecureSetCaCertificateChain(otInstance * aInstance, +void otCoapSecureSetCaCertificateChain(otInstance *aInstance, const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength); @@ -195,10 +195,10 @@ void otCoapSecureSetCaCertificateChain(otInstance * aInstance, * @retval OT_ERROR_NONE Successfully started DTLS connection. * */ -otError otCoapSecureConnect(otInstance * aInstance, - const otSockAddr * aSockAddr, +otError otCoapSecureConnect(otInstance *aInstance, + const otSockAddr *aSockAddr, otHandleCoapSecureClientConnect aHandler, - void * aContext); + void *aContext); /** * This method stops the DTLS connection. @@ -252,10 +252,10 @@ bool otCoapSecureIsConnectionActive(otInstance *aInstance); * @retval OT_ERROR_INVALID_STATE DTLS connection was not initialized. * */ -otError otCoapSecureSendRequestBlockWise(otInstance * aInstance, - otMessage * aMessage, +otError otCoapSecureSendRequestBlockWise(otInstance *aInstance, + otMessage *aMessage, otCoapResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook); @@ -276,10 +276,10 @@ otError otCoapSecureSendRequestBlockWise(otInstance * aInstance, * @retval OT_ERROR_INVALID_STATE DTLS connection was not initialized. * */ -otError otCoapSecureSendRequest(otInstance * aInstance, - otMessage * aMessage, +otError otCoapSecureSendRequest(otInstance *aInstance, + otMessage *aMessage, otCoapResponseHandler aHandler, - void * aContext); + void *aContext); /** * This function adds a resource to the CoAP Secure server. @@ -336,9 +336,9 @@ void otCoapSecureSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler a * @param[in] aContext A pointer to arbitrary context information. May be NULL if not used. * */ -void otCoapSecureSetClientConnectedCallback(otInstance * aInstance, +void otCoapSecureSetClientConnectedCallback(otInstance *aInstance, otHandleCoapSecureClientConnect aHandler, - void * aContext); + void *aContext); /** * This function sends a CoAP response block-wise from the CoAP Secure server. @@ -356,10 +356,10 @@ void otCoapSecureSetClientConnectedCallback(otInstance * aIns * @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response. * */ -otError otCoapSecureSendResponseBlockWise(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, - void * aContext, +otError otCoapSecureSendResponseBlockWise(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook); /** diff --git a/include/openthread/commissioner.h b/include/openthread/commissioner.h index d632fd0ff..9bf09b814 100644 --- a/include/openthread/commissioner.h +++ b/include/openthread/commissioner.h @@ -170,9 +170,9 @@ typedef void (*otCommissionerStateCallback)(otCommissionerState aState, void *aC * */ typedef void (*otCommissionerJoinerCallback)(otCommissionerJoinerEvent aEvent, - const otJoinerInfo * aJoinerInfo, - const otExtAddress * aJoinerId, - void * aContext); + const otJoinerInfo *aJoinerInfo, + const otExtAddress *aJoinerId, + void *aContext); /** * This function enables the Thread Commissioner role. @@ -187,10 +187,10 @@ typedef void (*otCommissionerJoinerCallback)(otCommissionerJoinerEvent aEvent, * @retval OT_ERROR_INVALID_STATE Device is not currently attached to a network. * */ -otError otCommissionerStart(otInstance * aInstance, +otError otCommissionerStart(otInstance *aInstance, otCommissionerStateCallback aStateCallback, otCommissionerJoinerCallback aJoinerCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This function disables the Thread Commissioner role. @@ -242,9 +242,9 @@ otError otCommissionerSetId(otInstance *aInstance, const char *aId); * @note Only use this after successfully starting the Commissioner role with otCommissionerStart(). * */ -otError otCommissionerAddJoiner(otInstance * aInstance, +otError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aEui64, - const char * aPskd, + const char *aPskd, uint32_t aTimeout); /** @@ -263,9 +263,9 @@ otError otCommissionerAddJoiner(otInstance * aInstance, * @note Only use this after successfully starting the Commissioner role with otCommissionerStart(). * */ -otError otCommissionerAddJoinerWithDiscerner(otInstance * aInstance, +otError otCommissionerAddJoinerWithDiscerner(otInstance *aInstance, const otJoinerDiscerner *aDiscerner, - const char * aPskd, + const char *aPskd, uint32_t aTimeout); /** @@ -351,7 +351,7 @@ otError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aPro * @note Only use this after successfully starting the Commissioner role with otCommissionerStart(). * */ -otError otCommissionerAnnounceBegin(otInstance * aInstance, +otError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, @@ -369,7 +369,7 @@ otError otCommissionerAnnounceBegin(otInstance * aInstance, typedef void (*otCommissionerEnergyReportCallback)(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, - void * aContext); + void *aContext); /** * This function sends an Energy Scan Query message. @@ -390,14 +390,14 @@ typedef void (*otCommissionerEnergyReportCallback)(uint32_t aChannelMask, * @note Only use this after successfully starting the Commissioner role with otCommissionerStart(). * */ -otError otCommissionerEnergyScan(otInstance * aInstance, +otError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, - const otIp6Address * aAddress, + const otIp6Address *aAddress, otCommissionerEnergyReportCallback aCallback, - void * aContext); + void *aContext); /** * This function pointer is called when the Commissioner receives a PAN ID Conflict message. @@ -426,12 +426,12 @@ typedef void (*otCommissionerPanIdConflictCallback)(uint16_t aPanId, uint32_t aC * @note Only use this after successfully starting the Commissioner role with otCommissionerStart(). * */ -otError otCommissionerPanIdQuery(otInstance * aInstance, +otError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, - const otIp6Address * aAddress, + const otIp6Address *aAddress, otCommissionerPanIdConflictCallback aCallback, - void * aContext); + void *aContext); /** * This function sends MGMT_COMMISSIONER_GET. @@ -460,9 +460,9 @@ otError otCommissionerSendMgmtGet(otInstance *aInstance, const uint8_t *aTlvs, u * @retval OT_ERROR_INVALID_STATE The commissioner is not active. * */ -otError otCommissionerSendMgmtSet(otInstance * aInstance, +otError otCommissionerSendMgmtSet(otInstance *aInstance, const otCommissioningDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength); /** diff --git a/include/openthread/crypto.h b/include/openthread/crypto.h index a3c06d8d6..14411f21f 100644 --- a/include/openthread/crypto.h +++ b/include/openthread/crypto.h @@ -95,15 +95,15 @@ void otCryptoHmacSha256(const otCryptoKey *aKey, const uint8_t *aBuf, uint16_t a */ void otCryptoAesCcm(const otCryptoKey *aKey, uint8_t aTagLength, - const void * aNonce, + const void *aNonce, uint8_t aNonceLength, - const void * aHeader, + const void *aHeader, uint32_t aHeaderLength, - void * aPlainText, - void * aCipherText, + void *aPlainText, + void *aCipherText, uint32_t aLength, bool aEncrypt, - void * aTag); + void *aTag); /** * This method creates ECDSA sign. @@ -120,8 +120,8 @@ void otCryptoAesCcm(const otCryptoKey *aKey, * @retval OT_ERROR_INVALID_ARGS Private key is not valid EC Private Key. * @retval OT_ERROR_FAILED Error during signing. */ -otError otCryptoEcdsaSign(uint8_t * aOutput, - uint16_t * aOutputLength, +otError otCryptoEcdsaSign(uint8_t *aOutput, + uint16_t *aOutputLength, const uint8_t *aInputHash, uint16_t aInputHashLength, const uint8_t *aPrivateKey, diff --git a/include/openthread/dataset.h b/include/openthread/dataset.h index 3edf952ba..af5884bb8 100644 --- a/include/openthread/dataset.h +++ b/include/openthread/dataset.h @@ -479,11 +479,11 @@ otError otDatasetSetPendingTlvs(otInstance *aInstance, const otOperationalDatase * @retval OT_ERROR_NO_BUFS Insufficient buffer space to send. * */ -otError otDatasetSendMgmtActiveGet(otInstance * aInstance, +otError otDatasetSendMgmtActiveGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress); + const otIp6Address *aAddress); /** * Sends MGMT_ACTIVE_SET. @@ -500,12 +500,12 @@ otError otDatasetSendMgmtActiveGet(otInstance * aInstan * @retval OT_ERROR_BUSY A previous request is ongoing. * */ -otError otDatasetSendMgmtActiveSet(otInstance * aInstance, +otError otDatasetSendMgmtActiveSet(otInstance *aInstance, const otOperationalDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext); + void *aContext); /** * Sends MGMT_PENDING_GET. @@ -520,11 +520,11 @@ otError otDatasetSendMgmtActiveSet(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS Insufficient buffer space to send. * */ -otError otDatasetSendMgmtPendingGet(otInstance * aInstance, +otError otDatasetSendMgmtPendingGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress); + const otIp6Address *aAddress); /** * Sends MGMT_PENDING_SET. @@ -541,12 +541,12 @@ otError otDatasetSendMgmtPendingGet(otInstance * aInsta * @retval OT_ERROR_BUSY A previous request is ongoing. * */ -otError otDatasetSendMgmtPendingSet(otInstance * aInstance, +otError otDatasetSendMgmtPendingSet(otInstance *aInstance, const otOperationalDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext); + void *aContext); /** * This function generates PSKc from a given pass-phrase, network name, and extended PAN ID. @@ -562,10 +562,10 @@ otError otDatasetSendMgmtPendingSet(otInstance * aInstance, * @retval OT_ERROR_INVALID_ARGS If any of the input arguments is invalid. * */ -otError otDatasetGeneratePskc(const char * aPassPhrase, - const otNetworkName * aNetworkName, +otError otDatasetGeneratePskc(const char *aPassPhrase, + const otNetworkName *aNetworkName, const otExtendedPanId *aExtPanId, - otPskc * aPskc); + otPskc *aPskc); /** * Sets an `otNetworkName` instance from a given null terminated C string. diff --git a/include/openthread/dataset_updater.h b/include/openthread/dataset_updater.h index 9760286a6..cb16c33ac 100644 --- a/include/openthread/dataset_updater.h +++ b/include/openthread/dataset_updater.h @@ -88,10 +88,10 @@ typedef void (*otDatasetUpdaterCallback)(otError aError, void *aContext); * @retval OT_ERROR_NO_BUFS Could not allocated buffer to save Dataset. * */ -otError otDatasetUpdaterRequestUpdate(otInstance * aInstance, +otError otDatasetUpdaterRequestUpdate(otInstance *aInstance, const otOperationalDataset *aDataset, otDatasetUpdaterCallback aCallback, - void * aContext); + void *aContext); /** * This function cancels an ongoing (if any) Operational Dataset update request. diff --git a/include/openthread/diag.h b/include/openthread/diag.h index 3b1f80a89..98c708e34 100644 --- a/include/openthread/diag.h +++ b/include/openthread/diag.h @@ -70,8 +70,8 @@ extern "C" { */ otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, - char * aArgs[], - char * aOutput, + char *aArgs[], + char *aOutput, size_t aOutputMaxLen); /** diff --git a/include/openthread/dns.h b/include/openthread/dns.h index 2a5dd1373..22f3fc2b7 100644 --- a/include/openthread/dns.h +++ b/include/openthread/dns.h @@ -89,7 +89,7 @@ typedef struct otDnsTxtEntry * DNS message. * */ - const char * mKey; + const char *mKey; const uint8_t *mValue; ///< The TXT record value or already encoded TXT-DATA (depending on `mKey`). uint16_t mValueLength; ///< Number of bytes in `mValue` buffer. } otDnsTxtEntry; diff --git a/include/openthread/dns_client.h b/include/openthread/dns_client.h index 6074adbf8..95da750b6 100644 --- a/include/openthread/dns_client.h +++ b/include/openthread/dns_client.h @@ -203,10 +203,10 @@ typedef void (*otDnsAddressCallback)(otError aError, const otDnsAddressResponse * @retval OT_ERROR_INVALID_STATE Cannot send query since Thread interface is not up. * */ -otError otDnsClientResolveAddress(otInstance * aInstance, - const char * aHostName, +otError otDnsClientResolveAddress(otInstance *aInstance, + const char *aHostName, otDnsAddressCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig); /** @@ -233,10 +233,10 @@ otError otDnsClientResolveAddress(otInstance * aInstance, * @retval OT_ERROR_INVALID_STATE Cannot send query since Thread interface is not up. * */ -otError otDnsClientResolveIp4Address(otInstance * aInstance, - const char * aHostName, +otError otDnsClientResolveIp4Address(otInstance *aInstance, + const char *aHostName, otDnsAddressCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig); /** @@ -253,7 +253,7 @@ otError otDnsClientResolveIp4Address(otInstance * aInstance, * */ otError otDnsAddressResponseGetHostName(const otDnsAddressResponse *aResponse, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize); /** @@ -279,8 +279,8 @@ otError otDnsAddressResponseGetHostName(const otDnsAddressResponse *aResponse, */ otError otDnsAddressResponseGetAddress(const otDnsAddressResponse *aResponse, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl); + otIp6Address *aAddress, + uint32_t *aTtl); /** * This type is an opaque representation of a response to a browse (service instance enumeration) DNS query. @@ -318,11 +318,11 @@ typedef struct otDnsServiceInfo uint16_t mPort; ///< Service port number. uint16_t mPriority; ///< Service priority. uint16_t mWeight; ///< Service weight. - char * mHostNameBuffer; ///< Buffer to output the service host name (can be NULL if not needed). + char *mHostNameBuffer; ///< Buffer to output the service host name (can be NULL if not needed). uint16_t mHostNameBufferSize; ///< Size of `mHostNameBuffer`. otIp6Address mHostAddress; ///< The host IPv6 address. Set to all zero if not available. uint32_t mHostAddressTtl; ///< The host address TTL. - uint8_t * mTxtData; ///< Buffer to output TXT data (can be NULL if not needed). + uint8_t *mTxtData; ///< Buffer to output TXT data (can be NULL if not needed). uint16_t mTxtDataSize; ///< On input, size of `mTxtData` buffer. On output number bytes written. bool mTxtDataTruncated; ///< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated. uint32_t mTxtDataTtl; ///< The TXT data TTL. @@ -347,10 +347,10 @@ typedef struct otDnsServiceInfo * @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query. * */ -otError otDnsClientBrowse(otInstance * aInstance, - const char * aServiceName, +otError otDnsClientBrowse(otInstance *aInstance, + const char *aServiceName, otDnsBrowseCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig); /** @@ -367,7 +367,7 @@ otError otDnsClientBrowse(otInstance * aInstance, * */ otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize); /** @@ -394,7 +394,7 @@ otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse, */ otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aResponse, uint16_t aIndex, - char * aLabelBuffer, + char *aLabelBuffer, uint8_t aLabelBufferSize); /** @@ -425,8 +425,8 @@ otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aRespon * */ otError otDnsBrowseResponseGetServiceInfo(const otDnsBrowseResponse *aResponse, - const char * aInstanceLabel, - otDnsServiceInfo * aServiceInfo); + const char *aInstanceLabel, + otDnsServiceInfo *aServiceInfo); /** * This function gets the host IPv6 address from a DNS browse (service instance enumeration) response. @@ -450,10 +450,10 @@ otError otDnsBrowseResponseGetServiceInfo(const otDnsBrowseResponse *aResponse, * */ otError otDnsBrowseResponseGetHostAddress(const otDnsBrowseResponse *aResponse, - const char * aHostName, + const char *aHostName, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl); + otIp6Address *aAddress, + uint32_t *aTtl); /** * This type is an opaque representation of a response to a service instance resolution DNS query. @@ -502,11 +502,11 @@ typedef void (*otDnsServiceCallback)(otError aError, const otDnsServiceResponse * @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is NULL. * */ -otError otDnsClientResolveService(otInstance * aInstance, - const char * aInstanceLabel, - const char * aServiceName, +otError otDnsClientResolveService(otInstance *aInstance, + const char *aInstanceLabel, + const char *aServiceName, otDnsServiceCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig); /** @@ -526,9 +526,9 @@ otError otDnsClientResolveService(otInstance * aInstance, * */ otError otDnsServiceResponseGetServiceName(const otDnsServiceResponse *aResponse, - char * aLabelBuffer, + char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize); /** @@ -577,10 +577,10 @@ otError otDnsServiceResponseGetServiceInfo(const otDnsServiceResponse *aResponse * */ otError otDnsServiceResponseGetHostAddress(const otDnsServiceResponse *aResponse, - const char * aHostName, + const char *aHostName, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl); + otIp6Address *aAddress, + uint32_t *aTtl); /** * @} diff --git a/include/openthread/dnssd_server.h b/include/openthread/dnssd_server.h index 73666981a..2feb95e16 100644 --- a/include/openthread/dnssd_server.h +++ b/include/openthread/dnssd_server.h @@ -112,15 +112,15 @@ typedef void otDnssdQuery; */ typedef struct otDnssdServiceInstanceInfo { - const char * mFullName; ///< Full instance name (e.g. "OpenThread._ipps._tcp.default.service.arpa."). - const char * mHostName; ///< Host name (e.g. "ot-host.default.service.arpa."). + const char *mFullName; ///< Full instance name (e.g. "OpenThread._ipps._tcp.default.service.arpa."). + const char *mHostName; ///< Host name (e.g. "ot-host.default.service.arpa."). uint8_t mAddressNum; ///< Number of host IPv6 addresses. const otIp6Address *mAddresses; ///< Host IPv6 addresses. uint16_t mPort; ///< Service port. uint16_t mPriority; ///< Service priority. uint16_t mWeight; ///< Service weight. uint16_t mTxtLength; ///< Service TXT RDATA length. - const uint8_t * mTxtData; ///< Service TXT RDATA. + const uint8_t *mTxtData; ///< Service TXT RDATA. uint32_t mTtl; ///< Service TTL (in seconds). } otDnssdServiceInstanceInfo; @@ -177,10 +177,10 @@ typedef struct otDnssdCounters * @param[in] aContext A pointer to the application-specific context. * */ -void otDnssdQuerySetCallbacks(otInstance * aInstance, +void otDnssdQuerySetCallbacks(otInstance *aInstance, otDnssdQuerySubscribeCallback aSubscribe, otDnssdQueryUnsubscribeCallback aUnsubscribe, - void * aContext); + void *aContext); /** * This function notifies a discovered service instance. @@ -195,8 +195,8 @@ void otDnssdQuerySetCallbacks(otInstance * aInstance, * @param[in] aInstanceInfo A pointer to the discovered service instance information. * */ -void otDnssdQueryHandleDiscoveredServiceInstance(otInstance * aInstance, - const char * aServiceFullName, +void otDnssdQueryHandleDiscoveredServiceInstance(otInstance *aInstance, + const char *aServiceFullName, otDnssdServiceInstanceInfo *aInstanceInfo); /** * This function notifies a discovered host. diff --git a/include/openthread/history_tracker.h b/include/openthread/history_tracker.h index a8dc7c301..4c9b4088e 100644 --- a/include/openthread/history_tracker.h +++ b/include/openthread/history_tracker.h @@ -251,9 +251,9 @@ void otHistoryTrackerInitIterator(otHistoryTrackerIterator *aIterator); * @returns A pointer to `otHistoryTrackerNetworkInfo` entry or `NULL` if no more entries in the list. * */ -const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInstance * aInstance, +const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the unicast address history list. @@ -269,9 +269,9 @@ const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInsta * */ const otHistoryTrackerUnicastAddressInfo *otHistoryTrackerIterateUnicastAddressHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the multicast address history list. @@ -287,9 +287,9 @@ const otHistoryTrackerUnicastAddressInfo *otHistoryTrackerIterateUnicastAddressH * */ const otHistoryTrackerMulticastAddressInfo *otHistoryTrackerIterateMulticastAddressHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the RX message history list. @@ -304,9 +304,9 @@ const otHistoryTrackerMulticastAddressInfo *otHistoryTrackerIterateMulticastAddr * @returns The `otHistoryTrackerMessageInfo` entry or `NULL` if no more entries in the list. * */ -const otHistoryTrackerMessageInfo *otHistoryTrackerIterateRxHistory(otInstance * aInstance, +const otHistoryTrackerMessageInfo *otHistoryTrackerIterateRxHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the TX message history list. @@ -321,9 +321,9 @@ const otHistoryTrackerMessageInfo *otHistoryTrackerIterateRxHistory(otInstance * * @returns The `otHistoryTrackerMessageInfo` entry or `NULL` if no more entries in the list. * */ -const otHistoryTrackerMessageInfo *otHistoryTrackerIterateTxHistory(otInstance * aInstance, +const otHistoryTrackerMessageInfo *otHistoryTrackerIterateTxHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the neighbor history list. @@ -338,9 +338,9 @@ const otHistoryTrackerMessageInfo *otHistoryTrackerIterateTxHistory(otInstance * * @returns The `otHistoryTrackerNeighborInfo` entry or `NULL` if no more entries in the list. * */ -const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otInstance * aInstance, +const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the Network Data on mesh prefix entry history list. @@ -355,9 +355,9 @@ const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otIns * @returns The `otHistoryTrackerOnMeshPrefixInfo` entry or `NULL` if no more entries in the list. * */ -const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance * aInstance, +const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function iterates over the entries in the Network Data external route entry history list. @@ -373,9 +373,9 @@ const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHisto * */ const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge); + uint32_t *aEntryAge); /** * This function converts a given entry age to a human-readable string. diff --git a/include/openthread/icmp6.h b/include/openthread/icmp6.h index c5fc276f9..38bd6a6a1 100644 --- a/include/openthread/icmp6.h +++ b/include/openthread/icmp6.h @@ -117,8 +117,8 @@ typedef struct otIcmp6Header otIcmp6Header; * @param[in] aIcmpHeader A pointer to the received ICMPv6 header. * */ -typedef void (*otIcmp6ReceiveCallback)(void * aContext, - otMessage * aMessage, +typedef void (*otIcmp6ReceiveCallback)(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, const otIcmp6Header *aIcmpHeader); @@ -129,7 +129,7 @@ typedef void (*otIcmp6ReceiveCallback)(void * aContext, typedef struct otIcmp6Handler { otIcmp6ReceiveCallback mReceiveCallback; ///< The ICMPv6 received callback - void * mContext; ///< A pointer to arbitrary context information. + void *mContext; ///< A pointer to arbitrary context information. struct otIcmp6Handler *mNext; ///< A pointer to the next handler in the list. } otIcmp6Handler; @@ -190,8 +190,8 @@ otError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandler); * May be zero. * */ -otError otIcmp6SendEchoRequest(otInstance * aInstance, - otMessage * aMessage, +otError otIcmp6SendEchoRequest(otInstance *aInstance, + otMessage *aMessage, const otMessageInfo *aMessageInfo, uint16_t aIdentifier); diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 6bdfdcdd0..eb4f6e661 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -53,7 +53,7 @@ extern "C" { * @note This number versions both OpenThread platform and user APIs. * */ -#define OPENTHREAD_API_VERSION (265) +#define OPENTHREAD_API_VERSION (266) /** * @addtogroup api-instance diff --git a/include/openthread/ip6.h b/include/openthread/ip6.h index ca15f1e8c..5c38e3121 100644 --- a/include/openthread/ip6.h +++ b/include/openthread/ip6.h @@ -229,7 +229,7 @@ typedef struct otMessageInfo otIp6Address mPeerAddr; ///< The peer IPv6 address. uint16_t mSockPort; ///< The local transport-layer port. uint16_t mPeerPort; ///< The peer transport-layer port. - const void * mLinkInfo; ///< A pointer to link-specific information. + const void *mLinkInfo; ///< A pointer to link-specific information. uint8_t mHopLimit; ///< The IPv6 Hop Limit value. Only applies if `mAllowZeroHopLimit` is FALSE. ///< If `0`, IPv6 Hop Limit is default value `OPENTHREAD_CONFIG_IP6_HOP_LIMIT_DEFAULT`. ///< Otherwise, specifies the IPv6 Hop Limit. @@ -414,8 +414,8 @@ otMessage *otIp6NewMessage(otInstance *aInstance, const otMessageSettings *aSett * @sa otMessageFree * */ -otMessage *otIp6NewMessageFromBuffer(otInstance * aInstance, - const uint8_t * aData, +otMessage *otIp6NewMessageFromBuffer(otInstance *aInstance, + const uint8_t *aData, uint16_t aDataLength, const otMessageSettings *aSettings); @@ -786,7 +786,7 @@ void otIp6SetSlaacPrefixFilter(otInstance *aInstance, otIp6SlaacPrefixFilter aFi * @sa otIp6RegisterMulticastListeners * */ -typedef void (*otIp6RegisterMulticastListenersCallback)(void * aContext, +typedef void (*otIp6RegisterMulticastListenersCallback)(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, @@ -820,12 +820,12 @@ typedef void (*otIp6RegisterMulticastListenersCallback)(void * aCon * @sa otIp6RegisterMulticastListenersCallback * */ -otError otIp6RegisterMulticastListeners(otInstance * aInstance, - const otIp6Address * aAddresses, +otError otIp6RegisterMulticastListeners(otInstance *aInstance, + const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, otIp6RegisterMulticastListenersCallback aCallback, - void * aContext); + void *aContext); /** * This function sets the Mesh Local IID (for test purpose). diff --git a/include/openthread/joiner.h b/include/openthread/joiner.h index a1873f74c..586e88f54 100644 --- a/include/openthread/joiner.h +++ b/include/openthread/joiner.h @@ -112,15 +112,15 @@ typedef void (*otJoinerCallback)(otError aError, void *aContext); * @retval OT_ERROR_INVALID_STATE The IPv6 stack is not enabled or Thread stack is fully enabled. * */ -otError otJoinerStart(otInstance * aInstance, - const char * aPskd, - const char * aProvisioningUrl, - const char * aVendorName, - const char * aVendorModel, - const char * aVendorSwVersion, - const char * aVendorData, +otError otJoinerStart(otInstance *aInstance, + const char *aPskd, + const char *aProvisioningUrl, + const char *aVendorName, + const char *aVendorModel, + const char *aVendorSwVersion, + const char *aVendorData, otJoinerCallback aCallback, - void * aContext); + void *aContext); /** * Disables the Thread Joiner role. diff --git a/include/openthread/link.h b/include/openthread/link.h index e170bc9af..7479764cb 100644 --- a/include/openthread/link.h +++ b/include/openthread/link.h @@ -430,11 +430,11 @@ typedef void (*otHandleActiveScanResult)(otActiveScanResult *aResult, void *aCon * @retval OT_ERROR_BUSY Already performing an Active Scan. * */ -otError otLinkActiveScan(otInstance * aInstance, +otError otLinkActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This function indicates whether or not an IEEE 802.15.4 Active Scan is currently in progress. @@ -468,11 +468,11 @@ typedef void (*otHandleEnergyScanResult)(otEnergyScanResult *aResult, void *aCon * @retval OT_ERROR_BUSY Could not start the energy scan. * */ -otError otLinkEnergyScan(otInstance * aInstance, +otError otLinkEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration, otHandleEnergyScanResult aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This function indicates whether or not an IEEE 802.15.4 Energy Scan is currently in progress. diff --git a/include/openthread/link_metrics.h b/include/openthread/link_metrics.h index 267654bfe..fc9a7f009 100644 --- a/include/openthread/link_metrics.h +++ b/include/openthread/link_metrics.h @@ -116,10 +116,10 @@ typedef enum otLinkMetricsStatus * @param[in] aContext A pointer to application-specific context. * */ -typedef void (*otLinkMetricsReportCallback)(const otIp6Address * aSource, +typedef void (*otLinkMetricsReportCallback)(const otIp6Address *aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, - void * aContext); + void *aContext); /** * This function pointer is called when a Link Metrics Management Response is received. * @@ -140,9 +140,9 @@ typedef void (*otLinkMetricsMgmtResponseCallback)(const otIp6Address *aSource, u * */ typedef void (*otLinkMetricsEnhAckProbingIeReportCallback)(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues, - void * aContext); + void *aContext); /** * This function sends an MLE Data Request to query Link Metrics. @@ -162,12 +162,12 @@ typedef void (*otLinkMetricsEnhAckProbingIeReportCallback)(otShortAddress * @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics. * */ -otError otLinkMetricsQuery(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsQuery(otInstance *aInstance, + const otIp6Address *aDestination, uint8_t aSeriesId, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsReportCallback aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * Sends an MLE Link Metrics Management Request to configure or clear a Forward Tracking Series. @@ -189,13 +189,13 @@ otError otLinkMetricsQuery(otInstance * aInstance, * @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics. * */ -otError otLinkMetricsConfigForwardTrackingSeries(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsConfigForwardTrackingSeries(otInstance *aInstance, + const otIp6Address *aDestination, uint8_t aSeriesId, otLinkMetricsSeriesFlags aSeriesFlags, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsMgmtResponseCallback aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This function sends an MLE Link Metrics Management Request to configure/clear an Enhanced-ACK Based Probing. @@ -218,14 +218,14 @@ otError otLinkMetricsConfigForwardTrackingSeries(otInstance * * @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics. * */ -otError otLinkMetricsConfigEnhAckProbing(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsConfigEnhAckProbing(otInstance *aInstance, + const otIp6Address *aDestination, otLinkMetricsEnhAckFlags aEnhAckFlags, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsMgmtResponseCallback aCallback, - void * aCallbackContext, + void *aCallbackContext, otLinkMetricsEnhAckProbingIeReportCallback aEnhAckCallback, - void * aEnhAckCallbackContext); + void *aEnhAckCallbackContext); /** * Sends an MLE Link Probe message. @@ -242,7 +242,7 @@ otError otLinkMetricsConfigEnhAckProbing(otInstance * * @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics. * */ -otError otLinkMetricsSendLinkProbe(otInstance * aInstance, +otError otLinkMetricsSendLinkProbe(otInstance *aInstance, const otIp6Address *aDestination, uint8_t aSeriesId, uint8_t aLength); diff --git a/include/openthread/link_raw.h b/include/openthread/link_raw.h index 02293e990..d3544d580 100644 --- a/include/openthread/link_raw.h +++ b/include/openthread/link_raw.h @@ -174,7 +174,7 @@ otRadioFrame *otLinkRawGetTransmitBuffer(otInstance *aInstance); * OT_ERROR_ABORT when transmission was aborted for other reasons. * */ -typedef void (*otLinkRawTransmitDone)(otInstance * aInstance, +typedef void (*otLinkRawTransmitDone)(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); @@ -241,7 +241,7 @@ typedef void (*otLinkRawEnergyScanDone)(otInstance *aInstance, int8_t aEnergySca * @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled. * */ -otError otLinkRawEnergyScan(otInstance * aInstance, +otError otLinkRawEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback); @@ -346,7 +346,7 @@ otError otLinkRawSrcMatchClearExtEntries(otInstance *aInstance); * @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled. * */ -otError otLinkRawSetMacKey(otInstance * aInstance, +otError otLinkRawSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKey *aPrevKey, diff --git a/include/openthread/multi_radio.h b/include/openthread/multi_radio.h index 744b1c080..13930f58c 100644 --- a/include/openthread/multi_radio.h +++ b/include/openthread/multi_radio.h @@ -85,8 +85,8 @@ typedef struct otMultiRadioNeighborInfo * @retval OT_ERROR_NOT_FOUND Could not find a neighbor with @p aExtAddress. * */ -otError otMultiRadioGetNeighborInfo(otInstance * aInstance, - const otExtAddress * aExtAddress, +otError otMultiRadioGetNeighborInfo(otInstance *aInstance, + const otExtAddress *aExtAddress, otMultiRadioNeighborInfo *aNeighborInfo); /** diff --git a/include/openthread/nat64.h b/include/openthread/nat64.h index 57f3702a1..4589d3620 100644 --- a/include/openthread/nat64.h +++ b/include/openthread/nat64.h @@ -222,9 +222,9 @@ void otNat64InitAddressMappingIterator(otInstance *aInstance, otNat64AddressMapp * @retval OT_ERROR_NOT_FOUND No subsequent NAT64 address mapping info was found. * */ -otError otNat64GetNextAddressMapping(otInstance * aInstance, +otError otNat64GetNextAddressMapping(otInstance *aInstance, otNat64AddressMappingIterator *aIterator, - otNat64AddressMapping * aMapping); + otNat64AddressMapping *aMapping); /** * States of NAT64. diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h index 74b92e89d..12c48e817 100644 --- a/include/openthread/netdata.h +++ b/include/openthread/netdata.h @@ -148,9 +148,9 @@ otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_ * @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data. * */ -otError otNetDataGetNextOnMeshPrefix(otInstance * aInstance, +otError otNetDataGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterator *aIterator, - otBorderRouterConfig * aConfig); + otBorderRouterConfig *aConfig); /** * This function gets the next external route in the partition's Network Data. @@ -227,7 +227,7 @@ struct otJoinerDiscerner; * @retval OT_ERROR_NOT_FOUND @p aDiscerner is not included in the steering data. * */ -otError otNetDataSteeringDataCheckJoinerWithDiscerner(otInstance * aInstance, +otError otNetDataSteeringDataCheckJoinerWithDiscerner(otInstance *aInstance, const struct otJoinerDiscerner *aDiscerner); /** diff --git a/include/openthread/netdata_publisher.h b/include/openthread/netdata_publisher.h index 2c38e1513..0e68b0ec4 100644 --- a/include/openthread/netdata_publisher.h +++ b/include/openthread/netdata_publisher.h @@ -91,8 +91,8 @@ typedef void (*otNetDataDnsSrpServicePublisherCallback)(otNetDataPublisherEvent * */ typedef void (*otNetDataPrefixPublisherCallback)(otNetDataPublisherEvent aEvent, - const otIp6Prefix * aPrefix, - void * aContext); + const otIp6Prefix *aPrefix, + void *aContext); /** * This function requests "DNS/SRP Service Anycast Address" to be published in the Thread Network Data. @@ -170,9 +170,9 @@ bool otNetDataIsDnsSrpServiceAdded(otInstance *aInstance); * @param[in] aContext A pointer to application-specific context (used when @p aCallback is invoked). * */ -void otNetDataSetDnsSrpServicePublisherCallback(otInstance * aInstance, +void otNetDataSetDnsSrpServicePublisherCallback(otInstance *aInstance, otNetDataDnsSrpServicePublisherCallback aCallback, - void * aContext); + void *aContext); /** * Unpublishes any previously added DNS/SRP (Anycast or Unicast) Service entry from the Thread Network @@ -265,9 +265,9 @@ bool otNetDataIsPrefixAdded(otInstance *aInstance, const otIp6Prefix *aPrefix); * @param[in] aContext A pointer to application-specific context (used when @p aCallback is invoked). * */ -void otNetDataSetPrefixPublisherCallback(otInstance * aInstance, +void otNetDataSetPrefixPublisherCallback(otInstance *aInstance, otNetDataPrefixPublisherCallback aCallback, - void * aContext); + void *aContext); /** * Unpublishes a previously published On-Mesh or External Route Prefix. diff --git a/include/openthread/netdiag.h b/include/openthread/netdiag.h index d40238340..40cd074ea 100644 --- a/include/openthread/netdiag.h +++ b/include/openthread/netdiag.h @@ -276,9 +276,9 @@ typedef struct otNetworkDiagTlv * @Note A subsequent call to this function is allowed only when current return value is OT_ERROR_NONE. * */ -otError otThreadGetNextDiagnosticTlv(const otMessage * aMessage, +otError otThreadGetNextDiagnosticTlv(const otMessage *aMessage, otNetworkDiagIterator *aIterator, - otNetworkDiagTlv * aNetworkDiagTlv); + otNetworkDiagTlv *aNetworkDiagTlv); /** * This function pointer is called when Network Diagnostic Get response is received. @@ -292,9 +292,9 @@ otError otThreadGetNextDiagnosticTlv(const otMessage * aMessage, * */ typedef void (*otReceiveDiagnosticGetCallback)(otError aError, - otMessage * aMessage, + otMessage *aMessage, const otMessageInfo *aMessageInfo, - void * aContext); + void *aContext); /** * Send a Network Diagnostic Get request. @@ -311,12 +311,12 @@ typedef void (*otReceiveDiagnosticGetCallback)(otError aError, * @retval OT_ERROR_NO_BUFS Insufficient message buffers available to send DIAG_GET.req. * */ -otError otThreadSendDiagnosticGet(otInstance * aInstance, - const otIp6Address * aDestination, +otError otThreadSendDiagnosticGet(otInstance *aInstance, + const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount, otReceiveDiagnosticGetCallback aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * Send a Network Diagnostic Reset request. @@ -330,7 +330,7 @@ otError otThreadSendDiagnosticGet(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS Insufficient message buffers available to send DIAG_RST.ntf. * */ -otError otThreadSendDiagnosticReset(otInstance * aInstance, +otError otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount); diff --git a/include/openthread/network_time.h b/include/openthread/network_time.h index 5e7723173..e20a9d5a3 100644 --- a/include/openthread/network_time.h +++ b/include/openthread/network_time.h @@ -145,9 +145,9 @@ uint16_t otNetworkTimeGetXtalThreshold(otInstance *aInstance); * @param[in] aCallbackContext The context to be passed to the callback function upon invocation * */ -void otNetworkTimeSyncSetCallback(otInstance * aInstance, +void otNetworkTimeSyncSetCallback(otInstance *aInstance, otNetworkTimeSyncCallbackFn aCallbackFn, - void * aCallbackContext); + void *aCallbackContext); /** * @} diff --git a/include/openthread/ping_sender.h b/include/openthread/ping_sender.h index 07e5c03ce..a0e30ca9a 100644 --- a/include/openthread/ping_sender.h +++ b/include/openthread/ping_sender.h @@ -112,7 +112,7 @@ typedef struct otPingSenderConfig otPingSenderReplyCallback mReplyCallback; ///< Callback function to report replies (can be NULL if not needed). otPingSenderStatisticsCallback mStatisticsCallback; ///< Callback function to report statistics (can be NULL if not needed). - void * mCallbackContext; ///< A pointer to the callback application-specific context. + void *mCallbackContext; ///< A pointer to the callback application-specific context. uint16_t mSize; ///< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default. uint16_t mCount; ///< Number of ping messages to send. Zero to use default. uint32_t mInterval; ///< Ping tx interval in milliseconds. Zero to use default. diff --git a/include/openthread/platform/crypto.h b/include/openthread/platform/crypto.h index 258dd59ca..ee1e67933 100644 --- a/include/openthread/platform/crypto.h +++ b/include/openthread/platform/crypto.h @@ -126,7 +126,7 @@ typedef struct otCryptoKey */ typedef struct otCryptoContext { - void * mContext; ///< Pointer to the context. + void *mContext; ///< Pointer to the context. uint16_t mContextSize; ///< The length of the context in bytes. } otCryptoContext; @@ -249,12 +249,12 @@ void otPlatCryptoInit(void); * This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. * */ -otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef, +otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, - const uint8_t * aKey, + const uint8_t *aKey, size_t aKeyLen); /** @@ -453,9 +453,9 @@ otError otPlatCryptoHkdfInit(otCryptoContext *aContext); * */ otError otPlatCryptoHkdfExpand(otCryptoContext *aContext, - const uint8_t * aInfo, + const uint8_t *aInfo, uint16_t aInfoLength, - uint8_t * aOutputKey, + uint8_t *aOutputKey, uint16_t aOutputKeyLength); /** @@ -470,8 +470,8 @@ otError otPlatCryptoHkdfExpand(otCryptoContext *aContext, * @retval OT_ERROR_FAILED HKDF Extract failed. * */ -otError otPlatCryptoHkdfExtract(otCryptoContext * aContext, - const uint8_t * aSalt, +otError otPlatCryptoHkdfExtract(otCryptoContext *aContext, + const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey); @@ -621,8 +621,8 @@ otError otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, * */ otError otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, - const otPlatCryptoSha256Hash * aHash, - otPlatCryptoEcdsaSignature * aSignature); + const otPlatCryptoSha256Hash *aHash, + otPlatCryptoEcdsaSignature *aSignature); /** * Use the key from the input context to verify the ECDSA signature of a hashed message. @@ -641,7 +641,7 @@ otError otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, * */ otError otPlatCryptoEcdsaVerify(const otPlatCryptoEcdsaPublicKey *aPublicKey, - const otPlatCryptoSha256Hash * aHash, + const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature); /** diff --git a/include/openthread/platform/diag.h b/include/openthread/platform/diag.h index d358c84b3..24cb507cf 100644 --- a/include/openthread/platform/diag.h +++ b/include/openthread/platform/diag.h @@ -85,8 +85,8 @@ typedef enum */ otError otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, - char * aArgs[], - char * aOutput, + char *aArgs[], + char *aOutput, size_t aOutputMaxLen); /** diff --git a/include/openthread/platform/infra_if.h b/include/openthread/platform/infra_if.h index 2e40434e8..5d2c50f15 100644 --- a/include/openthread/platform/infra_if.h +++ b/include/openthread/platform/infra_if.h @@ -87,7 +87,7 @@ bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddres */ otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address *aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength); /** @@ -106,10 +106,10 @@ otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, * address and the IP Hop Limit MUST be 255. * */ -extern void otPlatInfraIfRecvIcmp6Nd(otInstance * aInstance, +extern void otPlatInfraIfRecvIcmp6Nd(otInstance *aInstance, uint32_t aInfraIfIndex, const otIp6Address *aSrcAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength); /** @@ -158,7 +158,7 @@ otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex); * @param[in] aIp6Prefix A pointer to NAT64 prefix. * */ -extern void otPlatInfraIfDiscoverNat64PrefixDone(otInstance * aInstance, +extern void otPlatInfraIfDiscoverNat64PrefixDone(otInstance *aInstance, uint32_t aInfraIfIndex, const otIp6Prefix *aIp6Prefix); diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 09e9aa7ee..a4b916bba 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -264,7 +264,7 @@ typedef struct otRadioFrame struct { const otMacKeyMaterial *mAesKey; ///< The key material used for AES-CCM frame security. - otRadioIeInfo * mIeInfo; ///< The pointer to the Header IE(s) related information. + otRadioIeInfo *mIeInfo; ///< The pointer to the Header IE(s) related information. uint32_t mTxDelay; ///< The delay time for this transmission (based on `mTxDelayBaseTime`). uint32_t mTxDelayBaseTime; ///< The base time for the transmission delay. uint8_t mMaxCsmaBackoffs; ///< Maximum number of backoffs attempts before declaring CCA failure. @@ -594,7 +594,7 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable); * @param[in] aKeyType Key Type used. * */ -void otPlatRadioSetMacKey(otInstance * aInstance, +void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKeyMaterial *aPrevKey, @@ -1032,7 +1032,7 @@ otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCo * @retval kErrorNone Successfully enabled or disabled CSL. * */ -otError otPlatRadioEnableCsl(otInstance * aInstance, +otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr); @@ -1139,7 +1139,7 @@ otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode); * @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented. * */ -otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, +otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, otShortAddress aShortAddress, const otExtAddress *aExtAddress); diff --git a/include/openthread/platform/spi-slave.h b/include/openthread/platform/spi-slave.h index 3b846673e..551d70163 100644 --- a/include/openthread/platform/spi-slave.h +++ b/include/openthread/platform/spi-slave.h @@ -79,7 +79,7 @@ extern "C" { * @returns TRUE if after this call returns the platform should invoke the process callback `aProcessCallback`, * FALSE if there is nothing to process and no need to invoke the process callback. */ -typedef bool (*otPlatSpiSlaveTransactionCompleteCallback)(void * aContext, +typedef bool (*otPlatSpiSlaveTransactionCompleteCallback)(void *aContext, uint8_t *aOutputBuf, uint16_t aOutputBufLen, uint8_t *aInputBuf, @@ -115,7 +115,7 @@ typedef void (*otPlatSpiSlaveTransactionProcessCallback)(void *aContext); */ otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback, otPlatSpiSlaveTransactionProcessCallback aProcessCallback, - void * aContext); + void *aContext); /** * Shutdown and disable the SPI slave interface. diff --git a/include/openthread/platform/trel.h b/include/openthread/platform/trel.h index d4e0475a6..6515b98d5 100644 --- a/include/openthread/platform/trel.h +++ b/include/openthread/platform/trel.h @@ -178,8 +178,8 @@ void otPlatTrelRegisterService(otInstance *aInstance, uint16_t aPort, const uint * @param[in] aDestSockAddr The destination socket address. * */ -void otPlatTrelSend(otInstance * aInstance, - const uint8_t * aUdpPayload, +void otPlatTrelSend(otInstance *aInstance, + const uint8_t *aUdpPayload, uint16_t aUdpPayloadLen, const otSockAddr *aDestSockAddr); diff --git a/include/openthread/platform/udp.h b/include/openthread/platform/udp.h index 345f15962..5b4a21c6c 100644 --- a/include/openthread/platform/udp.h +++ b/include/openthread/platform/udp.h @@ -125,7 +125,7 @@ otError otPlatUdpSend(otUdpSocket *aUdpSocket, otMessage *aMessage, const otMess * @retval OT_ERROR_FAILED Failed to join the multicast group. * */ -otError otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket, +otError otPlatUdpJoinMulticastGroup(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier, const otIp6Address *aAddress); @@ -142,7 +142,7 @@ otError otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket, * @retval OT_ERROR_FAILED Failed to leave the multicast group. * */ -otError otPlatUdpLeaveMulticastGroup(otUdpSocket * aUdpSocket, +otError otPlatUdpLeaveMulticastGroup(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier, const otIp6Address *aAddress); diff --git a/include/openthread/server.h b/include/openthread/server.h index 0d177c701..3ce111705 100644 --- a/include/openthread/server.h +++ b/include/openthread/server.h @@ -94,7 +94,7 @@ otError otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig * @sa otServerRegister * */ -otError otServerRemoveService(otInstance * aInstance, +otError otServerRemoveService(otInstance *aInstance, uint32_t aEnterpriseNumber, const uint8_t *aServiceData, uint8_t aServiceDataLength); diff --git a/include/openthread/sntp.h b/include/openthread/sntp.h index ca61f0a59..34b26c28c 100644 --- a/include/openthread/sntp.h +++ b/include/openthread/sntp.h @@ -93,10 +93,10 @@ typedef void (*otSntpResponseHandler)(void *aContext, uint64_t aTime, otError aR * @param[in] aContext A pointer to arbitrary context information. * */ -otError otSntpClientQuery(otInstance * aInstance, - const otSntpQuery * aQuery, +otError otSntpClientQuery(otInstance *aInstance, + const otSntpQuery *aQuery, otSntpResponseHandler aHandler, - void * aContext); + void *aContext); /** * This function sets the unix era number. diff --git a/include/openthread/srp_client.h b/include/openthread/srp_client.h index c5840a702..beaa06225 100644 --- a/include/openthread/srp_client.h +++ b/include/openthread/srp_client.h @@ -74,8 +74,8 @@ typedef enum */ typedef struct otSrpClientHostInfo { - const char * mName; ///< Host name (label) string (NULL if not yet set). - const otIp6Address * mAddresses; ///< Array of host IPv6 addresses (NULL if not set or auto address is enabled). + const char *mName; ///< Host name (label) string (NULL if not yet set). + const otIp6Address *mAddresses; ///< Array of host IPv6 addresses (NULL if not set or auto address is enabled). uint8_t mNumAddresses; ///< Number of IPv6 addresses in `mAddresses` array. bool mAutoAddress; ///< Indicates whether auto address mode is enabled or not. otSrpClientItemState mState; ///< Host info state. @@ -103,10 +103,10 @@ typedef struct otSrpClientHostInfo */ typedef struct otSrpClientService { - const char * mName; ///< The service labels (e.g., "_mt._udp", not the full domain name). - const char * mInstanceName; ///< The service instance name label (not the full name). - const char *const * mSubTypeLabels; ///< Array of sub-type labels (must end with `NULL` or can be `NULL`). - const otDnsTxtEntry * mTxtEntries; ///< Array of TXT entries (`mNumTxtEntries` gives num of entries). + const char *mName; ///< The service labels (e.g., "_mt._udp", not the full domain name). + const char *mInstanceName; ///< The service instance name label (not the full name). + const char *const *mSubTypeLabels; ///< Array of sub-type labels (must end with `NULL` or can be `NULL`). + const otDnsTxtEntry *mTxtEntries; ///< Array of TXT entries (`mNumTxtEntries` gives num of entries). uint16_t mPort; ///< The service port number. uint16_t mPriority; ///< The service priority. uint16_t mWeight; ///< The service weight. @@ -175,9 +175,9 @@ typedef struct otSrpClientService */ typedef void (*otSrpClientCallback)(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext); + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext); /** * This function pointer type defines the callback used by SRP client to notify user when it is auto-started or stopped. diff --git a/include/openthread/srp_server.h b/include/openthread/srp_server.h index 4c928e0d2..4dceee203 100644 --- a/include/openthread/srp_server.h +++ b/include/openthread/srp_server.h @@ -429,9 +429,9 @@ otError otSrpServerSetLeaseConfig(otInstance *aInstance, const otSrpServerLeaseC * */ typedef void (*otSrpServerServiceUpdateHandler)(otSrpServerServiceUpdateId aId, - const otSrpServerHost * aHost, + const otSrpServerHost *aHost, uint32_t aTimeout, - void * aContext); + void *aContext); /** * This function sets the SRP service updates handler on SRP server. @@ -442,9 +442,9 @@ typedef void (*otSrpServerServiceUpdateHandler)(otSrpServerServiceUpdateId aId, * May be NULL if not used. * */ -void otSrpServerSetServiceUpdateHandler(otInstance * aInstance, +void otSrpServerSetServiceUpdateHandler(otInstance *aInstance, otSrpServerServiceUpdateHandler aServiceHandler, - void * aContext); + void *aContext); /** * This function reports the result of processing a SRP update to the SRP server. @@ -537,7 +537,7 @@ void otSrpServerHostGetLeaseInfo(const otSrpServerHost *aHost, otSrpServerLeaseI * @returns A pointer to the next service or NULL if there is no more services. * */ -const otSrpServerService *otSrpServerHostGetNextService(const otSrpServerHost * aHost, +const otSrpServerService *otSrpServerHostGetNextService(const otSrpServerHost *aHost, const otSrpServerService *aService); /** @@ -572,11 +572,11 @@ const otSrpServerService *otSrpServerHostGetNextService(const otSrpServerHost * * @returns A pointer to the next matching service or NULL if no matching service could be found. * */ -const otSrpServerService *otSrpServerHostFindNextService(const otSrpServerHost * aHost, +const otSrpServerService *otSrpServerHostFindNextService(const otSrpServerHost *aHost, const otSrpServerService *aPrevService, otSrpServerServiceFlags aFlags, - const char * aServiceName, - const char * aInstanceName); + const char *aServiceName, + const char *aInstanceName); /** * This function indicates whether or not the SRP service has been deleted. diff --git a/include/openthread/tcp.h b/include/openthread/tcp.h index 1b1d4b8eb..910831a01 100644 --- a/include/openthread/tcp.h +++ b/include/openthread/tcp.h @@ -63,7 +63,7 @@ extern "C" { typedef struct otLinkedBuffer { struct otLinkedBuffer *mNext; ///< Pointer to the next linked buffer in the chain, or NULL if it is the end. - const uint8_t * mData; ///< Pointer to data referenced by this linked buffer. + const uint8_t *mData; ///< Pointer to data referenced by this linked buffer. size_t mLength; ///< Length of this linked buffer (number of bytes). } otLinkedBuffer; @@ -249,7 +249,7 @@ struct otTcpEndpoint } mTcb; struct otTcpEndpoint *mNext; ///< A pointer to the next TCP endpoint (internal use only) - void * mContext; ///< A pointer to application-specific context + void *mContext; ///< A pointer to application-specific context otTcpEstablished mEstablishedCallback; ///< "Established" callback function otTcpSendDone mSendDoneCallback; ///< "Send done" callback function @@ -279,7 +279,7 @@ typedef struct otTcpEndpointInitializeArgs otTcpReceiveAvailable mReceiveAvailableCallback; ///< "Receive available" callback function otTcpDisconnected mDisconnectedCallback; ///< "Disconnected" callback function - void * mReceiveBuffer; ///< Pointer to memory provided to the system for the TCP receive buffer + void *mReceiveBuffer; ///< Pointer to memory provided to the system for the TCP receive buffer size_t mReceiveBufferSize; ///< Size of memory provided to the system for the TCP receive buffer } otTcpEndpointInitializeArgs; @@ -325,8 +325,8 @@ typedef struct otTcpEndpointInitializeArgs * @retval OT_ERROR_FAILED Failed to open the TCP endpoint. * */ -otError otTcpEndpointInitialize(otInstance * aInstance, - otTcpEndpoint * aEndpoint, +otError otTcpEndpointInitialize(otInstance *aInstance, + otTcpEndpoint *aEndpoint, const otTcpEndpointInitializeArgs *aArgs); /** @@ -624,9 +624,9 @@ typedef enum otTcpIncomingConnectionAction * @returns Description of how to handle the incoming connection. * */ -typedef otTcpIncomingConnectionAction (*otTcpAcceptReady)(otTcpListener * aListener, +typedef otTcpIncomingConnectionAction (*otTcpAcceptReady)(otTcpListener *aListener, const otSockAddr *aPeer, - otTcpEndpoint ** aAcceptInto); + otTcpEndpoint **aAcceptInto); /** * This callback indicates that the TCP connection is now ready for two-way @@ -670,11 +670,11 @@ struct otTcpListener union { uint8_t mSize[OT_TCP_LISTENER_TCB_SIZE_BASE + OT_TCP_LISTENER_TCB_NUM_PTR * sizeof(void *)]; - void * mAlign; + void *mAlign; } mTcbListen; struct otTcpListener *mNext; ///< A pointer to the next TCP listener (internal use only) - void * mContext; ///< A pointer to application-specific context + void *mContext; ///< A pointer to application-specific context otTcpAcceptReady mAcceptReadyCallback; ///< "Accept ready" callback function otTcpAcceptDone mAcceptDoneCallback; ///< "Accept done" callback function @@ -709,8 +709,8 @@ typedef struct otTcpListenerInitializeArgs * @retval OT_ERROR_FAILED Failed to open the TCP listener. * */ -otError otTcpListenerInitialize(otInstance * aInstance, - otTcpListener * aListener, +otError otTcpListenerInitialize(otInstance *aInstance, + otTcpListener *aListener, const otTcpListenerInitializeArgs *aArgs); /** diff --git a/include/openthread/tcp_ext.h b/include/openthread/tcp_ext.h index 75808abe0..576e32e78 100644 --- a/include/openthread/tcp_ext.h +++ b/include/openthread/tcp_ext.h @@ -150,11 +150,11 @@ enum * @returns OT_ERROR_NONE Successfully copied data into the send buffer and sent it on the TCP endpoint. * @returns OT_ERROR_FAILED Failed to send out data on the TCP endpoint. */ -otError otTcpCircularSendBufferWrite(otTcpEndpoint * aEndpoint, +otError otTcpCircularSendBufferWrite(otTcpEndpoint *aEndpoint, otTcpCircularSendBuffer *aSendBuffer, - const void * aData, + const void *aData, size_t aLength, - size_t * aWritten, + size_t *aWritten, uint32_t aFlags); /** diff --git a/include/openthread/thread.h b/include/openthread/thread.h index 244a21fb5..84ab4ca8d 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -278,13 +278,13 @@ bool otThreadIsSingleton(otInstance *aInstance); * @retval OT_ERROR_BUSY Thread Discovery Scan is already in progress. * */ -otError otThreadDiscover(otInstance * aInstance, +otError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This function determines if an MLE Thread Discovery is currently in progress. @@ -311,7 +311,7 @@ bool otThreadIsDiscoverInProgress(otInstance *aInstance); * @retval OT_ERROR_INVALID_ARGS Invalid AdvData. * */ -otError otThreadSetJoinerAdvertisement(otInstance * aInstance, +otError otThreadSetJoinerAdvertisement(otInstance *aInstance, uint32_t aOui, const uint8_t *aAdvData, uint8_t aAdvDataLength); @@ -933,9 +933,9 @@ typedef void (*otThreadParentResponseCallback)(otThreadParentResponseInfo *aInfo * @param[in] aContext A pointer to callback client-specific context. * */ -void otThreadRegisterParentResponseCallback(otInstance * aInstance, +void otThreadRegisterParentResponseCallback(otInstance *aInstance, otThreadParentResponseCallback aCallback, - void * aContext); + void *aContext); /** * This structure represents the Thread Discovery Request data. @@ -965,9 +965,9 @@ typedef void (*otThreadDiscoveryRequestCallback)(const otThreadDiscoveryRequestI * @param[in] aContext A pointer to callback application-specific context. * */ -void otThreadSetDiscoveryRequestCallback(otInstance * aInstance, +void otThreadSetDiscoveryRequestCallback(otInstance *aInstance, otThreadDiscoveryRequestCallback aCallback, - void * aContext); + void *aContext); /** * This function pointer type defines the callback to notify the outcome of a `otThreadLocateAnycastDestination()` @@ -982,7 +982,7 @@ void otThreadSetDiscoveryRequestCallback(otInstance * aInsta * @param[in] aRloc16 The RLOC16 of the destination if found, otherwise invalid RLOC16 (0xfffe). * */ -typedef void (*otThreadAnycastLocatorCallback)(void * aContext, +typedef void (*otThreadAnycastLocatorCallback)(void *aContext, otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16); @@ -1004,10 +1004,10 @@ typedef void (*otThreadAnycastLocatorCallback)(void * aContext, * @retval OT_ERROR_NO_BUFS Out of buffer to prepare and send the request message. * */ -otError otThreadLocateAnycastDestination(otInstance * aInstance, - const otIp6Address * aAnycastAddress, +otError otThreadLocateAnycastDestination(otInstance *aInstance, + const otIp6Address *aAnycastAddress, otThreadAnycastLocatorCallback aCallback, - void * aContext); + void *aContext); /** * This function indicates whether an anycast locate request is currently in progress. @@ -1032,9 +1032,9 @@ bool otThreadIsAnycastLocateInProgress(otInstance *aInstance); * @param[in] aMlIid The ML-IID of the ADDR_NTF.ntf message. * */ -void otThreadSendAddressNotification(otInstance * aInstance, - otIp6Address * aDestination, - otIp6Address * aTarget, +void otThreadSendAddressNotification(otInstance *aInstance, + otIp6Address *aDestination, + otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid); /** @@ -1051,8 +1051,8 @@ void otThreadSendAddressNotification(otInstance * aInstance, * @retval OT_ERROR_NO_BUFS If insufficient message buffers available. * */ -otError otThreadSendProactiveBackboneNotification(otInstance * aInstance, - otIp6Address * aTarget, +otError otThreadSendProactiveBackboneNotification(otInstance *aInstance, + otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid, uint32_t aTimeSinceLastTransaction); diff --git a/include/openthread/thread_ftd.h b/include/openthread/thread_ftd.h index 5d7904d42..9a1c500d6 100644 --- a/include/openthread/thread_ftd.h +++ b/include/openthread/thread_ftd.h @@ -498,10 +498,10 @@ otError otThreadGetChildInfoByIndex(otInstance *aInstance, uint16_t aChildIndex, * @sa otThreadGetChildInfoByIndex * */ -otError otThreadGetChildNextIp6Address(otInstance * aInstance, +otError otThreadGetChildNextIp6Address(otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, - otIp6Address * aAddress); + otIp6Address *aAddress); /** * Get the current Router ID Sequence. diff --git a/include/openthread/udp.h b/include/openthread/udp.h index 3b2ffceba..5a2681320 100644 --- a/include/openthread/udp.h +++ b/include/openthread/udp.h @@ -70,7 +70,7 @@ typedef struct otUdpReceiver { struct otUdpReceiver *mNext; ///< A pointer to the next UDP receiver (internal use only). otUdpHandler mHandler; ///< A function pointer to the receiver callback. - void * mContext; ///< A pointer to application-specific context. + void *mContext; ///< A pointer to application-specific context. } otUdpReceiver; /** @@ -125,8 +125,8 @@ typedef struct otUdpSocket otSockAddr mSockName; ///< The local IPv6 socket address. otSockAddr mPeerName; ///< The peer IPv6 socket address. otUdpReceive mHandler; ///< A function pointer to the application callback. - void * mContext; ///< A pointer to application-specific context. - void * mHandle; ///< A handle to platform's UDP. + void *mContext; ///< A pointer to application-specific context. + void *mHandle; ///< A handle to platform's UDP. struct otUdpSocket *mNext; ///< A pointer to the next UDP socket (internal use only). } otUdpSocket; @@ -278,11 +278,11 @@ otUdpSocket *otUdpGetSockets(otInstance *aInstance); * @param[in] aContext A pointer to application-specific context. * */ -typedef void (*otUdpForwarder)(otMessage * aMessage, +typedef void (*otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, - void * aContext); + void *aContext); /** * Set UDP forward callback to deliver UDP packets to host. @@ -306,8 +306,8 @@ void otUdpForwardSetForwarder(otInstance *aInstance, otUdpForwarder aForwarder, * @warning No matter the call success or fail, the message is freed. * */ -void otUdpForwardReceive(otInstance * aInstance, - otMessage * aMessage, +void otUdpForwardReceive(otInstance *aInstance, + otMessage *aMessage, uint16_t aPeerPort, const otIp6Address *aPeerAddr, uint16_t aSockPort); diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index daa0f7c76..c9c6e7dcb 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -208,7 +208,7 @@ const char *Interpreter::LinkModeToString(const otLinkModeConfig &aLinkMode, cha template <> otError Interpreter::Process(Arg aArgs[]) { otError error; - char * args[kMaxArgs]; + char *args[kMaxArgs]; char output[OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE]; // all diagnostics related features are processed within diagnostics module @@ -340,7 +340,7 @@ otError Interpreter::ParseEnableOrDisable(const Arg &aArg, bool &aEnable) otError Interpreter::ParseJoinerDiscerner(Arg &aArg, otJoinerDiscerner &aDiscerner) { otError error; - char * separator; + char *separator; VerifyOrExit(!aArg.IsEmpty(), error = OT_ERROR_INVALID_ARGS); @@ -362,7 +362,7 @@ exit: otError Interpreter::ParsePingInterval(const Arg &aArg, uint32_t &aInterval) { otError error = OT_ERROR_NONE; - const char * string = aArg.GetCString(); + const char *string = aArg.GetCString(); const uint32_t msFactor = 1000; uint32_t factor = msFactor; @@ -457,10 +457,10 @@ const char *Interpreter::PreferenceToString(signed int aPreference) return str; } -otError Interpreter::ParseToIp6Address(otInstance * aInstance, - const Arg & aArg, +otError Interpreter::ParseToIp6Address(otInstance *aInstance, + const Arg &aArg, otIp6Address &aAddress, - bool & aSynthesized) + bool &aSynthesized) { Error error = kErrorNone; @@ -959,7 +959,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) }; static const uint8_t kNat64CounterTableHeaderColumns[] = {15, 25, 25}; static const char *const kNat64CounterTableSubHeader[] = { - "Protocol", "Pkts", "Bytes", "Pkts", "Bytes", + "Protocol", "Pkts", "Bytes", "Pkts", "Bytes", }; static const uint8_t kNat64CounterTableSubHeaderColumns[] = { 15, 10, 14, 10, 14, @@ -1574,7 +1574,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct BufferInfoName { const otMessageQueueInfo otBufferInfo::*mQueuePtr; - const char * mName; + const char *mName; }; static const BufferInfoName kBufferInfoNames[] = { @@ -2384,7 +2384,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct RadioCoexMetricName { const uint32_t otRadioCoexMetrics::*mValuePtr; - const char * mName; + const char *mName; }; static const RadioCoexMetricName kTxMetricNames[] = { @@ -2517,7 +2517,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct BrCounterName { const otPacketsAndBytes otBorderRoutingCounters::*mPacketsAndBytes; - const char * mName; + const char *mName; }; static const BrCounterName kCounterNames[] = { @@ -2614,7 +2614,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct MacCounterName { const uint32_t otMacCounters::*mValuePtr; - const char * mName; + const char *mName; }; static const MacCounterName kTxCounterNames[] = { @@ -2716,7 +2716,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct MleCounterName { const uint16_t otMleCounters::*mValuePtr; - const char * mName; + const char *mName; }; static const MleCounterName kCounterNames[] = { @@ -2742,7 +2742,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct MleTimeCounterName { const uint64_t otMleCounters::*mValuePtr; - const char * mName; + const char *mName; }; static const MleTimeCounterName kTimeCounterNames[] = { @@ -2802,7 +2802,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) struct IpCounterName { const uint32_t otIpCounters::*mValuePtr; - const char * mName; + const char *mName; }; static const IpCounterName kCounterNames[] = { @@ -4163,10 +4163,10 @@ template <> otError Interpreter::Process(Arg aArgs[]) #endif // OPENTHREAD_FTD #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE -void Interpreter::HandleLinkMetricsReport(const otIp6Address * aAddress, +void Interpreter::HandleLinkMetricsReport(const otIp6Address *aAddress, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, - void * aContext) + void *aContext) { static_cast(aContext)->HandleLinkMetricsReport(aAddress, aMetricsValues, aStatus); } @@ -4196,7 +4196,7 @@ void Interpreter::PrintLinkMetricsValue(const otLinkMetricsValues *aMetricsValue } } -void Interpreter::HandleLinkMetricsReport(const otIp6Address * aAddress, +void Interpreter::HandleLinkMetricsReport(const otIp6Address *aAddress, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus) { @@ -4233,15 +4233,15 @@ void Interpreter::HandleLinkMetricsMgmtResponse(const otIp6Address *aAddress, ui } void Interpreter::HandleLinkMetricsEnhAckProbingIe(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues, - void * aContext) + void *aContext) { static_cast(aContext)->HandleLinkMetricsEnhAckProbingIe(aShortAddress, aExtAddress, aMetricsValues); } void Interpreter::HandleLinkMetricsEnhAckProbingIe(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues) { OutputFormat("Received Link Metrics data in Enh Ack from neighbor, short address:0x%02x , extended address:", @@ -4525,7 +4525,7 @@ otError Interpreter::ProcessLinkMetricsMgmt(Arg aArgs[]) { otLinkMetricsEnhAckFlags enhAckFlags; otLinkMetrics linkMetrics; - otLinkMetrics * pLinkMetrics = &linkMetrics; + otLinkMetrics *pLinkMetrics = &linkMetrics; /** * @cli linkmetrics mgmt enhanced-ack clear @@ -4630,7 +4630,7 @@ exit: return error; } -void Interpreter::HandleLocateResult(void * aContext, +void Interpreter::HandleLocateResult(void *aContext, otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16) @@ -4786,7 +4786,7 @@ exit: return error; } -void Interpreter::HandleMlrRegResult(void * aContext, +void Interpreter::HandleMlrRegResult(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, @@ -6841,7 +6841,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) { uint16_t index = 0; otTrelPeerIterator iterator; - const otTrelPeer * peer; + const otTrelPeer *peer; bool isTable = true; if (aArgs[1] == "list") @@ -6936,16 +6936,16 @@ exit: } void Interpreter::HandleDiagnosticGetResponse(otError aError, - otMessage * aMessage, + otMessage *aMessage, const otMessageInfo *aMessageInfo, - void * aContext) + void *aContext) { static_cast(aContext)->HandleDiagnosticGetResponse( aError, aMessage, static_cast(aMessageInfo)); } void Interpreter::HandleDiagnosticGetResponse(otError aError, - const otMessage * aMessage, + const otMessage *aMessage, const Ip6::MessageInfo *aMessageInfo) { uint8_t buf[16]; diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 361a57707..ee83c7f32 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -153,7 +153,10 @@ public: * @returns Whether the interpreter is initialized. * */ - static bool IsInitialized(void) { return sInterpreter != nullptr; } + static bool IsInitialized(void) + { + return sInterpreter != nullptr; + } /** * This method interprets a CLI command. @@ -251,10 +254,10 @@ public: * @retval OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data. * */ - static otError ParseToIp6Address(otInstance * aInstance, - const Arg & aArg, + static otError ParseToIp6Address(otInstance *aInstance, + const Arg &aArg, otIp6Address &aAddress, - bool & aSynthesized); + bool &aSynthesized); protected: static Interpreter *sInterpreter; @@ -392,14 +395,14 @@ private: otError ParseLinkMetricsFlags(otLinkMetrics &aLinkMetrics, const Arg &aFlags); #endif #if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE - static void HandleLocateResult(void * aContext, + static void HandleLocateResult(void *aContext, otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16); void HandleLocateResult(otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16); #endif #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE - static void HandleMlrRegResult(void * aContext, + static void HandleMlrRegResult(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, @@ -432,9 +435,9 @@ private: #if OPENTHREAD_FTD || (OPENTHREAD_MTD && OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE) void HandleDiagnosticGetResponse(otError aError, const otMessage *aMessage, const Ip6::MessageInfo *aMessageInfo); static void HandleDiagnosticGetResponse(otError aError, - otMessage * aMessage, + otMessage *aMessage, const otMessageInfo *aMessageInfo, - void * aContext); + void *aContext); void OutputMode(uint8_t aIndentSize, const otLinkModeConfig &aMode); void OutputConnectivity(uint8_t aIndentSize, const otNetworkDiagConnectivity &aConnectivity); @@ -475,12 +478,12 @@ private: #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE void PrintLinkMetricsValue(const otLinkMetricsValues *aMetricsValues); - static void HandleLinkMetricsReport(const otIp6Address * aAddress, + static void HandleLinkMetricsReport(const otIp6Address *aAddress, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, - void * aContext); + void *aContext); - void HandleLinkMetricsReport(const otIp6Address * aAddress, + void HandleLinkMetricsReport(const otIp6Address *aAddress, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus); @@ -489,12 +492,12 @@ private: void HandleLinkMetricsMgmtResponse(const otIp6Address *aAddress, uint8_t aStatus); static void HandleLinkMetricsEnhAckProbingIe(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues, - void * aContext); + void *aContext); void HandleLinkMetricsEnhAckProbingIe(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues); const char *LinkMetricsStatusToStr(uint8_t aStatus); @@ -518,7 +521,7 @@ private: const otCliCommand *mUserCommands; uint8_t mUserCommandsLength; - void * mUserCommandsContext; + void *mUserCommandsContext; bool mCommandIsPending; TimerMilliContext mTimer; diff --git a/src/cli/cli_coap.cpp b/src/cli/cli_coap.cpp index 94d6de1a6..93b64f139 100644 --- a/src/cli/cli_coap.cpp +++ b/src/cli/cli_coap.cpp @@ -75,7 +75,7 @@ Coap::Coap(otInstance *aInstance, OutputImplementer &aOutputImplementer) otError Coap::CancelResourceSubscription(void) { otError error = OT_ERROR_NONE; - otMessage * message = nullptr; + otMessage *message = nullptr; otMessageInfo messageInfo; memset(&messageInfo, 0, sizeof(messageInfo)); @@ -192,7 +192,7 @@ exit: template <> otError Coap::Process(Arg aArgs[]) { #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE - otMessage * notificationMessage = nullptr; + otMessage *notificationMessage = nullptr; otMessageInfo messageInfo; #endif otError error = OT_ERROR_NONE; @@ -273,7 +273,7 @@ template <> otError Coap::Process(Arg aArgs[]) template <> otError Coap::Process(Arg aArgs[]) { otError error = OT_ERROR_NONE; - bool * defaultTxParameters; + bool *defaultTxParameters; otCoapTxParameters *txParameters; if (aArgs[0] == "request") @@ -362,7 +362,7 @@ otError Coap::ProcessRequest(Arg aArgs[], otCoapCode aCoapCode) #endif { otError error = OT_ERROR_NONE; - otMessage * message = nullptr; + otMessage *message = nullptr; otMessageInfo messageInfo; uint16_t payloadLength = 0; @@ -800,8 +800,8 @@ exit: } #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE -void Coap::HandleNotificationResponse(void * aContext, - otMessage * aMessage, +void Coap::HandleNotificationResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aError) { @@ -874,7 +874,7 @@ void Coap::HandleResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError Coap::BlockwiseReceiveHook(void * aContext, +otError Coap::BlockwiseReceiveHook(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, @@ -903,11 +903,11 @@ otError Coap::BlockwiseReceiveHook(const uint8_t *aBlock, return OT_ERROR_NONE; } -otError Coap::BlockwiseTransmitHook(void * aContext, - uint8_t * aBlock, +otError Coap::BlockwiseTransmitHook(void *aContext, + uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, - bool * aMore) + bool *aMore) { return static_cast(aContext)->BlockwiseTransmitHook(aBlock, aPosition, aBlockLength, aMore); } diff --git a/src/cli/cli_coap.hpp b/src/cli/cli_coap.hpp index 53f2e003d..041e7ae94 100644 --- a/src/cli/cli_coap.hpp +++ b/src/cli/cli_coap.hpp @@ -106,8 +106,8 @@ private: void HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo); #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE - static void HandleNotificationResponse(void * aContext, - otMessage * aMessage, + static void HandleNotificationResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aError); void HandleNotificationResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aError); @@ -118,7 +118,7 @@ private: #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE - static otError BlockwiseReceiveHook(void * aContext, + static otError BlockwiseReceiveHook(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, @@ -129,11 +129,11 @@ private: uint16_t aBlockLength, bool aMore, uint32_t aTotalLength); - static otError BlockwiseTransmitHook(void * aContext, - uint8_t * aBlock, + static otError BlockwiseTransmitHook(void *aContext, + uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, - bool * aMore); + bool *aMore); otError BlockwiseTransmitHook(uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore); #endif diff --git a/src/cli/cli_coap_secure.cpp b/src/cli/cli_coap_secure.cpp index 27194d956..ca08785e8 100644 --- a/src/cli/cli_coap_secure.cpp +++ b/src/cli/cli_coap_secure.cpp @@ -694,7 +694,7 @@ exit: #endif // CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError CoapSecure::BlockwiseReceiveHook(void * aContext, +otError CoapSecure::BlockwiseReceiveHook(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, @@ -724,11 +724,11 @@ otError CoapSecure::BlockwiseReceiveHook(const uint8_t *aBlock, return OT_ERROR_NONE; } -otError CoapSecure::BlockwiseTransmitHook(void * aContext, - uint8_t * aBlock, +otError CoapSecure::BlockwiseTransmitHook(void *aContext, + uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, - bool * aMore) + bool *aMore) { return static_cast(aContext)->BlockwiseTransmitHook(aBlock, aPosition, aBlockLength, aMore); } diff --git a/src/cli/cli_coap_secure.hpp b/src/cli/cli_coap_secure.hpp index 6fded2605..9bdc63135 100644 --- a/src/cli/cli_coap_secure.hpp +++ b/src/cli/cli_coap_secure.hpp @@ -111,7 +111,7 @@ private: #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE - static otError BlockwiseReceiveHook(void * aContext, + static otError BlockwiseReceiveHook(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, @@ -122,11 +122,11 @@ private: uint16_t aBlockLength, bool aMore, uint32_t aTotalLength); - static otError BlockwiseTransmitHook(void * aContext, - uint8_t * aBlock, + static otError BlockwiseTransmitHook(void *aContext, + uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, - bool * aMore); + bool *aMore); otError BlockwiseTransmitHook(uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore); #endif diff --git a/src/cli/cli_commissioner.cpp b/src/cli/cli_commissioner.cpp index df61f9222..d8fa14a09 100644 --- a/src/cli/cli_commissioner.cpp +++ b/src/cli/cli_commissioner.cpp @@ -385,16 +385,16 @@ const char *Commissioner::StateToString(otCommissionerState aState) } void Commissioner::HandleJoinerEvent(otCommissionerJoinerEvent aEvent, - const otJoinerInfo * aJoinerInfo, - const otExtAddress * aJoinerId, - void * aContext) + const otJoinerInfo *aJoinerInfo, + const otExtAddress *aJoinerId, + void *aContext) { static_cast(aContext)->HandleJoinerEvent(aEvent, aJoinerInfo, aJoinerId); } void Commissioner::HandleJoinerEvent(otCommissionerJoinerEvent aEvent, - const otJoinerInfo * aJoinerInfo, - const otExtAddress * aJoinerId) + const otJoinerInfo *aJoinerInfo, + const otExtAddress *aJoinerId) { static const char *const kEventStrings[] = { "start", // (0) OT_COMMISSIONER_JOINER_START @@ -476,7 +476,7 @@ exit: void Commissioner::HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, - void * aContext) + void *aContext) { static_cast(aContext)->HandleEnergyReport(aChannelMask, aEnergyList, aEnergyListLength); } diff --git a/src/cli/cli_commissioner.hpp b/src/cli/cli_commissioner.hpp index 3c568a006..7b63cb0d2 100644 --- a/src/cli/cli_commissioner.hpp +++ b/src/cli/cli_commissioner.hpp @@ -88,17 +88,17 @@ private: void HandleStateChanged(otCommissionerState aState); static void HandleJoinerEvent(otCommissionerJoinerEvent aEvent, - const otJoinerInfo * aJoinerInfo, - const otExtAddress * aJoinerId, - void * aContext); + const otJoinerInfo *aJoinerInfo, + const otExtAddress *aJoinerId, + void *aContext); void HandleJoinerEvent(otCommissionerJoinerEvent aEvent, - const otJoinerInfo * aJoinerInfo, - const otExtAddress * aJoinerId); + const otJoinerInfo *aJoinerInfo, + const otExtAddress *aJoinerId); static void HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, - void * aContext); + void *aContext); void HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength); static void HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask, void *aContext); diff --git a/src/cli/cli_output.hpp b/src/cli/cli_output.hpp index d4559da7b..74dfa4b00 100644 --- a/src/cli/cli_output.hpp +++ b/src/cli/cli_output.hpp @@ -90,9 +90,14 @@ public: OutputImplementer(otCliOutputCallback aCallback, void *aCallbackContext); #if OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE - void SetEmittingCommandOutput(bool aEmittingOutput) { mEmittingCommandOutput = aEmittingOutput; } + void SetEmittingCommandOutput(bool aEmittingOutput) + { + mEmittingCommandOutput = aEmittingOutput; + } #else - void SetEmittingCommandOutput(bool) {} + void SetEmittingCommandOutput(bool) + { + } #endif private: @@ -101,7 +106,7 @@ private: void OutputV(const char *aFormat, va_list aArguments); otCliOutputCallback mCallback; - void * mCallbackContext; + void *mCallbackContext; #if OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE char mOutputString[kInputOutputLogStringSize]; uint16_t mOutputLength; @@ -507,7 +512,9 @@ protected: #if OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE void LogInput(const Arg *aArgs); #else - void LogInput(const Arg *) {} + void LogInput(const Arg *) + { + } #endif private: @@ -516,7 +523,7 @@ private: void OutputTableHeader(uint8_t aNumColumns, const char *const aTitles[], const uint8_t aWidths[]); void OutputTableSeparator(uint8_t aNumColumns, const uint8_t aWidths[]); - otInstance * mInstance; + otInstance *mInstance; OutputImplementer &mImplementer; }; diff --git a/src/cli/cli_srp_client.cpp b/src/cli/cli_srp_client.cpp index f83ec7824..0294c5306 100644 --- a/src/cli/cli_srp_client.cpp +++ b/src/cli/cli_srp_client.cpp @@ -129,7 +129,7 @@ template <> otError SrpClient::Process(Arg aArgs[]) { uint16_t len; uint16_t size; - char * hostName; + char *hostName; VerifyOrExit(aArgs[2].IsEmpty(), error = OT_ERROR_INVALID_ARGS); hostName = otSrpClientBuffersGetHostNameString(GetInstancePtr(), &size); @@ -359,9 +359,9 @@ otError SrpClient::ProcessServiceAdd(Arg aArgs[]) otSrpClientBuffersServiceEntry *entry = nullptr; uint16_t size; - char * string; + char *string; otError error; - char * label; + char *label; entry = otSrpClientBuffersAllocateService(GetInstancePtr()); @@ -562,17 +562,17 @@ template <> otError SrpClient::Process(Arg aArgs[]) void SrpClient::HandleCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext) + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext) { static_cast(aContext)->HandleCallback(aError, aHostInfo, aServices, aRemovedServices); } void SrpClient::HandleCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices) + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices) { otSrpClientService *next; diff --git a/src/cli/cli_srp_client.hpp b/src/cli/cli_srp_client.hpp index 27c75ebe0..9b9ea4237 100644 --- a/src/cli/cli_srp_client.hpp +++ b/src/cli/cli_srp_client.hpp @@ -92,13 +92,13 @@ private: static void HandleCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext); + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext); void HandleCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices); + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices); bool mCallbackEnabled; }; diff --git a/src/cli/cli_srp_server.cpp b/src/cli/cli_srp_server.cpp index 035abf13d..6a0a40276 100644 --- a/src/cli/cli_srp_server.cpp +++ b/src/cli/cli_srp_server.cpp @@ -300,9 +300,9 @@ template <> otError SrpServer::Process(Arg aArgs[]) kAnyServiceName, kAnyInstanceName)) != nullptr) { bool isDeleted = otSrpServerServiceIsDeleted(service); - const char * instanceName = otSrpServerServiceGetInstanceName(service); + const char *instanceName = otSrpServerServiceGetInstanceName(service); const otSrpServerService *subService = nullptr; - const uint8_t * txtData; + const uint8_t *txtData; uint16_t txtDataLength; bool hasSubType = false; otSrpServerLeaseInfo leaseInfo; diff --git a/src/cli/cli_tcp.cpp b/src/cli/cli_tcp.cpp index 0f5d1afce..2ee39b12c 100644 --- a/src/cli/cli_tcp.cpp +++ b/src/cli/cli_tcp.cpp @@ -423,16 +423,16 @@ void TcpExample::HandleTcpDisconnectedCallback(otTcpEndpoint *aEndpoint, otTcpDi static_cast(otTcpEndpointGetContext(aEndpoint))->HandleTcpDisconnected(aEndpoint, aReason); } -otTcpIncomingConnectionAction TcpExample::HandleTcpAcceptReadyCallback(otTcpListener * aListener, +otTcpIncomingConnectionAction TcpExample::HandleTcpAcceptReadyCallback(otTcpListener *aListener, const otSockAddr *aPeer, - otTcpEndpoint ** aAcceptInto) + otTcpEndpoint **aAcceptInto) { return static_cast(otTcpListenerGetContext(aListener)) ->HandleTcpAcceptReady(aListener, aPeer, aAcceptInto); } -void TcpExample::HandleTcpAcceptDoneCallback(otTcpListener * aListener, - otTcpEndpoint * aEndpoint, +void TcpExample::HandleTcpAcceptDoneCallback(otTcpListener *aListener, + otTcpEndpoint *aEndpoint, const otSockAddr *aPeer) { static_cast(otTcpListenerGetContext(aListener))->HandleTcpAcceptDone(aListener, aEndpoint, aPeer); @@ -567,9 +567,9 @@ void TcpExample::HandleTcpDisconnected(otTcpEndpoint *aEndpoint, otTcpDisconnect otTcpCircularSendBufferForceDiscardAll(&mSendBuffer); } -otTcpIncomingConnectionAction TcpExample::HandleTcpAcceptReady(otTcpListener * aListener, +otTcpIncomingConnectionAction TcpExample::HandleTcpAcceptReady(otTcpListener *aListener, const otSockAddr *aPeer, - otTcpEndpoint ** aAcceptInto) + otTcpEndpoint **aAcceptInto) { otTcpIncomingConnectionAction action; @@ -610,9 +610,9 @@ otError TcpExample::ContinueBenchmarkCircularSend(void) { size_t toSendThisIteration = OT_MIN(mBenchmarkBytesUnsent, sBenchmarkDataLength); uint32_t flag = (toSendThisIteration < freeSpace && toSendThisIteration < mBenchmarkBytesUnsent) - ? OT_TCP_CIRCULAR_SEND_BUFFER_WRITE_MORE_TO_COME - : 0; - size_t written; + ? OT_TCP_CIRCULAR_SEND_BUFFER_WRITE_MORE_TO_COME + : 0; + size_t written; SuccessOrExit(error = otTcpCircularSendBufferWrite(&mEndpoint, &mSendBuffer, sBenchmarkData, toSendThisIteration, &written, flag)); diff --git a/src/cli/cli_tcp.hpp b/src/cli/cli_tcp.hpp index 5e2bb618c..53f890715 100644 --- a/src/cli/cli_tcp.hpp +++ b/src/cli/cli_tcp.hpp @@ -88,11 +88,11 @@ private: bool aEndOfStream, size_t aBytesRemaining); static void HandleTcpDisconnectedCallback(otTcpEndpoint *aEndpoint, otTcpDisconnectedReason aReason); - static otTcpIncomingConnectionAction HandleTcpAcceptReadyCallback(otTcpListener * aListener, + static otTcpIncomingConnectionAction HandleTcpAcceptReadyCallback(otTcpListener *aListener, const otSockAddr *aPeer, - otTcpEndpoint ** aAcceptInto); - static void HandleTcpAcceptDoneCallback(otTcpListener * aListener, - otTcpEndpoint * aEndpoint, + otTcpEndpoint **aAcceptInto); + static void HandleTcpAcceptDoneCallback(otTcpListener *aListener, + otTcpEndpoint *aEndpoint, const otSockAddr *aPeer); void HandleTcpEstablished(otTcpEndpoint *aEndpoint); @@ -103,9 +103,9 @@ private: bool aEndOfStream, size_t aBytesRemaining); void HandleTcpDisconnected(otTcpEndpoint *aEndpoint, otTcpDisconnectedReason aReason); - otTcpIncomingConnectionAction HandleTcpAcceptReady(otTcpListener * aListener, + otTcpIncomingConnectionAction HandleTcpAcceptReady(otTcpListener *aListener, const otSockAddr *aPeer, - otTcpEndpoint ** aAcceptInto); + otTcpEndpoint **aAcceptInto); void HandleTcpAcceptDone(otTcpListener *aListener, otTcpEndpoint *aEndpoint, const otSockAddr *aPeer); otTcpEndpoint mEndpoint; @@ -127,7 +127,7 @@ private: uint32_t mBenchmarkBytesUnsent; TimeMilli mBenchmarkStart; - static constexpr const char * sBenchmarkData = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + static constexpr const char *sBenchmarkData = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; static constexpr const size_t sBenchmarkDataLength = 52; }; diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index deb7f26c7..6edc257e5 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -123,7 +123,7 @@ exit: template <> otError UdpExample::Process(Arg aArgs[]) { otError error = OT_ERROR_NONE; - otMessage * message = nullptr; + otMessage *message = nullptr; otMessageInfo messageInfo; otMessageSettings messageSettings = {mLinkSecurityEnabled, OT_MESSAGE_PRIORITY_NORMAL}; diff --git a/src/core/api/backbone_router_ftd_api.cpp b/src/core/api/backbone_router_ftd_api.cpp index 37c4065ea..6d13c2a0a 100644 --- a/src/core/api/backbone_router_ftd_api.cpp +++ b/src/core/api/backbone_router_ftd_api.cpp @@ -87,23 +87,23 @@ otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterCon return AsCoreType(aInstance).Get().GetDomainPrefix(AsCoreType(aConfig)); } -void otBackboneRouterSetDomainPrefixCallback(otInstance * aInstance, +void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance, otBackboneRouterDomainPrefixCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().SetDomainPrefixCallback(aCallback, aContext); } #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE -void otBackboneRouterSetNdProxyCallback(otInstance * aInstance, +void otBackboneRouterSetNdProxyCallback(otInstance *aInstance, otBackboneRouterNdProxyCallback aCallback, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetCallback(aCallback, aContext); } -otError otBackboneRouterGetNdProxyInfo(otInstance * aInstance, - const otIp6Address * aDua, +otError otBackboneRouterGetNdProxyInfo(otInstance *aInstance, + const otIp6Address *aDua, otBackboneRouterNdProxyInfo *aNdProxyInfo) { AssertPointerIsNotNull(aNdProxyInfo); @@ -114,15 +114,15 @@ otError otBackboneRouterGetNdProxyInfo(otInstance * aInstance, #endif // OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE -void otBackboneRouterSetMulticastListenerCallback(otInstance * aInstance, +void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance, otBackboneRouterMulticastListenerCallback aCallback, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetCallback(aCallback, aContext); } -otError otBackboneRouterMulticastListenerGetNext(otInstance * aInstance, - otChildIp6AddressIterator * aIterator, +otError otBackboneRouterMulticastListenerGetNext(otInstance *aInstance, + otChildIp6AddressIterator *aIterator, otBackboneRouterMulticastListenerInfo *aListenerInfo) { AssertPointerIsNotNull(aIterator); @@ -134,7 +134,7 @@ otError otBackboneRouterMulticastListenerGetNext(otInstance * #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE -void otBackboneRouterConfigNextDuaRegistrationResponse(otInstance * aInstance, +void otBackboneRouterConfigNextDuaRegistrationResponse(otInstance *aInstance, const otIp6InterfaceIdentifier *aMlIid, uint8_t aStatus) { diff --git a/src/core/api/border_router_api.cpp b/src/core/api/border_router_api.cpp index 150e4ff6a..c3dd9ded2 100644 --- a/src/core/api/border_router_api.cpp +++ b/src/core/api/border_router_api.cpp @@ -83,9 +83,9 @@ otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefi return error; } -otError otBorderRouterGetNextOnMeshPrefix(otInstance * aInstance, +otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterator *aIterator, - otBorderRouterConfig * aConfig) + otBorderRouterConfig *aConfig) { AssertPointerIsNotNull(aIterator); @@ -102,7 +102,7 @@ otError otBorderRouterRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPre return AsCoreType(aInstance).Get().RemoveHasRoutePrefix(AsCoreType(aPrefix)); } -otError otBorderRouterGetNextRoute(otInstance * aInstance, +otError otBorderRouterGetNextRoute(otInstance *aInstance, otNetworkDataIterator *aIterator, otExternalRouteConfig *aConfig) { diff --git a/src/core/api/border_routing_api.cpp b/src/core/api/border_routing_api.cpp index 3a67f7ba3..fb5e08075 100644 --- a/src/core/api/border_routing_api.cpp +++ b/src/core/api/border_routing_api.cpp @@ -95,8 +95,8 @@ otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefi return AsCoreType(aInstance).Get().GetNat64Prefix(AsCoreType(aPrefix)); } -otError otBorderRoutingGetFavoredNat64Prefix(otInstance * aInstance, - otIp6Prefix * aPrefix, +otError otBorderRoutingGetFavoredNat64Prefix(otInstance *aInstance, + otIp6Prefix *aPrefix, otRoutePreference *aPreference) { otError error; @@ -120,9 +120,9 @@ void otBorderRoutingPrefixTableInitIterator(otInstance *aInstance, otBorderRouti AsCoreType(aInstance).Get().InitPrefixTableIterator(*aIterator); } -otError otBorderRoutingGetNextPrefixTableEntry(otInstance * aInstance, +otError otBorderRoutingGetNextPrefixTableEntry(otInstance *aInstance, otBorderRoutingPrefixTableIterator *aIterator, - otBorderRoutingPrefixTableEntry * aEntry) + otBorderRoutingPrefixTableEntry *aEntry) { AssertPointerIsNotNull(aIterator); AssertPointerIsNotNull(aEntry); diff --git a/src/core/api/coap_api.cpp b/src/core/api/coap_api.cpp index 4dfb35edf..e8b0e6d52 100644 --- a/src/core/api/coap_api.cpp +++ b/src/core/api/coap_api.cpp @@ -55,7 +55,7 @@ void otCoapMessageInit(otMessage *aMessage, otCoapType aType, otCoapCode aCode) otError otCoapMessageInitResponse(otMessage *aResponse, const otMessage *aRequest, otCoapType aType, otCoapCode aCode) { - Coap::Message & response = AsCoapMessage(aResponse); + Coap::Message &response = AsCoapMessage(aResponse); const Coap::Message &request = AsCoapMessage(aRequest); response.Init(MapEnum(aType), MapEnum(aCode)); @@ -217,12 +217,12 @@ otError otCoapOptionIteratorGetOptionValue(otCoapOptionIterator *aIterator, void } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError otCoapSendRequestBlockWiseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendRequestBlockWiseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext, - const otCoapTxParameters * aTxParameters, + void *aContext, + const otCoapTxParameters *aTxParameters, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) { @@ -243,11 +243,11 @@ exit: } #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError otCoapSendRequestWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendRequestWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, - void * aContext, + void *aContext, const otCoapTxParameters *aTxParameters) { Error error; @@ -304,11 +304,11 @@ void otCoapSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandle } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError otCoapSendResponseBlockWiseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, - const otCoapTxParameters * aTxParameters, - void * aContext, +otError otCoapSendResponseBlockWiseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, + const otCoapTxParameters *aTxParameters, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook) { return AsCoreType(aInstance).GetApplicationCoap().SendMessage(AsCoapMessage(aMessage), AsCoreType(aMessageInfo), @@ -317,9 +317,9 @@ otError otCoapSendResponseBlockWiseWithParameters(otInstance * aI } #endif -otError otCoapSendResponseWithParameters(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, +otError otCoapSendResponseWithParameters(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters) { return AsCoreType(aInstance).GetApplicationCoap().SendMessage( diff --git a/src/core/api/coap_secure_api.cpp b/src/core/api/coap_secure_api.cpp index adf01e7de..a266c2219 100644 --- a/src/core/api/coap_secure_api.cpp +++ b/src/core/api/coap_secure_api.cpp @@ -51,7 +51,7 @@ otError otCoapSecureStart(otInstance *aInstance, uint16_t aPort) } #ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -void otCoapSecureSetCertificate(otInstance * aInstance, +void otCoapSecureSetCertificate(otInstance *aInstance, const uint8_t *aX509Cert, uint32_t aX509Length, const uint8_t *aPrivateKey, @@ -61,7 +61,7 @@ void otCoapSecureSetCertificate(otInstance * aInstance, aPrivateKeyLength); } -void otCoapSecureSetCaCertificateChain(otInstance * aInstance, +void otCoapSecureSetCaCertificateChain(otInstance *aInstance, const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength) { @@ -71,7 +71,7 @@ void otCoapSecureSetCaCertificateChain(otInstance * aInstance, #endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED #ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED -void otCoapSecureSetPsk(otInstance * aInstance, +void otCoapSecureSetPsk(otInstance *aInstance, const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, @@ -85,9 +85,9 @@ void otCoapSecureSetPsk(otInstance * aInstance, #endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED #if defined(MBEDTLS_BASE64_C) && defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) -otError otCoapSecureGetPeerCertificateBase64(otInstance * aInstance, +otError otCoapSecureGetPeerCertificateBase64(otInstance *aInstance, unsigned char *aPeerCert, - size_t * aCertLength, + size_t *aCertLength, size_t aCertBufferSize) { AssertPointerIsNotNull(aPeerCert); @@ -102,10 +102,10 @@ void otCoapSecureSetSslAuthMode(otInstance *aInstance, bool aVerifyPeerCertifica AsCoreType(aInstance).GetApplicationCoapSecure().SetSslAuthMode(aVerifyPeerCertificate); } -otError otCoapSecureConnect(otInstance * aInstance, - const otSockAddr * aSockAddr, +otError otCoapSecureConnect(otInstance *aInstance, + const otSockAddr *aSockAddr, otHandleCoapSecureClientConnect aHandler, - void * aContext) + void *aContext) { return AsCoreType(aInstance).GetApplicationCoapSecure().Connect(AsCoreType(aSockAddr), aHandler, aContext); } @@ -131,10 +131,10 @@ void otCoapSecureStop(otInstance *aInstance) } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError otCoapSecureSendRequestBlockWise(otInstance * aInstance, - otMessage * aMessage, +otError otCoapSecureSendRequestBlockWise(otInstance *aInstance, + otMessage *aMessage, otCoapResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) { @@ -143,10 +143,10 @@ otError otCoapSecureSendRequestBlockWise(otInstance * aInstance, } #endif -otError otCoapSecureSendRequest(otInstance * aInstance, - otMessage * aMessage, +otError otCoapSecureSendRequest(otInstance *aInstance, + otMessage *aMessage, otCoapResponseHandler aHandler, - void * aContext) + void *aContext) { return AsCoreType(aInstance).GetApplicationCoapSecure().SendMessage(AsCoapMessage(aMessage), aHandler, aContext); } @@ -173,9 +173,9 @@ void otCoapSecureRemoveResource(otInstance *aInstance, otCoapResource *aResource AsCoreType(aInstance).GetApplicationCoapSecure().RemoveResource(AsCoreType(aResource)); } -void otCoapSecureSetClientConnectedCallback(otInstance * aInstance, +void otCoapSecureSetClientConnectedCallback(otInstance *aInstance, otHandleCoapSecureClientConnect aHandler, - void * aContext) + void *aContext) { AsCoreType(aInstance).GetApplicationCoapSecure().SetClientConnectedCallback(aHandler, aContext); } @@ -186,10 +186,10 @@ void otCoapSecureSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler a } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -otError otCoapSecureSendResponseBlockWise(otInstance * aInstance, - otMessage * aMessage, - const otMessageInfo * aMessageInfo, - void * aContext, +otError otCoapSecureSendResponseBlockWise(otInstance *aInstance, + otMessage *aMessage, + const otMessageInfo *aMessageInfo, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook) { return AsCoreType(aInstance).GetApplicationCoapSecure().SendMessage( diff --git a/src/core/api/commissioner_api.cpp b/src/core/api/commissioner_api.cpp index 9c5b57590..9b790c6a8 100644 --- a/src/core/api/commissioner_api.cpp +++ b/src/core/api/commissioner_api.cpp @@ -42,10 +42,10 @@ using namespace ot; -otError otCommissionerStart(otInstance * aInstance, +otError otCommissionerStart(otInstance *aInstance, otCommissionerStateCallback aStateCallback, otCommissionerJoinerCallback aJoinerCallback, - void * aCallbackContext) + void *aCallbackContext) { return AsCoreType(aInstance).Get().Start(aStateCallback, aJoinerCallback, aCallbackContext); } @@ -82,9 +82,9 @@ exit: return error; } -otError otCommissionerAddJoinerWithDiscerner(otInstance * aInstance, +otError otCommissionerAddJoinerWithDiscerner(otInstance *aInstance, const otJoinerDiscerner *aDiscerner, - const char * aPskd, + const char *aPskd, uint32_t aTimeout) { return AsCoreType(aInstance).Get().AddJoiner(AsCoreType(aDiscerner), aPskd, aTimeout); @@ -127,7 +127,7 @@ const char *otCommissionerGetProvisioningUrl(otInstance *aInstance) return AsCoreType(aInstance).Get().GetProvisioningUrl(); } -otError otCommissionerAnnounceBegin(otInstance * aInstance, +otError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, @@ -137,25 +137,25 @@ otError otCommissionerAnnounceBegin(otInstance * aInstance, aChannelMask, aCount, aPeriod, AsCoreType(aAddress)); } -otError otCommissionerEnergyScan(otInstance * aInstance, +otError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, - const otIp6Address * aAddress, + const otIp6Address *aAddress, otCommissionerEnergyReportCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().GetEnergyScanClient().SendQuery( aChannelMask, aCount, aPeriod, aScanDuration, AsCoreType(aAddress), aCallback, aContext); } -otError otCommissionerPanIdQuery(otInstance * aInstance, +otError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, - const otIp6Address * aAddress, + const otIp6Address *aAddress, otCommissionerPanIdConflictCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().GetPanIdQueryClient().SendQuery( aPanId, aChannelMask, AsCoreType(aAddress), aCallback, aContext); @@ -166,9 +166,9 @@ otError otCommissionerSendMgmtGet(otInstance *aInstance, const uint8_t *aTlvs, u return AsCoreType(aInstance).Get().SendMgmtCommissionerGetRequest(aTlvs, aLength); } -otError otCommissionerSendMgmtSet(otInstance * aInstance, +otError otCommissionerSendMgmtSet(otInstance *aInstance, const otCommissioningDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength) { return AsCoreType(aInstance).Get().SendMgmtCommissionerSetRequest(AsCoreType(aDataset), diff --git a/src/core/api/crypto_api.cpp b/src/core/api/crypto_api.cpp index 42b8e2a51..64ec9dff0 100644 --- a/src/core/api/crypto_api.cpp +++ b/src/core/api/crypto_api.cpp @@ -60,15 +60,15 @@ void otCryptoHmacSha256(const otCryptoKey *aKey, const uint8_t *aBuf, uint16_t a void otCryptoAesCcm(const otCryptoKey *aKey, uint8_t aTagLength, - const void * aNonce, + const void *aNonce, uint8_t aNonceLength, - const void * aHeader, + const void *aHeader, uint32_t aHeaderLength, - void * aPlainText, - void * aCipherText, + void *aPlainText, + void *aCipherText, uint32_t aLength, bool aEncrypt, - void * aTag) + void *aTag) { AesCcm aesCcm; @@ -92,8 +92,8 @@ void otCryptoAesCcm(const otCryptoKey *aKey, #if OPENTHREAD_CONFIG_ECDSA_ENABLE -otError otCryptoEcdsaSign(uint8_t * aOutput, - uint16_t * aOutputLength, +otError otCryptoEcdsaSign(uint8_t *aOutput, + uint16_t *aOutputLength, const uint8_t *aInputHash, uint16_t aInputHashLength, const uint8_t *aPrivateKey, diff --git a/src/core/api/dataset_api.cpp b/src/core/api/dataset_api.cpp index f8d14f608..5bef2a5bc 100644 --- a/src/core/api/dataset_api.cpp +++ b/src/core/api/dataset_api.cpp @@ -95,53 +95,53 @@ otError otDatasetSetPendingTlvs(otInstance *aInstance, const otOperationalDatase return AsCoreType(aInstance).Get().Save(*aDataset); } -otError otDatasetSendMgmtActiveGet(otInstance * aInstance, +otError otDatasetSendMgmtActiveGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress) + const otIp6Address *aAddress) { return AsCoreType(aInstance).Get().SendGetRequest(AsCoreType(aDatasetComponents), aTlvTypes, aLength, aAddress); } -otError otDatasetSendMgmtActiveSet(otInstance * aInstance, +otError otDatasetSendMgmtActiveSet(otInstance *aInstance, const otOperationalDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().SendSetRequest(AsCoreType(aDataset), aTlvs, aLength, aCallback, aContext); } -otError otDatasetSendMgmtPendingGet(otInstance * aInstance, +otError otDatasetSendMgmtPendingGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress) + const otIp6Address *aAddress) { return AsCoreType(aInstance).Get().SendGetRequest(AsCoreType(aDatasetComponents), aTlvTypes, aLength, aAddress); } -otError otDatasetSendMgmtPendingSet(otInstance * aInstance, +otError otDatasetSendMgmtPendingSet(otInstance *aInstance, const otOperationalDataset *aDataset, - const uint8_t * aTlvs, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().SendSetRequest(AsCoreType(aDataset), aTlvs, aLength, aCallback, aContext); } #if OPENTHREAD_FTD -otError otDatasetGeneratePskc(const char * aPassPhrase, - const otNetworkName * aNetworkName, +otError otDatasetGeneratePskc(const char *aPassPhrase, + const otNetworkName *aNetworkName, const otExtendedPanId *aExtPanId, - otPskc * aPskc) + otPskc *aPskc) { return MeshCoP::GeneratePskc(aPassPhrase, AsCoreType(aNetworkName), AsCoreType(aExtPanId), AsCoreType(aPskc)); } diff --git a/src/core/api/dataset_updater_api.cpp b/src/core/api/dataset_updater_api.cpp index 8cd64812c..b21577a6c 100644 --- a/src/core/api/dataset_updater_api.cpp +++ b/src/core/api/dataset_updater_api.cpp @@ -43,10 +43,10 @@ using namespace ot; -otError otDatasetUpdaterRequestUpdate(otInstance * aInstance, +otError otDatasetUpdaterRequestUpdate(otInstance *aInstance, const otOperationalDataset *aDataset, otDatasetUpdaterCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().RequestUpdate(AsCoreType(aDataset), aCallback, aContext); diff --git a/src/core/api/dns_api.cpp b/src/core/api/dns_api.cpp index 4437b1948..d858e5e0f 100644 --- a/src/core/api/dns_api.cpp +++ b/src/core/api/dns_api.cpp @@ -81,10 +81,10 @@ void otDnsClientSetDefaultConfig(otInstance *aInstance, const otDnsQueryConfig * } } -otError otDnsClientResolveAddress(otInstance * aInstance, - const char * aHostName, +otError otDnsClientResolveAddress(otInstance *aInstance, + const char *aHostName, otDnsAddressCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig) { AssertPointerIsNotNull(aHostName); @@ -94,10 +94,10 @@ otError otDnsClientResolveAddress(otInstance * aInstance, } #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE -otError otDnsClientResolveIp4Address(otInstance * aInstance, - const char * aHostName, +otError otDnsClientResolveIp4Address(otInstance *aInstance, + const char *aHostName, otDnsAddressCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig) { AssertPointerIsNotNull(aHostName); @@ -108,7 +108,7 @@ otError otDnsClientResolveIp4Address(otInstance * aInstance, #endif otError otDnsAddressResponseGetHostName(const otDnsAddressResponse *aResponse, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) { AssertPointerIsNotNull(aNameBuffer); @@ -118,8 +118,8 @@ otError otDnsAddressResponseGetHostName(const otDnsAddressResponse *aResponse, otError otDnsAddressResponseGetAddress(const otDnsAddressResponse *aResponse, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl) + otIp6Address *aAddress, + uint32_t *aTtl) { uint32_t ttl; @@ -128,10 +128,10 @@ otError otDnsAddressResponseGetAddress(const otDnsAddressResponse *aResponse, #if OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE -otError otDnsClientBrowse(otInstance * aInstance, - const char * aServiceName, +otError otDnsClientBrowse(otInstance *aInstance, + const char *aServiceName, otDnsBrowseCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig) { AssertPointerIsNotNull(aServiceName); @@ -140,7 +140,7 @@ otError otDnsClientBrowse(otInstance * aInstance, } otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) { AssertPointerIsNotNull(aNameBuffer); @@ -150,7 +150,7 @@ otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse, otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aResponse, uint16_t aIndex, - char * aLabelBuffer, + char *aLabelBuffer, uint8_t aLabelBufferSize) { AssertPointerIsNotNull(aLabelBuffer); @@ -159,8 +159,8 @@ otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aRespon } otError otDnsBrowseResponseGetServiceInfo(const otDnsBrowseResponse *aResponse, - const char * aInstanceLabel, - otDnsServiceInfo * aServiceInfo) + const char *aInstanceLabel, + otDnsServiceInfo *aServiceInfo) { AssertPointerIsNotNull(aInstanceLabel); @@ -168,10 +168,10 @@ otError otDnsBrowseResponseGetServiceInfo(const otDnsBrowseResponse *aResponse, } otError otDnsBrowseResponseGetHostAddress(const otDnsBrowseResponse *aResponse, - const char * aHostName, + const char *aHostName, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl) + otIp6Address *aAddress, + uint32_t *aTtl) { uint32_t ttl; @@ -180,11 +180,11 @@ otError otDnsBrowseResponseGetHostAddress(const otDnsBrowseResponse *aResponse, return AsCoreType(aResponse).GetHostAddress(aHostName, aIndex, AsCoreType(aAddress), aTtl != nullptr ? *aTtl : ttl); } -otError otDnsClientResolveService(otInstance * aInstance, - const char * aInstanceLabel, - const char * aServiceName, +otError otDnsClientResolveService(otInstance *aInstance, + const char *aInstanceLabel, + const char *aServiceName, otDnsServiceCallback aCallback, - void * aContext, + void *aContext, const otDnsQueryConfig *aConfig) { AssertPointerIsNotNull(aInstanceLabel); @@ -195,9 +195,9 @@ otError otDnsClientResolveService(otInstance * aInstance, } otError otDnsServiceResponseGetServiceName(const otDnsServiceResponse *aResponse, - char * aLabelBuffer, + char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) { AssertPointerIsNotNull(aLabelBuffer); @@ -212,10 +212,10 @@ otError otDnsServiceResponseGetServiceInfo(const otDnsServiceResponse *aResponse } otError otDnsServiceResponseGetHostAddress(const otDnsServiceResponse *aResponse, - const char * aHostName, + const char *aHostName, uint16_t aIndex, - otIp6Address * aAddress, - uint32_t * aTtl) + otIp6Address *aAddress, + uint32_t *aTtl) { uint32_t ttl; diff --git a/src/core/api/dns_server_api.cpp b/src/core/api/dns_server_api.cpp index 83220c181..7793e9187 100644 --- a/src/core/api/dns_server_api.cpp +++ b/src/core/api/dns_server_api.cpp @@ -41,16 +41,16 @@ using namespace ot; #if OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE -void otDnssdQuerySetCallbacks(otInstance * aInstance, +void otDnssdQuerySetCallbacks(otInstance *aInstance, otDnssdQuerySubscribeCallback aSubscribe, otDnssdQueryUnsubscribeCallback aUnsubscribe, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetQueryCallbacks(aSubscribe, aUnsubscribe, aContext); } -void otDnssdQueryHandleDiscoveredServiceInstance(otInstance * aInstance, - const char * aServiceFullName, +void otDnssdQueryHandleDiscoveredServiceInstance(otInstance *aInstance, + const char *aServiceFullName, otDnssdServiceInstanceInfo *aInstanceInfo) { AssertPointerIsNotNull(aServiceFullName); diff --git a/src/core/api/history_tracker_api.cpp b/src/core/api/history_tracker_api.cpp index 4dd56a4c5..5180ee0bc 100644 --- a/src/core/api/history_tracker_api.cpp +++ b/src/core/api/history_tracker_api.cpp @@ -48,9 +48,9 @@ void otHistoryTrackerInitIterator(otHistoryTrackerIterator *aIterator) AsCoreType(aIterator).Init(); } -const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInstance * aInstance, +const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); @@ -58,9 +58,9 @@ const otHistoryTrackerNetworkInfo *otHistoryTrackerIterateNetInfoHistory(otInsta } const otHistoryTrackerUnicastAddressInfo *otHistoryTrackerIterateUnicastAddressHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); @@ -69,9 +69,9 @@ const otHistoryTrackerUnicastAddressInfo *otHistoryTrackerIterateUnicastAddressH } const otHistoryTrackerMulticastAddressInfo *otHistoryTrackerIterateMulticastAddressHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); @@ -79,36 +79,36 @@ const otHistoryTrackerMulticastAddressInfo *otHistoryTrackerIterateMulticastAddr *aEntryAge); } -const otHistoryTrackerMessageInfo *otHistoryTrackerIterateRxHistory(otInstance * aInstance, +const otHistoryTrackerMessageInfo *otHistoryTrackerIterateRxHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); return AsCoreType(aInstance).Get().IterateRxHistory(AsCoreType(aIterator), *aEntryAge); } -const otHistoryTrackerMessageInfo *otHistoryTrackerIterateTxHistory(otInstance * aInstance, +const otHistoryTrackerMessageInfo *otHistoryTrackerIterateTxHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); return AsCoreType(aInstance).Get().IterateTxHistory(AsCoreType(aIterator), *aEntryAge); } -const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otInstance * aInstance, +const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); return AsCoreType(aInstance).Get().IterateNeighborHistory(AsCoreType(aIterator), *aEntryAge); } -const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance * aInstance, +const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); @@ -117,9 +117,9 @@ const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHisto } const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHistory( - otInstance * aInstance, + otInstance *aInstance, otHistoryTrackerIterator *aIterator, - uint32_t * aEntryAge) + uint32_t *aEntryAge) { AssertPointerIsNotNull(aEntryAge); diff --git a/src/core/api/icmp6_api.cpp b/src/core/api/icmp6_api.cpp index 55ed19281..c9df55d64 100644 --- a/src/core/api/icmp6_api.cpp +++ b/src/core/api/icmp6_api.cpp @@ -55,8 +55,8 @@ otError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandler) return AsCoreType(aInstance).Get().RegisterHandler(AsCoreType(aHandler)); } -otError otIcmp6SendEchoRequest(otInstance * aInstance, - otMessage * aMessage, +otError otIcmp6SendEchoRequest(otInstance *aInstance, + otMessage *aMessage, const otMessageInfo *aMessageInfo, uint16_t aIdentifier) { diff --git a/src/core/api/ip6_api.cpp b/src/core/api/ip6_api.cpp index 7990a596b..d17a5a0d0 100644 --- a/src/core/api/ip6_api.cpp +++ b/src/core/api/ip6_api.cpp @@ -144,8 +144,8 @@ otMessage *otIp6NewMessage(otInstance *aInstance, const otMessageSettings *aSett return AsCoreType(aInstance).Get().NewMessage(0, Message::Settings::From(aSettings)); } -otMessage *otIp6NewMessageFromBuffer(otInstance * aInstance, - const uint8_t * aData, +otMessage *otIp6NewMessageFromBuffer(otInstance *aInstance, + const uint8_t *aData, uint16_t aDataLength, const otMessageSettings *aSettings) { @@ -241,12 +241,12 @@ exit: } #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE -otError otIp6RegisterMulticastListeners(otInstance * aInstance, - const otIp6Address * aAddresses, +otError otIp6RegisterMulticastListeners(otInstance *aInstance, + const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, otIp6RegisterMulticastListenersCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().RegisterMulticastListeners(aAddresses, aAddressNum, aTimeout, aCallback, aContext); diff --git a/src/core/api/joiner_api.cpp b/src/core/api/joiner_api.cpp index 2ee2ac3a4..2be6d4bd7 100644 --- a/src/core/api/joiner_api.cpp +++ b/src/core/api/joiner_api.cpp @@ -43,15 +43,15 @@ using namespace ot; -otError otJoinerStart(otInstance * aInstance, - const char * aPskd, - const char * aProvisioningUrl, - const char * aVendorName, - const char * aVendorModel, - const char * aVendorSwVersion, - const char * aVendorData, +otError otJoinerStart(otInstance *aInstance, + const char *aPskd, + const char *aProvisioningUrl, + const char *aVendorName, + const char *aVendorModel, + const char *aVendorSwVersion, + const char *aVendorData, otJoinerCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().Start(aPskd, aProvisioningUrl, aVendorName, aVendorModel, aVendorSwVersion, aVendorData, aCallback, aContext); diff --git a/src/core/api/link_api.cpp b/src/core/api/link_api.cpp index 09d6f54f6..292da0b17 100644 --- a/src/core/api/link_api.cpp +++ b/src/core/api/link_api.cpp @@ -367,11 +367,11 @@ void otLinkResetCounters(otInstance *aInstance) AsCoreType(aInstance).Get().ResetCounters(); } -otError otLinkActiveScan(otInstance * aInstance, +otError otLinkActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback, - void * aCallbackContext) + void *aCallbackContext) { return AsCoreType(aInstance).Get().ActiveScan(aScanChannels, aScanDuration, aCallback, aCallbackContext); } @@ -381,11 +381,11 @@ bool otLinkIsActiveScanInProgress(otInstance *aInstance) return AsCoreType(aInstance).Get().IsActiveScanInProgress(); } -otError otLinkEnergyScan(otInstance * aInstance, +otError otLinkEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration, otHandleEnergyScanResult aCallback, - void * aCallbackContext) + void *aCallbackContext) { return AsCoreType(aInstance).Get().EnergyScan(aScanChannels, aScanDuration, aCallback, aCallbackContext); } diff --git a/src/core/api/link_metrics_api.cpp b/src/core/api/link_metrics_api.cpp index 5e43c8865..026eed3ed 100644 --- a/src/core/api/link_metrics_api.cpp +++ b/src/core/api/link_metrics_api.cpp @@ -42,12 +42,12 @@ using namespace ot; -otError otLinkMetricsQuery(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsQuery(otInstance *aInstance, + const otIp6Address *aDestination, uint8_t aSeriesId, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsReportCallback aCallback, - void * aCallbackContext) + void *aCallbackContext) { AsCoreType(aInstance).Get().SetReportCallback(aCallback, aCallbackContext); @@ -55,13 +55,13 @@ otError otLinkMetricsQuery(otInstance * aInstance, AsCoreTypePtr(aLinkMetricsFlags)); } -otError otLinkMetricsConfigForwardTrackingSeries(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsConfigForwardTrackingSeries(otInstance *aInstance, + const otIp6Address *aDestination, uint8_t aSeriesId, const otLinkMetricsSeriesFlags aSeriesFlags, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsMgmtResponseCallback aCallback, - void * aCallbackContext) + void *aCallbackContext) { LinkMetrics::LinkMetrics &linkMetrics = AsCoreType(aInstance).Get(); @@ -72,14 +72,14 @@ otError otLinkMetricsConfigForwardTrackingSeries(otInstance * } #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE -otError otLinkMetricsConfigEnhAckProbing(otInstance * aInstance, - const otIp6Address * aDestination, +otError otLinkMetricsConfigEnhAckProbing(otInstance *aInstance, + const otIp6Address *aDestination, otLinkMetricsEnhAckFlags aEnhAckFlags, - const otLinkMetrics * aLinkMetricsFlags, + const otLinkMetrics *aLinkMetricsFlags, otLinkMetricsMgmtResponseCallback aCallback, - void * aCallbackContext, + void *aCallbackContext, otLinkMetricsEnhAckProbingIeReportCallback aEnhAckCallback, - void * aEnhAckCallbackContext) + void *aEnhAckCallbackContext) { LinkMetrics::LinkMetrics &linkMetrics = AsCoreType(aInstance).Get(); @@ -90,7 +90,7 @@ otError otLinkMetricsConfigEnhAckProbing(otInstance * AsCoreTypePtr(aLinkMetricsFlags)); } -otError otLinkMetricsSendLinkProbe(otInstance * aInstance, +otError otLinkMetricsSendLinkProbe(otInstance *aInstance, const otIp6Address *aDestination, uint8_t aSeriesId, uint8_t aLength) diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index e28b4cd49..05dd763c7 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -119,7 +119,7 @@ otRadioCaps otLinkRawGetCaps(otInstance *aInstance) return AsCoreType(aInstance).Get().GetCaps(); } -otError otLinkRawEnergyScan(otInstance * aInstance, +otError otLinkRawEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback) @@ -157,7 +157,7 @@ otError otLinkRawSrcMatchAddExtEntry(otInstance *aInstance, const otExtAddress * { Mac::ExtAddress address; Error error = kErrorNone; - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); AssertPointerIsNotNull(aExtAddress); @@ -186,7 +186,7 @@ otError otLinkRawSrcMatchClearExtEntry(otInstance *aInstance, const otExtAddress { Mac::ExtAddress address; Error error = kErrorNone; - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); AssertPointerIsNotNull(aExtAddress); @@ -225,7 +225,7 @@ exit: return error; } -otError otLinkRawSetMacKey(otInstance * aInstance, +otError otLinkRawSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKey *aPrevKey, diff --git a/src/core/api/multi_radio_api.cpp b/src/core/api/multi_radio_api.cpp index 10bd547c4..830456a6d 100644 --- a/src/core/api/multi_radio_api.cpp +++ b/src/core/api/multi_radio_api.cpp @@ -44,8 +44,8 @@ using namespace ot; -otError otMultiRadioGetNeighborInfo(otInstance * aInstance, - const otExtAddress * aExtAddress, +otError otMultiRadioGetNeighborInfo(otInstance *aInstance, + const otExtAddress *aExtAddress, otMultiRadioNeighborInfo *aNeighborInfo) { Error error = kErrorNone; diff --git a/src/core/api/nat64_api.cpp b/src/core/api/nat64_api.cpp index 971b13be3..e296a47d8 100644 --- a/src/core/api/nat64_api.cpp +++ b/src/core/api/nat64_api.cpp @@ -80,9 +80,9 @@ void otNat64InitAddressMappingIterator(otInstance *aInstance, otNat64AddressMapp AsCoreType(aInstance).Get().InitAddressMappingIterator(*aIterator); } -otError otNat64GetNextAddressMapping(otInstance * aInstance, +otError otNat64GetNextAddressMapping(otInstance *aInstance, otNat64AddressMappingIterator *aIterator, - otNat64AddressMapping * aMapping) + otNat64AddressMapping *aMapping) { AssertPointerIsNotNull(aIterator); AssertPointerIsNotNull(aMapping); diff --git a/src/core/api/netdata_api.cpp b/src/core/api/netdata_api.cpp index fa0eabcb1..39259f6eb 100644 --- a/src/core/api/netdata_api.cpp +++ b/src/core/api/netdata_api.cpp @@ -49,9 +49,9 @@ otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_ aStable ? NetworkData::kStableSubset : NetworkData::kFullSet, aData, *aDataLength); } -otError otNetDataGetNextOnMeshPrefix(otInstance * aInstance, +otError otNetDataGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterator *aIterator, - otBorderRouterConfig * aConfig) + otBorderRouterConfig *aConfig) { AssertPointerIsNotNull(aIterator); diff --git a/src/core/api/netdata_publisher_api.cpp b/src/core/api/netdata_publisher_api.cpp index 035243390..62b48f5d1 100644 --- a/src/core/api/netdata_publisher_api.cpp +++ b/src/core/api/netdata_publisher_api.cpp @@ -64,9 +64,9 @@ bool otNetDataIsDnsSrpServiceAdded(otInstance *aInstance) return AsCoreType(aInstance).Get().IsDnsSrpServiceAdded(); } -void otNetDataSetDnsSrpServicePublisherCallback(otInstance * aInstance, +void otNetDataSetDnsSrpServicePublisherCallback(otInstance *aInstance, otNetDataDnsSrpServicePublisherCallback aCallback, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetDnsSrpServiceCallback(aCallback, aContext); } @@ -97,9 +97,9 @@ bool otNetDataIsPrefixAdded(otInstance *aInstance, const otIp6Prefix *aPrefix) return AsCoreType(aInstance).Get().IsPrefixAdded(AsCoreType(aPrefix)); } -void otNetDataSetPrefixPublisherCallback(otInstance * aInstance, +void otNetDataSetPrefixPublisherCallback(otInstance *aInstance, otNetDataPrefixPublisherCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().SetPrefixCallback(aCallback, aContext); } diff --git a/src/core/api/netdiag_api.cpp b/src/core/api/netdiag_api.cpp index dddbec47b..b6f2d6072 100644 --- a/src/core/api/netdiag_api.cpp +++ b/src/core/api/netdiag_api.cpp @@ -42,9 +42,9 @@ using namespace ot; -otError otThreadGetNextDiagnosticTlv(const otMessage * aMessage, +otError otThreadGetNextDiagnosticTlv(const otMessage *aMessage, otNetworkDiagIterator *aIterator, - otNetworkDiagTlv * aNetworkDiagTlv) + otNetworkDiagTlv *aNetworkDiagTlv) { AssertPointerIsNotNull(aIterator); AssertPointerIsNotNull(aNetworkDiagTlv); @@ -52,18 +52,18 @@ otError otThreadGetNextDiagnosticTlv(const otMessage * aMessage, return NetworkDiagnostic::NetworkDiagnostic::GetNextDiagTlv(AsCoapMessage(aMessage), *aIterator, *aNetworkDiagTlv); } -otError otThreadSendDiagnosticGet(otInstance * aInstance, - const otIp6Address * aDestination, +otError otThreadSendDiagnosticGet(otInstance *aInstance, + const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount, otReceiveDiagnosticGetCallback aCallback, - void * aCallbackContext) + void *aCallbackContext) { return AsCoreType(aInstance).Get().SendDiagnosticGet( AsCoreType(aDestination), aTlvTypes, aCount, aCallback, aCallbackContext); } -otError otThreadSendDiagnosticReset(otInstance * aInstance, +otError otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount) diff --git a/src/core/api/server_api.cpp b/src/core/api/server_api.cpp index b1712f103..9c44ab889 100644 --- a/src/core/api/server_api.cpp +++ b/src/core/api/server_api.cpp @@ -60,7 +60,7 @@ otError otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig aConfig->mServerConfig.mStable, serverData); } -otError otServerRemoveService(otInstance * aInstance, +otError otServerRemoveService(otInstance *aInstance, uint32_t aEnterpriseNumber, const uint8_t *aServiceData, uint8_t aServiceDataLength) diff --git a/src/core/api/sntp_api.cpp b/src/core/api/sntp_api.cpp index 007fc9294..1651c3b0e 100644 --- a/src/core/api/sntp_api.cpp +++ b/src/core/api/sntp_api.cpp @@ -42,10 +42,10 @@ using namespace ot; -otError otSntpClientQuery(otInstance * aInstance, - const otSntpQuery * aQuery, +otError otSntpClientQuery(otInstance *aInstance, + const otSntpQuery *aQuery, otSntpResponseHandler aHandler, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().Query(aQuery, aHandler, aContext); } diff --git a/src/core/api/srp_server_api.cpp b/src/core/api/srp_server_api.cpp index 488164a25..298dcedce 100644 --- a/src/core/api/srp_server_api.cpp +++ b/src/core/api/srp_server_api.cpp @@ -119,9 +119,9 @@ otError otSrpServerSetLeaseConfig(otInstance *aInstance, const otSrpServerLeaseC return AsCoreType(aInstance).Get().SetLeaseConfig(AsCoreType(aLeaseConfig)); } -void otSrpServerSetServiceUpdateHandler(otInstance * aInstance, +void otSrpServerSetServiceUpdateHandler(otInstance *aInstance, otSrpServerServiceUpdateHandler aServiceHandler, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetServiceHandler(aServiceHandler, aContext); } @@ -166,17 +166,17 @@ uint32_t otSrpServerHostGetKeyLease(const otSrpServerHost *aHost) return AsCoreType(aHost).GetKeyLease(); } -const otSrpServerService *otSrpServerHostGetNextService(const otSrpServerHost * aHost, +const otSrpServerService *otSrpServerHostGetNextService(const otSrpServerHost *aHost, const otSrpServerService *aService) { return AsCoreType(aHost).FindNextService(AsCoreTypePtr(aService), Srp::Server::kFlagsBaseTypeServiceOnly); } -const otSrpServerService *otSrpServerHostFindNextService(const otSrpServerHost * aHost, +const otSrpServerService *otSrpServerHostFindNextService(const otSrpServerHost *aHost, const otSrpServerService *aPrevService, otSrpServerServiceFlags aFlags, - const char * aServiceName, - const char * aInstanceName) + const char *aServiceName, + const char *aInstanceName) { return AsCoreType(aHost).FindNextService(AsCoreTypePtr(aPrevService), aFlags, aServiceName, aInstanceName); } diff --git a/src/core/api/tcp_api.cpp b/src/core/api/tcp_api.cpp index 896aac6a3..fe3c9e083 100644 --- a/src/core/api/tcp_api.cpp +++ b/src/core/api/tcp_api.cpp @@ -42,8 +42,8 @@ using namespace ot; -otError otTcpEndpointInitialize(otInstance * aInstance, - otTcpEndpoint * aEndpoint, +otError otTcpEndpointInitialize(otInstance *aInstance, + otTcpEndpoint *aEndpoint, const otTcpEndpointInitializeArgs *aArgs) { return AsCoreType(aEndpoint).Initialize(AsCoreType(aInstance), *aArgs); @@ -119,8 +119,8 @@ otError otTcpEndpointDeinitialize(otTcpEndpoint *aEndpoint) return AsCoreType(aEndpoint).Deinitialize(); } -otError otTcpListenerInitialize(otInstance * aInstance, - otTcpListener * aListener, +otError otTcpListenerInitialize(otInstance *aInstance, + otTcpListener *aListener, const otTcpListenerInitializeArgs *aArgs) { return AsCoreType(aListener).Initialize(AsCoreType(aInstance), *aArgs); diff --git a/src/core/api/tcp_ext_api.cpp b/src/core/api/tcp_ext_api.cpp index 2e98b7f39..ce69183fb 100644 --- a/src/core/api/tcp_ext_api.cpp +++ b/src/core/api/tcp_ext_api.cpp @@ -48,11 +48,11 @@ void otTcpCircularSendBufferInitialize(otTcpCircularSendBuffer *aSendBuffer, voi AsCoreType(aSendBuffer).Initialize(aDataBuffer, aCapacity); } -otError otTcpCircularSendBufferWrite(otTcpEndpoint * aEndpoint, +otError otTcpCircularSendBufferWrite(otTcpEndpoint *aEndpoint, otTcpCircularSendBuffer *aSendBuffer, - const void * aData, + const void *aData, size_t aLength, - size_t * aWritten, + size_t *aWritten, uint32_t aFlags) { AssertPointerIsNotNull(aWritten); diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index d31a205db..2af73c7ab 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -62,7 +62,7 @@ const otExtendedPanId *otThreadGetExtendedPanId(otInstance *aInstance) otError otThreadSetExtendedPanId(otInstance *aInstance, const otExtendedPanId *aExtendedPanId) { Error error = kErrorNone; - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); const MeshCoP::ExtendedPanId &extPanId = AsCoreType(aExtendedPanId); VerifyOrExit(instance.Get().IsDisabled(), error = kErrorInvalidState); @@ -253,7 +253,7 @@ otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance) { - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); const otIp6InterfaceIdentifier *iid = nullptr; if (instance.Get().IsFixedDuaInterfaceIdentifierSet()) @@ -411,20 +411,20 @@ bool otThreadIsSingleton(otInstance *aInstance) return AsCoreType(aInstance).Get().IsSingleton(); } -otError otThreadDiscover(otInstance * aInstance, +otError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, - void * aCallbackContext) + void *aCallbackContext) { return AsCoreType(aInstance).Get().Discover( Mac::ChannelMask(aScanChannels), aPanId, aJoiner, aEnableEui64Filtering, /* aFilterIndexes (use hash of factory EUI64) */ nullptr, aCallback, aCallbackContext); } -otError otThreadSetJoinerAdvertisement(otInstance * aInstance, +otError otThreadSetJoinerAdvertisement(otInstance *aInstance, uint32_t aOui, const uint8_t *aAdvData, uint8_t aAdvDataLength) @@ -457,18 +457,18 @@ void otThreadResetMleCounters(otInstance *aInstance) AsCoreType(aInstance).Get().ResetCounters(); } -void otThreadRegisterParentResponseCallback(otInstance * aInstance, +void otThreadRegisterParentResponseCallback(otInstance *aInstance, otThreadParentResponseCallback aCallback, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().RegisterParentResponseStatsCallback(aCallback, aContext); } #if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE -otError otThreadLocateAnycastDestination(otInstance * aInstance, - const otIp6Address * aAnycastAddress, +otError otThreadLocateAnycastDestination(otInstance *aInstance, + const otIp6Address *aAnycastAddress, otThreadAnycastLocatorCallback aCallback, - void * aContext) + void *aContext) { return AsCoreType(aInstance).Get().Locate(AsCoreType(aAnycastAddress), aCallback, aContext); } diff --git a/src/core/api/thread_ftd_api.cpp b/src/core/api/thread_ftd_api.cpp index b2eda1565..6e2b2cb7b 100644 --- a/src/core/api/thread_ftd_api.cpp +++ b/src/core/api/thread_ftd_api.cpp @@ -213,10 +213,10 @@ otError otThreadGetChildInfoByIndex(otInstance *aInstance, uint16_t aChildIndex, return AsCoreType(aInstance).Get().GetChildInfoByIndex(aChildIndex, AsCoreType(aChildInfo)); } -otError otThreadGetChildNextIp6Address(otInstance * aInstance, +otError otThreadGetChildNextIp6Address(otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, - otIp6Address * aAddress) + otIp6Address *aAddress) { Error error = kErrorNone; const Child *child; @@ -330,17 +330,17 @@ void otThreadRegisterNeighborTableCallback(otInstance *aInstance, otNeighborTabl AsCoreType(aInstance).Get().RegisterCallback(aCallback); } -void otThreadSetDiscoveryRequestCallback(otInstance * aInstance, +void otThreadSetDiscoveryRequestCallback(otInstance *aInstance, otThreadDiscoveryRequestCallback aCallback, - void * aContext) + void *aContext) { AsCoreType(aInstance).Get().SetDiscoveryRequestCallback(aCallback, aContext); } #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE -void otThreadSendAddressNotification(otInstance * aInstance, - otIp6Address * aDestination, - otIp6Address * aTarget, +void otThreadSendAddressNotification(otInstance *aInstance, + otIp6Address *aDestination, + otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid) { AsCoreType(aInstance).Get().SendAddressQueryResponse(AsCoreType(aTarget), AsCoreType(aMlIid), @@ -348,8 +348,8 @@ void otThreadSendAddressNotification(otInstance * aInstance, } #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE -otError otThreadSendProactiveBackboneNotification(otInstance * aInstance, - otIp6Address * aTarget, +otError otThreadSendProactiveBackboneNotification(otInstance *aInstance, + otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid, uint32_t aTimeSinceLastTransaction) { diff --git a/src/core/api/udp_api.cpp b/src/core/api/udp_api.cpp index 505458aa2..2ecf07155 100644 --- a/src/core/api/udp_api.cpp +++ b/src/core/api/udp_api.cpp @@ -87,8 +87,8 @@ void otUdpForwardSetForwarder(otInstance *aInstance, otUdpForwarder aForwarder, AsCoreType(aInstance).Get().SetUdpForwarder(aForwarder, aContext); } -void otUdpForwardReceive(otInstance * aInstance, - otMessage * aMessage, +void otUdpForwardReceive(otInstance *aInstance, + otMessage *aMessage, uint16_t aPeerPort, const otIp6Address *aPeerAddr, uint16_t aSockPort) diff --git a/src/core/backbone_router/backbone_tmf.cpp b/src/core/backbone_router/backbone_tmf.cpp index 58e776aff..1fe7ee55f 100644 --- a/src/core/backbone_router/backbone_tmf.cpp +++ b/src/core/backbone_router/backbone_tmf.cpp @@ -61,16 +61,16 @@ exit: return error; } -bool BackboneTmfAgent::HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - ot::Coap::Message & aMessage, +bool BackboneTmfAgent::HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + ot::Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { return static_cast(aCoapBase).HandleResource(aUriPath, aMessage, aMessageInfo); } -bool BackboneTmfAgent::HandleResource(const char * aUriPath, - ot::Coap::Message & aMessage, +bool BackboneTmfAgent::HandleResource(const char *aUriPath, + ot::Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { OT_UNUSED_VARIABLE(aMessage); diff --git a/src/core/backbone_router/backbone_tmf.hpp b/src/core/backbone_router/backbone_tmf.hpp index 9cf6993ed..73b92ad1b 100644 --- a/src/core/backbone_router/backbone_tmf.hpp +++ b/src/core/backbone_router/backbone_tmf.hpp @@ -96,9 +96,9 @@ public: void UnsubscribeMulticast(const Ip6::Address &aAddress); private: - static bool HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - ot::Coap::Message & aMessage, + static bool HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + ot::Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); bool HandleResource(const char *aUriPath, ot::Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); void LogError(const char *aText, const Ip6::Address &aAddress, Error aError) const; diff --git a/src/core/backbone_router/bbr_leader.hpp b/src/core/backbone_router/bbr_leader.hpp index 6266d026e..beb541294 100644 --- a/src/core/backbone_router/bbr_leader.hpp +++ b/src/core/backbone_router/bbr_leader.hpp @@ -182,8 +182,12 @@ private: static const char *StateToString(State aState); static const char *DomainPrefixStateToString(DomainPrefixState aState); #else - void LogBackboneRouterPrimary(State, const BackboneRouterConfig &) const {} - void LogDomainPrefix(DomainPrefixState, const Ip6::Prefix &) const {} + void LogBackboneRouterPrimary(State, const BackboneRouterConfig &) const + { + } + void LogDomainPrefix(DomainPrefixState, const Ip6::Prefix &) const + { + } #endif BackboneRouterConfig mConfig; ///< Primary Backbone Router information. diff --git a/src/core/backbone_router/bbr_local.hpp b/src/core/backbone_router/bbr_local.hpp index b7a76f366..4aa8978d0 100644 --- a/src/core/backbone_router/bbr_local.hpp +++ b/src/core/backbone_router/bbr_local.hpp @@ -265,8 +265,12 @@ private: void LogBackboneRouterService(const char *aAction, Error aError); void LogDomainPrefix(const char *aAction, Error aError); #else - void LogBackboneRouterService(const char *, Error) {} - void LogDomainPrefix(const char *, Error) {} + void LogBackboneRouterService(const char *, Error) + { + } + void LogDomainPrefix(const char *, Error) + { + } #endif BackboneRouterState mState; @@ -286,7 +290,7 @@ private: Ip6::Address mAllNetworkBackboneRouters; Ip6::Address mAllDomainBackboneRouters; otBackboneRouterDomainPrefixCallback mDomainPrefixCallback; - void * mDomainPrefixCallbackContext; + void *mDomainPrefixCallbackContext; }; } // namespace BackboneRouter diff --git a/src/core/backbone_router/bbr_manager.cpp b/src/core/backbone_router/bbr_manager.cpp index aff5b4338..4974e1899 100644 --- a/src/core/backbone_router/bbr_manager.cpp +++ b/src/core/backbone_router/bbr_manager.cpp @@ -281,10 +281,10 @@ exit: } } -void Manager::SendMulticastListenerRegistrationResponse(const Coap::Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +void Manager::SendMulticastListenerRegistrationResponse(const Coap::Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, ThreadStatusTlv::MlrStatus aStatus, - Ip6::Address * aFailedAddresses, + Ip6::Address *aFailedAddresses, uint8_t aFailedAddressNum) { Error error = kErrorNone; @@ -321,7 +321,7 @@ void Manager::SendBackboneMulticastListenerRegistration(const Ip6::Address *aAdd uint32_t aTimeout) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Ip6::MessageInfo messageInfo; Ip6AddressesTlv addressesTlv; BackboneTmfAgent &backboneTmf = Get(); @@ -441,9 +441,9 @@ exit: } } -void Manager::SendDuaRegistrationResponse(const Coap::Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, - const Ip6::Address & aTarget, +void Manager::SendDuaRegistrationResponse(const Coap::Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, + const Ip6::Address &aTarget, ThreadStatusTlv::DuaStatus aStatus) { Error error = kErrorNone; @@ -520,7 +520,7 @@ exit: Error Manager::SendBackboneQuery(const Ip6::Address &aDua, uint16_t aRloc16) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Ip6::MessageInfo messageInfo; VerifyOrExit(Get().IsPrimary(), error = kErrorInvalidState); @@ -624,7 +624,7 @@ exit: LogInfo("HandleBackboneAnswer: %s", ErrorToString(error)); } -Error Manager::SendProactiveBackboneNotification(const Ip6::Address & aDua, +Error Manager::SendProactiveBackboneNotification(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction) { @@ -632,8 +632,8 @@ Error Manager::SendProactiveBackboneNotification(const Ip6::Address & aTimeSinceLastTransaction, Mac::kShortAddrInvalid); } -Error Manager::SendBackboneAnswer(const Ip6::MessageInfo & aQueryMessageInfo, - const Ip6::Address & aDua, +Error Manager::SendBackboneAnswer(const Ip6::MessageInfo &aQueryMessageInfo, + const Ip6::Address &aDua, uint16_t aSrcRloc16, const NdProxyTable::NdProxy &aNdProxy) { @@ -641,14 +641,14 @@ Error Manager::SendBackboneAnswer(const Ip6::MessageInfo & aQueryMessageInfo aNdProxy.GetTimeSinceLastTransaction(), aSrcRloc16); } -Error Manager::SendBackboneAnswer(const Ip6::Address & aDstAddr, - const Ip6::Address & aDua, +Error Manager::SendBackboneAnswer(const Ip6::Address &aDstAddr, + const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction, uint16_t aSrcRloc16) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Ip6::MessageInfo messageInfo; bool proactive = aDstAddr.IsMulticast(); @@ -715,7 +715,7 @@ exit: aDua.ToString().AsCString(), aMeshLocalIid.ToString().AsCString(), duplicate ? "Y" : "N"); } -void Manager::HandleExtendedBackboneAnswer(const Ip6::Address & aDua, +void Manager::HandleExtendedBackboneAnswer(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction, uint16_t aSrcRloc16) @@ -729,7 +729,7 @@ void Manager::HandleExtendedBackboneAnswer(const Ip6::Address & aDua, aMeshLocalIid.ToString().AsCString(), ToUlong(aTimeSinceLastTransaction), aSrcRloc16); } -void Manager::HandleProactiveBackboneNotification(const Ip6::Address & aDua, +void Manager::HandleProactiveBackboneNotification(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction) { diff --git a/src/core/backbone_router/bbr_manager.hpp b/src/core/backbone_router/bbr_manager.hpp index 68a817e62..2293c8944 100644 --- a/src/core/backbone_router/bbr_manager.hpp +++ b/src/core/backbone_router/bbr_manager.hpp @@ -119,7 +119,10 @@ public: * @returns The Multicast Listeners Table. * */ - MulticastListenersTable &GetMulticastListenersTable(void) { return mMulticastListenersTable; } + MulticastListenersTable &GetMulticastListenersTable(void) + { + return mMulticastListenersTable; + } #endif /** @@ -140,7 +143,10 @@ public: * @returns A reference to the Backbone TMF agent. * */ - BackboneTmfAgent &GetBackboneTmfAgent(void) { return mBackboneTmfAgent; } + BackboneTmfAgent &GetBackboneTmfAgent(void) + { + return mBackboneTmfAgent; + } /** * This method sends BB.qry on the Backbone link. @@ -167,7 +173,7 @@ public: * @retval kErrorNoBufs If insufficient message buffers available. * */ - Error SendProactiveBackboneNotification(const Ip6::Address & aDua, + Error SendProactiveBackboneNotification(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction); @@ -179,10 +185,10 @@ private: #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE void HandleMulticastListenerRegistration(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - void SendMulticastListenerRegistrationResponse(const Coap::Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + void SendMulticastListenerRegistrationResponse(const Coap::Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, ThreadStatusTlv::MlrStatus aStatus, - Ip6::Address * aFailedAddresses, + Ip6::Address *aFailedAddresses, uint8_t aFailedAddressNum); void SendBackboneMulticastListenerRegistration(const Ip6::Address *aAddresses, uint8_t aAddressNum, @@ -191,26 +197,26 @@ private: #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE void HandleDuaRegistration(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - Error SendBackboneAnswer(const Ip6::MessageInfo & aQueryMessageInfo, - const Ip6::Address & aDua, + Error SendBackboneAnswer(const Ip6::MessageInfo &aQueryMessageInfo, + const Ip6::Address &aDua, uint16_t aSrcRloc16, const NdProxyTable::NdProxy &aNdProxy); - Error SendBackboneAnswer(const Ip6::Address & aDstAddr, - const Ip6::Address & aDua, + Error SendBackboneAnswer(const Ip6::Address &aDstAddr, + const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction, uint16_t aSrcRloc16); void HandleDadBackboneAnswer(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid); - void HandleExtendedBackboneAnswer(const Ip6::Address & aDua, + void HandleExtendedBackboneAnswer(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction, uint16_t aSrcRloc16); - void HandleProactiveBackboneNotification(const Ip6::Address & aDua, + void HandleProactiveBackboneNotification(const Ip6::Address &aDua, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint32_t aTimeSinceLastTransaction); - void SendDuaRegistrationResponse(const Coap::Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, - const Ip6::Address & aTarget, + void SendDuaRegistrationResponse(const Coap::Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, + const Ip6::Address &aTarget, ThreadStatusTlv::DuaStatus aStatus); #endif void HandleNotifierEvents(Events aEvents); diff --git a/src/core/backbone_router/multicast_listeners_table.cpp b/src/core/backbone_router/multicast_listeners_table.cpp index d96aed8e6..fef7485d6 100644 --- a/src/core/backbone_router/multicast_listeners_table.cpp +++ b/src/core/backbone_router/multicast_listeners_table.cpp @@ -147,7 +147,7 @@ void MulticastListenersTable::Expire(void) CheckInvariants(); } -void MulticastListenersTable::LogMulticastListenersTable(const char * aAction, +void MulticastListenersTable::LogMulticastListenersTable(const char *aAction, const Ip6::Address &aAddress, TimeMilli aExpireTime, Error aError) @@ -291,7 +291,7 @@ void MulticastListenersTable::SetCallback(otBackboneRouterMulticastListenerCallb } Error MulticastListenersTable::GetNext(otBackboneRouterMulticastListenerIterator &aIterator, - otBackboneRouterMulticastListenerInfo & aListenerInfo) + otBackboneRouterMulticastListenerInfo &aListenerInfo) { Error error = kErrorNone; TimeMilli now; diff --git a/src/core/backbone_router/multicast_listeners_table.hpp b/src/core/backbone_router/multicast_listeners_table.hpp index b7ae80cd0..b6a3684f1 100644 --- a/src/core/backbone_router/multicast_listeners_table.hpp +++ b/src/core/backbone_router/multicast_listeners_table.hpp @@ -186,7 +186,7 @@ public: * */ Error GetNext(otBackboneRouterMulticastListenerIterator &aIterator, - otBackboneRouterMulticastListenerInfo & aListenerInfo); + otBackboneRouterMulticastListenerInfo &aListenerInfo); private: static constexpr uint16_t kMulticastListenersTableSize = OPENTHREAD_CONFIG_MAX_MULTICAST_LISTENERS; @@ -207,7 +207,7 @@ private: Listener *end(void); }; - void LogMulticastListenersTable(const char * aAction, + void LogMulticastListenersTable(const char *aAction, const Ip6::Address &aAddress, TimeMilli aExpireTime, Error aError); @@ -221,7 +221,7 @@ private: uint16_t mNumValidListeners; otBackboneRouterMulticastListenerCallback mCallback; - void * mCallbackContext; + void *mCallbackContext; }; } // namespace BackboneRouter diff --git a/src/core/backbone_router/ndproxy_table.cpp b/src/core/backbone_router/ndproxy_table.cpp index c0410338e..5226ab985 100644 --- a/src/core/backbone_router/ndproxy_table.cpp +++ b/src/core/backbone_router/ndproxy_table.cpp @@ -155,7 +155,7 @@ void NdProxyTable::Clear(void) Error NdProxyTable::Register(const Ip6::InterfaceIdentifier &aAddressIid, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint16_t aRloc16, - const uint32_t * aTimeSinceLastTransaction) + const uint32_t *aTimeSinceLastTransaction) { Error error = kErrorNone; NdProxy *proxy = FindByAddressIid(aAddressIid); diff --git a/src/core/backbone_router/ndproxy_table.hpp b/src/core/backbone_router/ndproxy_table.hpp index f13712b92..05a932d2a 100644 --- a/src/core/backbone_router/ndproxy_table.hpp +++ b/src/core/backbone_router/ndproxy_table.hpp @@ -156,7 +156,7 @@ public: Error Register(const Ip6::InterfaceIdentifier &aAddressIid, const Ip6::InterfaceIdentifier &aMeshLocalIid, uint16_t aRloc16, - const uint32_t * aTimeSinceLastTransaction); + const uint32_t *aTimeSinceLastTransaction); /** * This method checks if a given IPv6 address IID was registered. @@ -285,16 +285,16 @@ private: IteratorBuilder Iterate(Filter aFilter) { return IteratorBuilder(GetInstance(), aFilter); } void Clear(void); static bool MatchesFilter(const NdProxy &aProxy, Filter aFilter); - NdProxy * FindByAddressIid(const Ip6::InterfaceIdentifier &aAddressIid); - NdProxy * FindByMeshLocalIid(const Ip6::InterfaceIdentifier &aMeshLocalIid); - NdProxy * FindInvalid(void); + NdProxy *FindByAddressIid(const Ip6::InterfaceIdentifier &aAddressIid); + NdProxy *FindByMeshLocalIid(const Ip6::InterfaceIdentifier &aMeshLocalIid); + NdProxy *FindInvalid(void); Ip6::Address GetDua(NdProxy &aNdProxy); void NotifyDuaRegistrationOnBackboneLink(NdProxy &aNdProxy, bool aIsRenew); void TriggerCallback(otBackboneRouterNdProxyEvent aEvent, const Ip6::InterfaceIdentifier &aAddressIid) const; NdProxy mProxies[kMaxNdProxyNum]; otBackboneRouterNdProxyCallback mCallback; - void * mCallbackContext; + void *mCallbackContext; bool mIsAnyDadInProcess : 1; }; diff --git a/src/core/border_router/infra_if.cpp b/src/core/border_router/infra_if.cpp index c9e6f24f5..8b1d33adf 100644 --- a/src/core/border_router/infra_if.cpp +++ b/src/core/border_router/infra_if.cpp @@ -167,10 +167,10 @@ InfraIf::InfoString InfraIf::ToString(void) const //--------------------------------------------------------------------------------------------------------------------- -extern "C" void otPlatInfraIfRecvIcmp6Nd(otInstance * aInstance, +extern "C" void otPlatInfraIfRecvIcmp6Nd(otInstance *aInstance, uint32_t aInfraIfIndex, const otIp6Address *aSrcAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength) { InfraIf::Icmp6Packet packet; @@ -184,7 +184,7 @@ extern "C" otError otPlatInfraIfStateChanged(otInstance *aInstance, uint32_t aIn return AsCoreType(aInstance).Get().HandleStateChanged(aInfraIfIndex, aIsRunning); } -extern "C" void otPlatInfraIfDiscoverNat64PrefixDone(otInstance * aInstance, +extern "C" void otPlatInfraIfDiscoverNat64PrefixDone(otInstance *aInstance, uint32_t aInfraIfIndex, const otIp6Prefix *aIp6Prefix) { diff --git a/src/core/border_router/routing_manager.cpp b/src/core/border_router/routing_manager.cpp index da0c808df..61675b7af 100644 --- a/src/core/border_router/routing_manager.cpp +++ b/src/core/border_router/routing_manager.cpp @@ -1166,7 +1166,7 @@ RoutingManager::DiscoveredPrefixTable::DiscoveredPrefixTable(Instance &aInstance } void RoutingManager::DiscoveredPrefixTable::ProcessRouterAdvertMessage(const Ip6::Nd::RouterAdvertMessage &aRaMessage, - const Ip6::Address & aSrcAddress) + const Ip6::Address &aSrcAddress) { // Process a received RA message and update the prefix table. @@ -1220,9 +1220,9 @@ exit: } void RoutingManager::DiscoveredPrefixTable::ProcessDefaultRoute(const Ip6::Nd::RouterAdvertMessage::Header &aRaHeader, - Router & aRouter) + Router &aRouter) { - Entry * entry; + Entry *entry; Ip6::Prefix prefix; prefix.Clear(); @@ -1258,10 +1258,10 @@ exit: } void RoutingManager::DiscoveredPrefixTable::ProcessPrefixInfoOption(const Ip6::Nd::PrefixInfoOption &aPio, - Router & aRouter) + Router &aRouter) { Ip6::Prefix prefix; - Entry * entry; + Entry *entry; VerifyOrExit(aPio.IsValid()); aPio.GetPrefix(prefix); @@ -1305,10 +1305,10 @@ exit: } void RoutingManager::DiscoveredPrefixTable::ProcessRouteInfoOption(const Ip6::Nd::RouteInfoOption &aRio, - Router & aRouter) + Router &aRouter) { Ip6::Prefix prefix; - Entry * entry; + Entry *entry; VerifyOrExit(aRio.IsValid()); aRio.GetPrefix(prefix); @@ -1689,7 +1689,7 @@ void RoutingManager::DiscoveredPrefixTable::SignalTableChanged(void) void RoutingManager::DiscoveredPrefixTable::ProcessNeighborAdvertMessage( const Ip6::Nd::NeighborAdvertMessage &aNaMessage, - const Ip6::Address & aSrcAddress) + const Ip6::Address &aSrcAddress) { Router *router = mRouters.FindMatching(aSrcAddress); @@ -1782,7 +1782,7 @@ void RoutingManager::DiscoveredPrefixTable::InitIterator(PrefixTableIterator &aI } Error RoutingManager::DiscoveredPrefixTable::GetNextEntry(PrefixTableIterator &aIterator, - PrefixTableEntry & aEntry) const + PrefixTableEntry &aEntry) const { Error error = kErrorNone; Iterator &iterator = static_cast(aIterator); @@ -2121,7 +2121,7 @@ void RoutingManager::OnLinkPrefixManager::Init(void) void RoutingManager::OnLinkPrefixManager::GenerateLocalPrefix(void) { const MeshCoP::ExtendedPanId &extPanId = Get().GetExtPanId(); - OldPrefix * entry; + OldPrefix *entry; Ip6::Prefix oldLocalPrefix = mLocalPrefix; // Global ID: 40 most significant bits of Extended PAN ID @@ -2499,7 +2499,7 @@ exit: void RoutingManager::OnLinkPrefixManager::DeprecateOldPrefix(const Ip6::Prefix &aPrefix, TimeMilli aExpireTime) { - OldPrefix * entry = nullptr; + OldPrefix *entry = nullptr; Ip6::Prefix removedPrefix; removedPrefix.Clear(); diff --git a/src/core/border_router/routing_manager.hpp b/src/core/border_router/routing_manager.hpp index 37f5d79dc..0b79a3f45 100644 --- a/src/core/border_router/routing_manager.hpp +++ b/src/core/border_router/routing_manager.hpp @@ -230,7 +230,10 @@ public: * @retval kStateActive The Border router is publishing a NAT64 prefix. * */ - Nat64::State GetNat64PrefixManagerState(void) const { return mNat64PrefixManager.GetState(); } + Nat64::State GetNat64PrefixManagerState(void) const + { + return mNat64PrefixManager.GetState(); + } /** * Enable or disable NAT64 orefix publishing. @@ -272,7 +275,10 @@ public: * @param[in] aPrefix The discovered NAT64 prefix on `InfraIf`. * */ - void HandleDiscoverNat64PrefixDone(const Ip6::Prefix &aPrefix) { mNat64PrefixManager.HandleDiscoverDone(aPrefix); } + void HandleDiscoverNat64PrefixDone(const Ip6::Prefix &aPrefix) + { + mNat64PrefixManager.HandleDiscoverDone(aPrefix); + } #endif // OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE @@ -291,7 +297,10 @@ public: * This method handles infrastructure interface state changes. * */ - void HandleInfraIfStateChanged(void) { EvaluateState(); } + void HandleInfraIfStateChanged(void) + { + EvaluateState(); + } /** * This method checks whether the on-mesh prefix configuration is a valid OMR prefix. @@ -363,7 +372,10 @@ public: * @retval FALSE The RoutingManager is not running. * */ - bool IsRunning(void) const { return mIsRunning; } + bool IsRunning(void) const + { + return mIsRunning; + } private: static constexpr uint8_t kMaxOnMeshPrefixes = OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES; @@ -421,8 +433,14 @@ private: }; void HandleDiscoveredPrefixTableChanged(void); // Declare early so we can use in `mSignalTask` - void HandleDiscoveredPrefixTableEntryTimer(void) { mDiscoveredPrefixTable.HandleEntryTimer(); } - void HandleDiscoveredPrefixTableRouterTimer(void) { mDiscoveredPrefixTable.HandleRouterTimer(); } + void HandleDiscoveredPrefixTableEntryTimer(void) + { + mDiscoveredPrefixTable.HandleEntryTimer(); + } + void HandleDiscoveredPrefixTableRouterTimer(void) + { + mDiscoveredPrefixTable.HandleRouterTimer(); + } class DiscoveredPrefixTable : public InstanceLocator { @@ -448,9 +466,9 @@ private: explicit DiscoveredPrefixTable(Instance &aInstance); void ProcessRouterAdvertMessage(const Ip6::Nd::RouterAdvertMessage &aRaMessage, - const Ip6::Address & aSrcAddress); + const Ip6::Address &aSrcAddress); void ProcessNeighborAdvertMessage(const Ip6::Nd::NeighborAdvertMessage &aNaMessage, - const Ip6::Address & aSrcAddress); + const Ip6::Address &aSrcAddress); void SetAllowDefaultRouteInNetData(bool aAllow); @@ -518,7 +536,7 @@ private: Type GetType(void) const { return mType; } bool IsOnLinkPrefix(void) const { return (mType == kTypeOnLink); } const Ip6::Prefix &GetPrefix(void) const { return mPrefix; } - const TimeMilli & GetLastUpdateTime(void) const { return mLastUpdateTime; } + const TimeMilli &GetLastUpdateTime(void) const { return mLastUpdateTime; } uint32_t GetValidLifetime(void) const { return mValidLifetime; } void ClearValidLifetime(void) { mValidLifetime = 0; } TimeMilli GetExpireTime(void) const; @@ -540,7 +558,7 @@ private: private: static uint32_t CalculateExpireDelay(uint32_t aValidLifetime); - Entry * mNext; + Entry *mNext; Ip6::Prefix mPrefix; Type mType; TimeMilli mLastUpdateTime; @@ -584,7 +602,7 @@ private: public: const Router *GetRouter(void) const { return static_cast(mPtr1); } void SetRouter(const Router *aRouter) { mPtr1 = aRouter; } - const Entry * GetEntry(void) const { return static_cast(mPtr2); } + const Entry *GetEntry(void) const { return static_cast(mPtr2); } void SetEntry(const Entry *aEntry) { mPtr2 = aEntry; } TimeMilli GetInitTime(void) const { return TimeMilli(mData32); } void SetInitTime(void) { mData32 = TimerMilli::GetNow().GetValue(); } @@ -597,7 +615,7 @@ private: void RemovePrefix(const Entry::Matcher &aMatcher); void RemoveOrDeprecateEntriesFromInactiveRouters(void); void RemoveRoutersWithNoEntries(void); - Entry * AllocateEntry(void) { return mEntryPool.Allocate(); } + Entry *AllocateEntry(void) { return mEntryPool.Allocate(); } void FreeEntry(Entry &aEntry) { mEntryPool.Free(aEntry); } void FreeEntries(LinkedList &aEntries); void UpdateNetworkDataOnChangeTo(Entry &aEntry); @@ -656,7 +674,10 @@ private: bool mIsAddedInNetData; }; - void HandleOnLinkPrefixManagerTimer(void) { mOnLinkPrefixManager.HandleTimer(); } + void HandleOnLinkPrefixManagerTimer(void) + { + mOnLinkPrefixManager.HandleTimer(); + } class OnLinkPrefixManager : public InstanceLocator { @@ -727,7 +748,10 @@ private: }; #if OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE - void HandleNat64PrefixManagerTimer(void) { mNat64PrefixManager.HandleTimer(); } + void HandleNat64PrefixManagerTimer(void) + { + mNat64PrefixManager.HandleTimer(); + } class Nat64PrefixManager : public InstanceLocator { @@ -796,7 +820,10 @@ private: TimeMilli mLastTxTime; }; - void HandleRsSenderTimer(void) { mRsSender.HandleTimer(); } + void HandleRsSenderTimer(void) + { + mRsSender.HandleTimer(); + } class RsSender : public InstanceLocator { @@ -832,12 +859,18 @@ private: TimeMilli mStartTime; }; - void EvaluateState(void); - void Start(void); - void Stop(void); - void HandleNotifierEvents(Events aEvents); - bool IsInitialized(void) const { return mInfraIf.IsInitialized(); } - bool IsEnabled(void) const { return mIsEnabled; } + void EvaluateState(void); + void Start(void); + void Stop(void); + void HandleNotifierEvents(Events aEvents); + bool IsInitialized(void) const + { + return mInfraIf.IsInitialized(); + } + bool IsEnabled(void) const + { + return mIsEnabled; + } Error LoadOrGenerateRandomBrUlaPrefix(void); void EvaluateRoutingPolicy(void); diff --git a/src/core/coap/coap.cpp b/src/core/coap/coap.cpp index a64d18d57..a42b2e771 100644 --- a/src/core/coap/coap.cpp +++ b/src/core/coap/coap.cpp @@ -218,19 +218,19 @@ Error CoapBase::Send(ot::Message &aMessage, const Ip6::MessageInfo &aMessageInfo } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -Error CoapBase::SendMessage(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, - const TxParameters & aTxParameters, +Error CoapBase::SendMessage(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, + const TxParameters &aTxParameters, ResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) #else -Error CoapBase::SendMessage(Message & aMessage, +Error CoapBase::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const TxParameters & aTxParameters, + const TxParameters &aTxParameters, ResponseHandler aHandler, - void * aContext) + void *aContext) #endif { Error error; @@ -382,10 +382,10 @@ exit: return error; } -Error CoapBase::SendMessage(Message & aMessage, +Error CoapBase::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler, - void * aContext) + void *aContext) { #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE return SendMessage(aMessage, aMessageInfo, TxParameters::GetDefault(), aHandler, aContext, nullptr, nullptr); @@ -533,9 +533,9 @@ void CoapBase::HandleRetransmissionTimer(void) } } -void CoapBase::FinalizeCoapTransaction(Message & aRequest, - const Metadata & aMetadata, - Message * aResponse, +void CoapBase::FinalizeCoapTransaction(Message &aRequest, + const Metadata &aMetadata, + Message *aResponse, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -625,9 +625,9 @@ Error CoapBase::CacheLastBlockResponse(Message *aResponse) Error CoapBase::PrepareNextBlockRequest(Message::BlockType aType, bool aMoreBlocks, - Message & aRequestOld, - Message & aRequest, - Message & aMessage) + Message &aRequestOld, + Message &aRequest, + Message &aMessage) { Error error = kErrorNone; bool isOptionSet = false; @@ -685,10 +685,10 @@ exit: return error; } -Error CoapBase::SendNextBlock1Request(Message & aRequest, - Message & aMessage, +Error CoapBase::SendNextBlock1Request(Message &aRequest, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const Metadata & aCoapMetadata) + const Metadata &aCoapMetadata) { Error error = kErrorNone; Message *request = nullptr; @@ -742,10 +742,10 @@ exit: return error; } -Error CoapBase::SendNextBlock2Request(Message & aRequest, - Message & aMessage, +Error CoapBase::SendNextBlock2Request(Message &aRequest, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const Metadata & aCoapMetadata, + const Metadata &aCoapMetadata, uint32_t aTotalLength, bool aBeginBlock1Transfer) { @@ -804,8 +804,8 @@ exit: return error; } -Error CoapBase::ProcessBlock1Request(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +Error CoapBase::ProcessBlock1Request(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const ResourceBlockWise &aResource, uint32_t aTotalLength) { @@ -865,12 +865,12 @@ exit: return error; } -Error CoapBase::ProcessBlock2Request(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +Error CoapBase::ProcessBlock2Request(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const ResourceBlockWise &aResource) { Error error = kErrorNone; - Message * response = nullptr; + Message *response = nullptr; uint8_t buf[kMaxBlockLength] = {0}; uint16_t bufLen = kMaxBlockLength; bool moreBlocks = false; @@ -1011,9 +1011,9 @@ exit: } } -Message *CoapBase::FindRelatedRequest(const Message & aResponse, +Message *CoapBase::FindRelatedRequest(const Message &aResponse, const Ip6::MessageInfo &aMessageInfo, - Metadata & aMetadata) + Metadata &aMetadata) { Message *request = nullptr; @@ -1249,7 +1249,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo } #else // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE { - FinalizeCoapTransaction(*request, metadata, &aMessage, &aMessageInfo, kErrorNone); + FinalizeCoapTransaction(*request, metadata, &aMessage, &aMessageInfo, kErrorNone); } #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE } @@ -1305,7 +1305,7 @@ void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo Error error = kErrorNone; #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE Option::Iterator iterator; - char * curUriPath = uriPath; + char *curUriPath = uriPath; uint8_t blockOptionType = 0; uint32_t totalTransfereSize = 0; #endif @@ -1491,9 +1491,9 @@ ResponsesQueue::ResponsesQueue(Instance &aInstance) { } -Error ResponsesQueue::GetMatchedResponseCopy(const Message & aRequest, +Error ResponsesQueue::GetMatchedResponseCopy(const Message &aRequest, const Ip6::MessageInfo &aMessageInfo, - Message ** aResponse) + Message **aResponse) { Error error = kErrorNone; const Message *cacheResponse; @@ -1532,11 +1532,11 @@ const Message *ResponsesQueue::FindMatchedResponse(const Message &aRequest, cons return response; } -void ResponsesQueue::EnqueueResponse(Message & aMessage, +void ResponsesQueue::EnqueueResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const TxParameters & aTxParameters) + const TxParameters &aTxParameters) { - Message * responseCopy; + Message *responseCopy; ResponseMetadata metadata; metadata.mDequeueTime = TimerMilli::GetNow() + aTxParameters.CalculateExchangeLifetime(); @@ -1561,7 +1561,7 @@ exit: void ResponsesQueue::UpdateQueue(void) { uint16_t msgCount = 0; - Message * earliestMsg = nullptr; + Message *earliestMsg = nullptr; TimeMilli earliestDequeueTime(0); // Check the number of messages in the queue and if number is at diff --git a/src/core/coap/coap.hpp b/src/core/coap/coap.hpp index f5fcd1a3c..79af98a6e 100644 --- a/src/core/coap/coap.hpp +++ b/src/core/coap/coap.hpp @@ -201,9 +201,9 @@ public: * @param[in] aTransmitHook A function pointer that is called when transmitting a CoAP block message from @p * aUriPath. */ - ResourceBlockWise(const char * aUriPath, + ResourceBlockWise(const char *aUriPath, otCoapRequestHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseReceiveHook aReceiveHook, otCoapBlockwiseTransmitHook aTransmitHook) { @@ -570,11 +570,11 @@ public: * @retval kErrorNoBufs Failed to allocate retransmission data. * */ - Error SendMessage(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, - const TxParameters & aTxParameters, + Error SendMessage(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, + const TxParameters &aTxParameters, otCoapResponseHandler aHandler = nullptr, - void * aContext = nullptr, + void *aContext = nullptr, otCoapBlockwiseTransmitHook aTransmitHook = nullptr, otCoapBlockwiseReceiveHook aReceiveHook = nullptr); #else // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE @@ -596,11 +596,11 @@ public: * @retval kErrorNoBufs Insufficient buffers available to send the CoAP message. * */ - Error SendMessage(Message & aMessage, + Error SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const TxParameters & aTxParameters, + const TxParameters &aTxParameters, ResponseHandler aHandler = nullptr, - void * aContext = nullptr); + void *aContext = nullptr); #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE /** @@ -619,10 +619,10 @@ public: * @retval kErrorNoBufs Insufficient buffers available to send the CoAP response. * */ - Error SendMessage(Message & aMessage, + Error SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler = nullptr, - void * aContext = nullptr); + void *aContext = nullptr); /** * This method sends a CoAP reset message. @@ -737,7 +737,10 @@ public: * @returns A reference to the request message list. * */ - const MessageQueue &GetRequestMessages(void) const { return mPendingRequests; } + const MessageQueue &GetRequestMessages(void) const + { + return mPendingRequests; + } /** * This method returns a reference to the cached response list. @@ -745,7 +748,10 @@ public: * @returns A reference to the cached response list. * */ - const MessageQueue &GetCachedResponses(void) const { return mResponsesQueue.GetResponses(); } + const MessageQueue &GetCachedResponses(void) const + { + return mResponsesQueue.GetResponses(); + } protected: /** @@ -763,9 +769,9 @@ protected: * @retval FALSE Indicates that URI path was not known and the message was not processed by the handler. * */ - typedef bool (*ResourceHandler)(CoapBase & aCoapBase, - const char * aUriPath, - Message & aMessage, + typedef bool (*ResourceHandler)(CoapBase &aCoapBase, + const char *aUriPath, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo); /** @@ -806,7 +812,10 @@ protected: * @param[in] aResourceHandler The resource handler function pointer. * */ - void SetResourceHandler(ResourceHandler aHandler) { mResourceHandler = aHandler; } + void SetResourceHandler(ResourceHandler aHandler) + { + mResourceHandler = aHandler; + } private: struct Metadata @@ -819,7 +828,7 @@ private: Ip6::Address mDestinationAddress; // IPv6 address of the message destination. uint16_t mDestinationPort; // UDP port of the message destination. ResponseHandler mResponseHandler; // A function pointer that is called on response reception. - void * mResponseContext; // A pointer to arbitrary context information. + void *mResponseContext; // A pointer to arbitrary context information. TimeMilli mNextTimerShot; // Time when the timer should shoot for this message. uint32_t mRetransmissionTimeout; // Delay that is applied to next retransmission. uint8_t mRetransmissionsRemaining; // Number of retransmissions remaining. @@ -851,9 +860,9 @@ private: Message *CopyAndEnqueueMessage(const Message &aMessage, uint16_t aCopyLength, const Metadata &aMetadata); void DequeueMessage(Message &aMessage); Message *FindRelatedRequest(const Message &aResponse, const Ip6::MessageInfo &aMessageInfo, Metadata &aMetadata); - void FinalizeCoapTransaction(Message & aRequest, - const Metadata & aMetadata, - Message * aResponse, + void FinalizeCoapTransaction(Message &aRequest, + const Metadata &aMetadata, + Message *aResponse, const Ip6::MessageInfo *aMessageInfo, Error aResult); @@ -863,29 +872,29 @@ private: Error PrepareNextBlockRequest(Message::BlockType aType, bool aMoreBlocks, - Message & aRequestOld, - Message & aRequest, - Message & aMessage); - Error ProcessBlock1Request(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + Message &aRequestOld, + Message &aRequest, + Message &aMessage); + Error ProcessBlock1Request(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const ResourceBlockWise &aResource, uint32_t aTotalLength); - Error ProcessBlock2Request(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + Error ProcessBlock2Request(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const ResourceBlockWise &aResource); #endif void ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); void ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE - Error SendNextBlock1Request(Message & aRequest, - Message & aMessage, + Error SendNextBlock1Request(Message &aRequest, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const Metadata & aCoapMetadata); - Error SendNextBlock2Request(Message & aRequest, - Message & aMessage, + const Metadata &aCoapMetadata); + Error SendNextBlock2Request(Message &aRequest, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - const Metadata & aCoapMetadata, + const Metadata &aCoapMetadata, uint32_t aTotalLength, bool aBeginBlock1Transfer); #endif @@ -900,12 +909,12 @@ private: LinkedList mResources; - void * mContext; + void *mContext; Interceptor mInterceptor; ResponsesQueue mResponsesQueue; RequestHandler mDefaultHandler; - void * mDefaultHandlerContext; + void *mDefaultHandlerContext; ResourceHandler mResourceHandler; @@ -913,7 +922,7 @@ private: #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE LinkedList mBlockWiseResources; - Message * mLastResponse; + Message *mLastResponse; #endif }; diff --git a/src/core/coap/coap_message.cpp b/src/core/coap/coap_message.cpp index 395e9ef86..74b9ba2be 100644 --- a/src/core/coap/coap_message.cpp +++ b/src/core/coap/coap_message.cpp @@ -225,7 +225,7 @@ exit: Error Message::ReadUriPathOptions(char (&aUriPath)[kMaxReceivedUriPath + 1]) const { - char * curUriPath = aUriPath; + char *curUriPath = aUriPath; Error error = kErrorNone; Option::Iterator iterator; diff --git a/src/core/coap/coap_message.hpp b/src/core/coap/coap_message.hpp index dbb0f5ccf..7cb76fd91 100644 --- a/src/core/coap/coap_message.hpp +++ b/src/core/coap/coap_message.hpp @@ -315,7 +315,10 @@ public: * @returns The Message ID value. * */ - uint16_t GetMessageId(void) const { return HostSwap16(GetHelpData().mHeader.mMessageId); } + uint16_t GetMessageId(void) const + { + return HostSwap16(GetHelpData().mHeader.mMessageId); + } /** * This method sets the Message ID value. @@ -323,7 +326,10 @@ public: * @param[in] aMessageId The Message ID value. * */ - void SetMessageId(uint16_t aMessageId) { GetHelpData().mHeader.mMessageId = HostSwap16(aMessageId); } + void SetMessageId(uint16_t aMessageId) + { + GetHelpData().mHeader.mMessageId = HostSwap16(aMessageId); + } /** * This method returns the Token length. @@ -342,7 +348,10 @@ public: * @returns A pointer to the Token value. * */ - const uint8_t *GetToken(void) const { return GetHelpData().mHeader.mToken; } + const uint8_t *GetToken(void) const + { + return GetHelpData().mHeader.mToken; + } /** * This method sets the Token value and length. @@ -438,7 +447,10 @@ public: * @retval kErrorInvalidArgs The option type is not equal or greater than the last option type. * @retval kErrorNoBufs The option length exceeds the buffer size. */ - Error AppendObserveOption(uint32_t aObserve) { return AppendUintOption(kOptionObserve, aObserve & kObserveMask); } + Error AppendObserveOption(uint32_t aObserve) + { + return AppendUintOption(kOptionObserve, aObserve & kObserveMask); + } /** * This method appends a Uri-Path option. @@ -489,7 +501,10 @@ public: * @retval kErrorNoBufs The option length exceeds the buffer size. * */ - Error AppendProxyUriOption(const char *aProxyUri) { return AppendStringOption(kOptionProxyUri, aProxyUri); } + Error AppendProxyUriOption(const char *aProxyUri) + { + return AppendStringOption(kOptionProxyUri, aProxyUri); + } /** * This method appends a Content-Format option. @@ -515,7 +530,10 @@ public: * @retval kErrorInvalidArgs The option type is not equal or greater than the last option type. * @retval kErrorNoBufs The option length exceeds the buffer size. */ - Error AppendMaxAgeOption(uint32_t aMaxAge) { return AppendUintOption(kOptionMaxAge, aMaxAge); } + Error AppendMaxAgeOption(uint32_t aMaxAge) + { + return AppendUintOption(kOptionMaxAge, aMaxAge); + } /** * This method appends a single Uri-Query option. @@ -526,7 +544,10 @@ public: * @retval kErrorInvalidArgs The option type is not equal or greater than the last option type. * @retval kErrorNoBufs The option length exceeds the buffer size. */ - Error AppendUriQueryOption(const char *aUriQuery) { return AppendStringOption(kOptionUriQuery, aUriQuery); } + Error AppendUriQueryOption(const char *aUriQuery) + { + return AppendStringOption(kOptionUriQuery, aUriQuery); + } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE /** @@ -547,7 +568,10 @@ public: * @returns The length of the message header. * */ - uint16_t GetHeaderLength(void) const { return GetHelpData().mHeaderLength; } + uint16_t GetHeaderLength(void) const + { + return GetHelpData().mHeaderLength; + } /** * This method returns the block number of a CoAP block-wise transfer message. @@ -555,7 +579,10 @@ public: * @returns The block number. * */ - uint32_t GetBlockWiseBlockNumber(void) const { return GetHelpData().mBlockWiseData.mBlockNumber; } + uint32_t GetBlockWiseBlockNumber(void) const + { + return GetHelpData().mBlockWiseData.mBlockNumber; + } /** * This method checks if the More Blocks flag is set. @@ -564,7 +591,10 @@ public: * @retval FALSE More Blocks flag is not set. * */ - bool IsMoreBlocksFlagSet(void) const { return GetHelpData().mBlockWiseData.mMoreBlocks; } + bool IsMoreBlocksFlagSet(void) const + { + return GetHelpData().mBlockWiseData.mMoreBlocks; + } /** * This method returns the block size of a CoAP block-wise transfer message. @@ -572,7 +602,10 @@ public: * @returns The block size. * */ - otCoapBlockSzx GetBlockWiseBlockSize(void) const { return GetHelpData().mBlockWiseData.mBlockSize; } + otCoapBlockSzx GetBlockWiseBlockSize(void) const + { + return GetHelpData().mBlockWiseData.mBlockSize; + } #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE /** @@ -601,7 +634,10 @@ public: * @returns The offset of the first CoAP option. * */ - uint16_t GetOptionStart(void) const { return kMinHeaderLength + GetTokenLength(); } + uint16_t GetOptionStart(void) const + { + return kMinHeaderLength + GetTokenLength(); + } /** * This method parses CoAP header and moves offset end of CoAP header. @@ -631,7 +667,10 @@ public: * @param[in] aBlockNumber Block number value to set. * */ - void SetBlockWiseBlockNumber(uint32_t aBlockNumber) { GetHelpData().mBlockWiseData.mBlockNumber = aBlockNumber; } + void SetBlockWiseBlockNumber(uint32_t aBlockNumber) + { + GetHelpData().mBlockWiseData.mBlockNumber = aBlockNumber; + } /** * This method sets the More Blocks falg in the message HelpData. @@ -639,7 +678,10 @@ public: * @param[in] aMoreBlocks TRUE or FALSE. * */ - void SetMoreBlocksFlag(bool aMoreBlocks) { GetHelpData().mBlockWiseData.mMoreBlocks = aMoreBlocks; } + void SetMoreBlocksFlag(bool aMoreBlocks) + { + GetHelpData().mBlockWiseData.mMoreBlocks = aMoreBlocks; + } /** * This method sets the block size value in the message HelpData. @@ -647,7 +689,10 @@ public: * @param[in] aBlockSize Block size value to set. * */ - void SetBlockWiseBlockSize(otCoapBlockSzx aBlockSize) { GetHelpData().mBlockWiseData.mBlockSize = aBlockSize; } + void SetBlockWiseBlockSize(otCoapBlockSzx aBlockSize) + { + GetHelpData().mBlockWiseData.mBlockSize = aBlockSize; + } #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE /** @@ -657,7 +702,10 @@ public: * @retval FALSE Message is not an empty message header. * */ - bool IsEmpty(void) const { return (GetCode() == kCodeEmpty); } + bool IsEmpty(void) const + { + return (GetCode() == kCodeEmpty); + } /** * This method checks if a header is a request header. @@ -666,7 +714,10 @@ public: * @retval FALSE Message is not a request header. * */ - bool IsRequest(void) const { return (GetCode() >= kCodeGet) && (GetCode() <= kCodeDelete); } + bool IsRequest(void) const + { + return (GetCode() >= kCodeGet) && (GetCode() <= kCodeDelete); + } /** * This method indicates whether or not the CoAP code in header is "Get" request. @@ -675,7 +726,10 @@ public: * @retval FALSE Message is not a Get request. * */ - bool IsGetRequest(void) const { return GetCode() == kCodeGet; } + bool IsGetRequest(void) const + { + return GetCode() == kCodeGet; + } /** * This method indicates whether or not the CoAP code in header is "Post" request. @@ -684,7 +738,10 @@ public: * @retval FALSE Message is not a Post request. * */ - bool IsPostRequest(void) const { return GetCode() == kCodePost; } + bool IsPostRequest(void) const + { + return GetCode() == kCodePost; + } /** * This method indicates whether or not the CoAP code in header is "Put" request. @@ -693,7 +750,10 @@ public: * @retval FALSE Message is not a Put request. * */ - bool IsPutRequest(void) const { return GetCode() == kCodePut; } + bool IsPutRequest(void) const + { + return GetCode() == kCodePut; + } /** * This method indicates whether or not the CoAP code in header is "Delete" request. @@ -702,7 +762,10 @@ public: * @retval FALSE Message is not a Delete request. * */ - bool IsDeleteRequest(void) const { return GetCode() == kCodeDelete; } + bool IsDeleteRequest(void) const + { + return GetCode() == kCodeDelete; + } /** * This method checks if a header is a response header. @@ -711,7 +774,10 @@ public: * @retval FALSE Message is not a response header. * */ - bool IsResponse(void) const { return GetCode() >= OT_COAP_CODE_RESPONSE_MIN; } + bool IsResponse(void) const + { + return GetCode() >= OT_COAP_CODE_RESPONSE_MIN; + } /** * This method checks if a header is a CON message header. @@ -720,7 +786,10 @@ public: * @retval FALSE Message is not is a CON message header. * */ - bool IsConfirmable(void) const { return (GetType() == kTypeConfirmable); } + bool IsConfirmable(void) const + { + return (GetType() == kTypeConfirmable); + } /** * This method checks if a header is a NON message header. @@ -729,7 +798,10 @@ public: * @retval FALSE Message is not is a NON message header. * */ - bool IsNonConfirmable(void) const { return (GetType() == kTypeNonConfirmable); } + bool IsNonConfirmable(void) const + { + return (GetType() == kTypeNonConfirmable); + } /** * This method checks if a header is a ACK message header. @@ -738,7 +810,10 @@ public: * @retval FALSE Message is not is a ACK message header. * */ - bool IsAck(void) const { return (GetType() == kTypeAck); } + bool IsAck(void) const + { + return (GetType() == kTypeAck); + } /** * This method checks if a header is a RST message header. @@ -747,7 +822,10 @@ public: * @retval FALSE Message is not is a RST message header. * */ - bool IsReset(void) const { return (GetType() == kTypeReset); } + bool IsReset(void) const + { + return (GetType() == kTypeReset); + } /** * This method indicates whether or not the header is a confirmable Put request (i.e, `kTypeConfirmable` with @@ -793,13 +871,19 @@ public: * @returns A pointer to the message or `nullptr` if insufficient message buffers are available. * */ - Message *Clone(void) const { return Clone(GetLength()); } + Message *Clone(void) const + { + return Clone(GetLength()); + } /** * This method returns the minimal reserved bytes required for CoAP message. * */ - static uint16_t GetHelpDataReserved(void) { return sizeof(HelpData) + kHelpDataAlignment; } + static uint16_t GetHelpDataReserved(void) + { + return sizeof(HelpData) + kHelpDataAlignment; + } /** * This method returns a pointer to the next message after this as a `Coap::Message`. @@ -810,7 +894,10 @@ public: * @returns A pointer to the next message in the queue or `nullptr` if at the end of the queue. * */ - Message *GetNextCoapMessage(void) { return static_cast(GetNext()); } + Message *GetNextCoapMessage(void) + { + return static_cast(GetNext()); + } /** * This method returns a pointer to the next message after this as a `Coap::Message`. @@ -821,7 +908,10 @@ public: * @returns A pointer to the next message in the queue or `nullptr` if at the end of the queue. * */ - const Message *GetNextCoapMessage(void) const { return static_cast(GetNext()); } + const Message *GetNextCoapMessage(void) const + { + return static_cast(GetNext()); + } private: /* @@ -957,9 +1047,15 @@ private: return *static_cast(OT_ALIGN(GetFirstData(), kHelpDataAlignment)); } - HelpData &GetHelpData(void) { return AsNonConst(AsConst(this)->GetHelpData()); } + HelpData &GetHelpData(void) + { + return AsNonConst(AsConst(this)->GetHelpData()); + } - uint8_t *GetToken(void) { return GetHelpData().mHeader.mToken; } + uint8_t *GetToken(void) + { + return GetHelpData().mHeader.mToken; + } void SetTokenLength(uint8_t aTokenLength) { diff --git a/src/core/coap/coap_secure.cpp b/src/core/coap/coap_secure.cpp index d15873147..7ea4d41b8 100644 --- a/src/core/coap/coap_secure.cpp +++ b/src/core/coap/coap_secure.cpp @@ -110,9 +110,9 @@ void CoapSecure::SetPsk(const MeshCoP::JoinerPskd &aPskd) } #if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE -Error CoapSecure::SendMessage(Message & aMessage, +Error CoapSecure::SendMessage(Message &aMessage, ResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) { @@ -127,10 +127,10 @@ exit: return error; } -Error CoapSecure::SendMessage(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +Error CoapSecure::SendMessage(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler, - void * aContext, + void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook) { @@ -150,10 +150,10 @@ exit: return error; } -Error CoapSecure::SendMessage(Message & aMessage, +Error CoapSecure::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler, - void * aContext) + void *aContext) { return CoapBase::SendMessage(aMessage, aMessageInfo, aHandler, aContext); } diff --git a/src/core/coap/coap_secure.hpp b/src/core/coap/coap_secure.hpp index be8caf67b..db7f1c89a 100644 --- a/src/core/coap/coap_secure.hpp +++ b/src/core/coap/coap_secure.hpp @@ -278,7 +278,10 @@ public: * @param[in] aVerifyPeerCertificate true, if the peer certificate should be verified * */ - void SetSslAuthMode(bool aVerifyPeerCertificate) { mDtls.SetSslAuthMode(aVerifyPeerCertificate); } + void SetSslAuthMode(bool aVerifyPeerCertificate) + { + mDtls.SetSslAuthMode(aVerifyPeerCertificate); + } #endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE @@ -301,9 +304,9 @@ public: * @retval kErrorInvalidState DTLS connection was not initialized. * */ - Error SendMessage(Message & aMessage, + Error SendMessage(Message &aMessage, ResponseHandler aHandler = nullptr, - void * aContext = nullptr, + void *aContext = nullptr, otCoapBlockwiseTransmitHook aTransmitHook = nullptr, otCoapBlockwiseReceiveHook aReceiveHook = nullptr); @@ -326,10 +329,10 @@ public: * @retval kErrorInvalidState DTLS connection was not initialized. * */ - Error SendMessage(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + Error SendMessage(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler = nullptr, - void * aContext = nullptr, + void *aContext = nullptr, otCoapBlockwiseTransmitHook aTransmitHook = nullptr, otCoapBlockwiseReceiveHook aReceiveHook = nullptr); #else // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE @@ -368,10 +371,10 @@ public: * @retval kErrorInvalidState DTLS connection was not initialized. * */ - Error SendMessage(Message & aMessage, + Error SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, ResponseHandler aHandler = nullptr, - void * aContext = nullptr); + void *aContext = nullptr); #endif // OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE /** @@ -392,7 +395,10 @@ public: * @return DTLS session's message info. * */ - const Ip6::MessageInfo &GetMessageInfo(void) const { return mDtls.GetMessageInfo(); } + const Ip6::MessageInfo &GetMessageInfo(void) const + { + return mDtls.GetMessageInfo(); + } private: static Error Send(CoapBase &aCoapBase, ot::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) @@ -412,7 +418,7 @@ private: MeshCoP::Dtls mDtls; ConnectedCallback mConnectedCallback; - void * mConnectedContext; + void *mConnectedContext; ot::MessageQueue mTransmitQueue; TaskletContext mTransmitTask; }; diff --git a/src/core/common/array.hpp b/src/core/common/array.hpp index 3c7537a70..f4c6ee81c 100644 --- a/src/core/common/array.hpp +++ b/src/core/common/array.hpp @@ -562,8 +562,8 @@ public: // loop iteration over the array elements and should not be used // directly. - Type * begin(void) { return &mElements[0]; } - Type * end(void) { return &mElements[mLength]; } + Type *begin(void) { return &mElements[0]; } + Type *end(void) { return &mElements[mLength]; } const Type *begin(void) const { return &mElements[0]; } const Type *end(void) const { return &mElements[mLength]; } diff --git a/src/core/common/heap_allocatable.hpp b/src/core/common/heap_allocatable.hpp index 1b8801631..e9073ed70 100644 --- a/src/core/common/heap_allocatable.hpp +++ b/src/core/common/heap_allocatable.hpp @@ -70,7 +70,7 @@ public: * @returns A pointer to the newly allocated instance or `nullptr` if it fails to allocate. * */ - template static Type *Allocate(Args &&... aArgs) + template static Type *Allocate(Args &&...aArgs) { void *buf = Heap::CAlloc(1, sizeof(Type)); @@ -89,7 +89,7 @@ public: * @returns A pointer to the newly allocated instance or `nullptr` if it fails to allocate or initialize. * */ - template static Type *AllocateAndInit(Args &&... aArgs) + template static Type *AllocateAndInit(Args &&...aArgs) { void *buf = Heap::CAlloc(1, sizeof(Type)); Type *object = nullptr; diff --git a/src/core/common/heap_array.hpp b/src/core/common/heap_array.hpp index a4ede9027..29645f6fb 100644 --- a/src/core/common/heap_array.hpp +++ b/src/core/common/heap_array.hpp @@ -506,12 +506,12 @@ public: // loop iteration over the array elements and should not be used // directly. - Type * begin(void) { return (mLength > 0) ? mArray : nullptr; } - Type * end(void) { return (mLength > 0) ? &mArray[mLength] : nullptr; } + Type *begin(void) { return (mLength > 0) ? mArray : nullptr; } + Type *end(void) { return (mLength > 0) ? &mArray[mLength] : nullptr; } const Type *begin(void) const { return (mLength > 0) ? mArray : nullptr; } const Type *end(void) const { return (mLength > 0) ? &mArray[mLength] : nullptr; } - Array(const Array &) = delete; + Array(const Array &) = delete; Array &operator=(const Array &) = delete; private: @@ -538,7 +538,7 @@ private: return error; } - Type * mArray; + Type *mArray; IndexType mLength; IndexType mCapacity; }; diff --git a/src/core/common/heap_data.hpp b/src/core/common/heap_data.hpp index 041f5397a..97c12a306 100644 --- a/src/core/common/heap_data.hpp +++ b/src/core/common/heap_data.hpp @@ -178,7 +178,7 @@ public: */ void Free(void); - Data(const Data &) = delete; + Data(const Data &) = delete; Data &operator=(const Data &) = delete; private: diff --git a/src/core/common/heap_string.hpp b/src/core/common/heap_string.hpp index c9a27fdc0..2f737bb15 100644 --- a/src/core/common/heap_string.hpp +++ b/src/core/common/heap_string.hpp @@ -175,7 +175,7 @@ public: */ bool operator==(const String &aString) const { return (*this == aString.AsCString()); } - String(const String &) = delete; + String(const String &) = delete; String &operator=(const String &) = delete; private: diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index f03e8bee5..1abeea31d 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -211,7 +211,10 @@ public: * @returns TRUE if the instance is valid/initialized, FALSE otherwise. * */ - bool IsInitialized(void) const { return mIsInitialized; } + bool IsInitialized(void) const + { + return mIsInitialized; + } /** * This method triggers a platform reset. @@ -300,7 +303,10 @@ public: * @returns A reference to the application COAP object. * */ - Coap::Coap &GetApplicationCoap(void) { return mApplicationCoap; } + Coap::Coap &GetApplicationCoap(void) + { + return mApplicationCoap; + } #endif #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE @@ -310,7 +316,10 @@ public: * @returns A reference to the application COAP Secure object. * */ - Coap::CoapSecure &GetApplicationCoapSecure(void) { return mApplicationCoapSecure; } + Coap::CoapSecure &GetApplicationCoapSecure(void) + { + return mApplicationCoapSecure; + } #endif #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE @@ -325,7 +334,10 @@ public: * @param[in] aEnabled TRUE to enable the "DNS name compression" mode, FALSE to disable. * */ - static void SetDnsNameCompressionEnabled(bool aEnabled) { sDnsNameCompressionEnabled = aEnabled; } + static void SetDnsNameCompressionEnabled(bool aEnabled) + { + sDnsNameCompressionEnabled = aEnabled; + } /** * This method indicates whether the "DNS name compression" mode is enabled or not. @@ -333,7 +345,10 @@ public: * @returns TRUE if the "DNS name compressions" mode is enabled, FALSE otherwise. * */ - static bool IsDnsNameCompressionEnabled(void) { return sDnsNameCompressionEnabled; } + static bool IsDnsNameCompressionEnabled(void) + { + return sDnsNameCompressionEnabled; + } #endif /** diff --git a/src/core/common/linked_list.hpp b/src/core/common/linked_list.hpp index b92487710..f79ac91d0 100644 --- a/src/core/common/linked_list.hpp +++ b/src/core/common/linked_list.hpp @@ -458,10 +458,10 @@ public: * */ template - const Type *FindMatching(const Type * aBegin, - const Type * aEnd, + const Type *FindMatching(const Type *aBegin, + const Type *aEnd, const Indicator &aIndicator, - const Type *& aPrevEntry) const + const Type *&aPrevEntry) const { const Type *entry; diff --git a/src/core/common/locator.hpp b/src/core/common/locator.hpp index 7ed3625ca..4e192d4b7 100644 --- a/src/core/common/locator.hpp +++ b/src/core/common/locator.hpp @@ -113,9 +113,15 @@ public: * */ #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE - Instance &GetInstance(void) const { return *mInstance; } + Instance &GetInstance(void) const + { + return *mInstance; + } #else - Instance &GetInstance(void) const { return *reinterpret_cast(&gInstanceRaw); } + Instance &GetInstance(void) const + { + return *reinterpret_cast(&gInstanceRaw); + } #endif protected: diff --git a/src/core/common/message.cpp b/src/core/common/message.cpp index 4847aac95..5fd3dbb0f 100644 --- a/src/core/common/message.cpp +++ b/src/core/common/message.cpp @@ -229,8 +229,8 @@ Error Message::ResizeMessage(uint16_t aLength) // requested length. Error error = kErrorNone; - Buffer * curBuffer = this; - Buffer * lastBuffer; + Buffer *curBuffer = this; + Buffer *lastBuffer; uint16_t curLength = kHeadBufferDataSize; while (curLength < aLength) @@ -917,8 +917,8 @@ const Message *PriorityQueue::GetTail(void) const void PriorityQueue::Enqueue(Message &aMessage) { Message::Priority priority; - Message * tail; - Message * next; + Message *tail; + Message *next; OT_ASSERT(!aMessage.IsInAQueue()); @@ -949,7 +949,7 @@ void PriorityQueue::Enqueue(Message &aMessage) void PriorityQueue::Dequeue(Message &aMessage) { Message::Priority priority; - Message * tail; + Message *tail; OT_ASSERT(aMessage.GetPriorityQueue() == this); diff --git a/src/core/common/message.hpp b/src/core/common/message.hpp index 09c2fff80..7783b5ca6 100644 --- a/src/core/common/message.hpp +++ b/src/core/common/message.hpp @@ -187,10 +187,10 @@ public: protected: struct Metadata { - Message * mNext; // Next message in a doubly linked list. - Message * mPrev; // Previous message in a doubly linked list. + Message *mNext; // Next message in a doubly linked list. + Message *mPrev; // Previous message in a doubly linked list. MessagePool *mMessagePool; // Message pool for this message. - void * mQueue; // The queue where message is queued (if any). Queue type from `mInPriorityQ`. + void *mQueue; // The queue where message is queued (if any). Queue type from `mInPriorityQ`. uint32_t mDatagramTag; // The datagram tag used for 6LoWPAN frags or IPv6fragmentation. TimeMilli mTimestamp; // The message timestamp. uint16_t mReserved; // Number of reserved bytes (for header). @@ -232,14 +232,32 @@ protected: static constexpr uint16_t kBufferDataSize = kBufferSize - sizeof(otMessageBuffer); static constexpr uint16_t kHeadBufferDataSize = kBufferDataSize - sizeof(Metadata); - Metadata & GetMetadata(void) { return mBuffer.mHead.mMetadata; } - const Metadata &GetMetadata(void) const { return mBuffer.mHead.mMetadata; } + Metadata &GetMetadata(void) + { + return mBuffer.mHead.mMetadata; + } + const Metadata &GetMetadata(void) const + { + return mBuffer.mHead.mMetadata; + } - uint8_t * GetFirstData(void) { return mBuffer.mHead.mData; } - const uint8_t *GetFirstData(void) const { return mBuffer.mHead.mData; } + uint8_t *GetFirstData(void) + { + return mBuffer.mHead.mData; + } + const uint8_t *GetFirstData(void) const + { + return mBuffer.mHead.mData; + } - uint8_t * GetData(void) { return mBuffer.mData; } - const uint8_t *GetData(void) const { return mBuffer.mData; } + uint8_t *GetData(void) + { + return mBuffer.mData; + } + const uint8_t *GetData(void) const + { + return mBuffer.mData; + } private: union @@ -1149,7 +1167,10 @@ public: * @param[in] aLqi A new LQI value (has no unit) to be added to average. * */ - void AddLqi(uint8_t aLqi) { GetMetadata().mLqiAverager.Add(aLqi); } + void AddLqi(uint8_t aLqi) + { + GetMetadata().mLqiAverager.Add(aLqi); + } /** * This method returns the average LQI (Link Quality Indicator) associated with the message. @@ -1157,7 +1178,10 @@ public: * @returns The current average LQI value (in dBm) or OT_RADIO_LQI_NONE if no average is available. * */ - uint8_t GetAverageLqi(void) const { return GetMetadata().mLqiAverager.GetAverage(); } + uint8_t GetAverageLqi(void) const + { + return GetMetadata().mLqiAverager.GetAverage(); + } /** * This method returns the count of frames counted so far. @@ -1165,7 +1189,10 @@ public: * @returns The count of frames that have been counted. * */ - uint8_t GetPsduCount(void) const { return GetMetadata().mLqiAverager.GetCount(); } + uint8_t GetPsduCount(void) const + { + return GetMetadata().mLqiAverager.GetCount(); + } #endif /** @@ -1216,7 +1243,10 @@ public: * @param[in] aEnabled TRUE if the message is also used for time sync purpose, FALSE otherwise. * */ - void SetTimeSync(bool aEnabled) { GetMetadata().mTimeSync = aEnabled; } + void SetTimeSync(bool aEnabled) + { + GetMetadata().mTimeSync = aEnabled; + } /** * This method sets the offset to network time. @@ -1224,7 +1254,10 @@ public: * @param[in] aNetworkTimeOffset The offset to network time. * */ - void SetNetworkTimeOffset(int64_t aNetworkTimeOffset) { GetMetadata().mNetworkTimeOffset = aNetworkTimeOffset; } + void SetNetworkTimeOffset(int64_t aNetworkTimeOffset) + { + GetMetadata().mNetworkTimeOffset = aNetworkTimeOffset; + } /** * This method gets the offset to network time. @@ -1232,7 +1265,10 @@ public: * @returns The offset to network time. * */ - int64_t GetNetworkTimeOffset(void) const { return GetMetadata().mNetworkTimeOffset; } + int64_t GetNetworkTimeOffset(void) const + { + return GetMetadata().mNetworkTimeOffset; + } /** * This method sets the time sync sequence. @@ -1240,7 +1276,10 @@ public: * @param[in] aTimeSyncSeq The time sync sequence. * */ - void SetTimeSyncSeq(uint8_t aTimeSyncSeq) { GetMetadata().mTimeSyncSeq = aTimeSyncSeq; } + void SetTimeSyncSeq(uint8_t aTimeSyncSeq) + { + GetMetadata().mTimeSyncSeq = aTimeSyncSeq; + } /** * This method gets the time sync sequence. @@ -1248,7 +1287,10 @@ public: * @returns The time sync sequence. * */ - uint8_t GetTimeSyncSeq(void) const { return GetMetadata().mTimeSyncSeq; } + uint8_t GetTimeSyncSeq(void) const + { + return GetMetadata().mTimeSyncSeq; + } #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE #if OPENTHREAD_CONFIG_MULTI_RADIO @@ -1259,7 +1301,10 @@ public: * @retval FALSE If the radio type is not set. * */ - bool IsRadioTypeSet(void) const { return GetMetadata().mIsRadioTypeSet; } + bool IsRadioTypeSet(void) const + { + return GetMetadata().mIsRadioTypeSet; + } /** * This method gets the radio link type the message was received on, or should be sent on. @@ -1269,7 +1314,10 @@ public: * @returns The radio link type of the message. * */ - Mac::RadioType GetRadioType(void) const { return static_cast(GetMetadata().mRadioType); } + Mac::RadioType GetRadioType(void) const + { + return static_cast(GetMetadata().mRadioType); + } /** * This method sets the radio link type the message was received on, or should be sent on. @@ -1289,7 +1337,10 @@ public: * After calling this method, `IsRadioTypeSet()` returns false until radio type is set (`SetRadioType()`). * */ - void ClearRadioType(void) { GetMetadata().mIsRadioTypeSet = false; } + void ClearRadioType(void) + { + GetMetadata().mIsRadioTypeSet = false; + } #endif // #if OPENTHREAD_CONFIG_MULTI_RADIO @@ -1333,8 +1384,14 @@ protected: Message *mNext; }; - uint16_t GetReserved(void) const { return GetMetadata().mReserved; } - void SetReserved(uint16_t aReservedHeader) { GetMetadata().mReserved = aReservedHeader; } + uint16_t GetReserved(void) const + { + return GetMetadata().mReserved; + } + void SetReserved(uint16_t aReservedHeader) + { + GetMetadata().mReserved = aReservedHeader; + } private: class Chunk : public Data @@ -1366,19 +1423,43 @@ private: AsConst(this)->GetNextChunk(aLength, static_cast(aChunk)); } - MessagePool *GetMessagePool(void) const { return GetMetadata().mMessagePool; } - void SetMessagePool(MessagePool *aMessagePool) { GetMetadata().mMessagePool = aMessagePool; } + MessagePool *GetMessagePool(void) const + { + return GetMetadata().mMessagePool; + } + void SetMessagePool(MessagePool *aMessagePool) + { + GetMetadata().mMessagePool = aMessagePool; + } - bool IsInAQueue(void) const { return (GetMetadata().mQueue != nullptr); } + bool IsInAQueue(void) const + { + return (GetMetadata().mQueue != nullptr); + } void SetMessageQueue(MessageQueue *aMessageQueue); void SetPriorityQueue(PriorityQueue *aPriorityQueue); - Message *& Next(void) { return GetMetadata().mNext; } - Message *const &Next(void) const { return GetMetadata().mNext; } - Message *& Prev(void) { return GetMetadata().mPrev; } + Message *&Next(void) + { + return GetMetadata().mNext; + } + Message *const &Next(void) const + { + return GetMetadata().mNext; + } + Message *&Prev(void) + { + return GetMetadata().mPrev; + } - static Message * NextOf(Message *aMessage) { return (aMessage != nullptr) ? aMessage->Next() : nullptr; } - static const Message *NextOf(const Message *aMessage) { return (aMessage != nullptr) ? aMessage->Next() : nullptr; } + static Message *NextOf(Message *aMessage) + { + return (aMessage != nullptr) ? aMessage->Next() : nullptr; + } + static const Message *NextOf(const Message *aMessage) + { + return (aMessage != nullptr) ? aMessage->Next() : nullptr; + } Error ResizeMessage(uint16_t aLength); }; @@ -1492,7 +1573,7 @@ public: Message::ConstIterator end(void) const { return Message::ConstIterator(); } private: - Message * GetTail(void) { return static_cast(mData); } + Message *GetTail(void) { return static_cast(mData); } const Message *GetTail(void) const { return static_cast(mData); } void SetTail(Message *aMessage) { mData = aMessage; } }; diff --git a/src/core/common/non_copyable.hpp b/src/core/common/non_copyable.hpp index d2bd9f90e..b6e44fead 100644 --- a/src/core/common/non_copyable.hpp +++ b/src/core/common/non_copyable.hpp @@ -43,7 +43,7 @@ namespace ot { class NonCopyable { public: - NonCopyable(const NonCopyable &) = delete; + NonCopyable(const NonCopyable &) = delete; NonCopyable &operator=(const NonCopyable &) = delete; protected: diff --git a/src/core/common/notifier.hpp b/src/core/common/notifier.hpp index a8678203a..01cd83f31 100644 --- a/src/core/common/notifier.hpp +++ b/src/core/common/notifier.hpp @@ -310,7 +310,7 @@ private: struct ExternalCallback { otStateChangedCallback mHandler; - void * mContext; + void *mContext; }; void EmitEvents(void); diff --git a/src/core/common/owned_ptr.hpp b/src/core/common/owned_ptr.hpp index ab98fd3f9..c1dde762b 100644 --- a/src/core/common/owned_ptr.hpp +++ b/src/core/common/owned_ptr.hpp @@ -171,8 +171,8 @@ public: return *this; } - OwnedPtr(const OwnedPtr &) = delete; - OwnedPtr(OwnedPtr &) = delete; + OwnedPtr(const OwnedPtr &) = delete; + OwnedPtr(OwnedPtr &) = delete; OwnedPtr &operator=(const OwnedPtr &) = delete; private: diff --git a/src/core/common/ptr_wrapper.hpp b/src/core/common/ptr_wrapper.hpp index 1a655432b..3704d76ce 100644 --- a/src/core/common/ptr_wrapper.hpp +++ b/src/core/common/ptr_wrapper.hpp @@ -111,7 +111,7 @@ public: * @returns The wrapped pointer. * */ - const Type *operator->(void)const { return mPointer; } + const Type *operator->(void) const { return mPointer; } /** * This method overloads the `*` dereference operator and returns a reference to the pointed object. @@ -131,7 +131,7 @@ public: * @returns A reference to the pointed object. * */ - const Type &operator*(void)const { return *mPointer; } + const Type &operator*(void) const { return *mPointer; } /** * This method overloads the operator `==` to compare the `Ptr` with a given pointer. diff --git a/src/core/common/random.hpp b/src/core/common/random.hpp index d3b75d0f2..020792318 100644 --- a/src/core/common/random.hpp +++ b/src/core/common/random.hpp @@ -84,7 +84,10 @@ public: * @retval kErrorNone Successfully filled buffer with random values. * */ - static Error CryptoFillBuffer(uint8_t *aBuffer, uint16_t aSize) { return otPlatCryptoRandomGet(aBuffer, aSize); } + static Error CryptoFillBuffer(uint8_t *aBuffer, uint16_t aSize) + { + return otPlatCryptoRandomGet(aBuffer, aSize); + } #endif private: diff --git a/src/core/common/settings.hpp b/src/core/common/settings.hpp index 0c20f5910..783dc3314 100644 --- a/src/core/common/settings.hpp +++ b/src/core/common/settings.hpp @@ -1015,7 +1015,10 @@ public: * @returns A ChildInfoIteratorBuilder instance. * */ - ChildInfoIteratorBuilder IterateChildInfo(void) { return ChildInfoIteratorBuilder(GetInstance()); } + ChildInfoIteratorBuilder IterateChildInfo(void) + { + return ChildInfoIteratorBuilder(GetInstance()); + } /** * This class defines an iterator to access all Child Info entries in the settings. @@ -1090,7 +1093,7 @@ public: * @returns A reference to the `ChildInfo` entry currently pointed by the iterator. * */ - const ChildInfo &operator*(void)const { return mChildInfo; } + const ChildInfo &operator*(void) const { return mChildInfo; } /** * This method overloads operator `==` to evaluate whether or not two iterator instances are equal. diff --git a/src/core/common/settings_driver.hpp b/src/core/common/settings_driver.hpp index f7851a228..cd1867bfc 100644 --- a/src/core/common/settings_driver.hpp +++ b/src/core/common/settings_driver.hpp @@ -187,7 +187,10 @@ public: * @retval kErrorNotFound The key was not found. * */ - Error Get(uint16_t aKey, void *aValue, uint16_t *aValueLength) const { return Get(aKey, 0, aValue, aValueLength); } + Error Get(uint16_t aKey, void *aValue, uint16_t *aValueLength) const + { + return Get(aKey, 0, aValue, aValueLength); + } /** * This method sets or replaces the value identified by @p aKey. @@ -231,7 +234,10 @@ public: } private: - otInstance *GetInstancePtr(void) const { return reinterpret_cast(&InstanceLocator::GetInstance()); } + otInstance *GetInstancePtr(void) const + { + return reinterpret_cast(&InstanceLocator::GetInstance()); + } #if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE Flash mFlash; diff --git a/src/core/common/string.hpp b/src/core/common/string.hpp index c83a127aa..f80454d33 100644 --- a/src/core/common/string.hpp +++ b/src/core/common/string.hpp @@ -350,7 +350,7 @@ public: void ConvertToUppercase(void) { StringConvertToUppercase(mBuffer); } private: - char * mBuffer; + char *mBuffer; uint16_t mLength; const uint16_t mSize; }; diff --git a/src/core/common/timer.cpp b/src/core/common/timer.cpp index 66de06d99..144e22c46 100644 --- a/src/core/common/timer.cpp +++ b/src/core/common/timer.cpp @@ -168,7 +168,7 @@ void Timer::Scheduler::SetAlarm(const AlarmApi &aAlarmApi) } else { - Timer * timer = mTimerList.GetHead(); + Timer *timer = mTimerList.GetHead(); Time now(aAlarmApi.AlarmGetNow()); uint32_t remaining; diff --git a/src/core/common/timer.hpp b/src/core/common/timer.hpp index 4858c7584..34e60ec2c 100644 --- a/src/core/common/timer.hpp +++ b/src/core/common/timer.hpp @@ -140,7 +140,7 @@ protected: Handler mHandler; Time mFireTime; - Timer * mNext; + Timer *mNext; }; extern "C" void otPlatAlarmMilliFired(otInstance *aInstance); diff --git a/src/core/crypto/aes_ccm.cpp b/src/core/crypto/aes_ccm.cpp index 49c42f2ac..bb9bec125 100644 --- a/src/core/crypto/aes_ccm.cpp +++ b/src/core/crypto/aes_ccm.cpp @@ -280,7 +280,7 @@ void AesCcm::Finalize(void *aTag) void AesCcm::GenerateNonce(const Mac::ExtAddress &aAddress, uint32_t aFrameCounter, uint8_t aSecurityLevel, - uint8_t * aNonce) + uint8_t *aNonce) { memcpy(aNonce, aAddress.m8, sizeof(Mac::ExtAddress)); aNonce += sizeof(Mac::ExtAddress); diff --git a/src/core/crypto/aes_ccm.hpp b/src/core/crypto/aes_ccm.hpp index 0234243a2..8454ebafc 100644 --- a/src/core/crypto/aes_ccm.hpp +++ b/src/core/crypto/aes_ccm.hpp @@ -174,7 +174,10 @@ public: * @returns The tag length in bytes. * */ - uint8_t GetTagLength(void) const { return mTagLength; } + uint8_t GetTagLength(void) const + { + return mTagLength; + } /** * This method generates the tag. @@ -196,7 +199,7 @@ public: static void GenerateNonce(const Mac::ExtAddress &aAddress, uint32_t aFrameCounter, uint8_t aSecurityLevel, - uint8_t * aNonce); + uint8_t *aNonce); private: AesEcb mEcb; diff --git a/src/core/crypto/crypto_platform.cpp b/src/core/crypto/crypto_platform.cpp index 19373fe46..cba4de61c 100644 --- a/src/core/crypto/crypto_platform.cpp +++ b/src/core/crypto/crypto_platform.cpp @@ -151,7 +151,7 @@ OT_TOOL_WEAK otError otPlatCryptoHmacSha256Init(otCryptoContext *aContext) { Error error = kErrorNone; const mbedtls_md_info_t *mdInfo = nullptr; - mbedtls_md_context_t * context; + mbedtls_md_context_t *context; VerifyOrExit(aContext != nullptr, error = kErrorInvalidArgs); VerifyOrExit(aContext->mContextSize >= sizeof(mbedtls_md_context_t), error = kErrorFailed); @@ -243,9 +243,9 @@ exit: } OT_TOOL_WEAK otError otPlatCryptoHkdfExpand(otCryptoContext *aContext, - const uint8_t * aInfo, + const uint8_t *aInfo, uint16_t aInfoLength, - uint8_t * aOutputKey, + uint8_t *aOutputKey, uint16_t aOutputKeyLength) { Error error = kErrorNone; @@ -302,8 +302,8 @@ exit: return error; } -OT_TOOL_WEAK otError otPlatCryptoHkdfExtract(otCryptoContext * aContext, - const uint8_t * aSalt, +OT_TOOL_WEAK otError otPlatCryptoHkdfExtract(otCryptoContext *aContext, + const uint8_t *aSalt, uint16_t aSaltLength, const otCryptoKey *aInputKey) { @@ -518,7 +518,7 @@ exit: } OT_TOOL_WEAK otError otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, - otPlatCryptoEcdsaPublicKey * aPublicKey) + otPlatCryptoEcdsaPublicKey *aPublicKey) { Error error = kErrorNone; mbedtls_pk_context pk; @@ -554,12 +554,12 @@ exit: } OT_TOOL_WEAK otError otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, - const otPlatCryptoSha256Hash * aHash, - otPlatCryptoEcdsaSignature * aSignature) + const otPlatCryptoSha256Hash *aHash, + otPlatCryptoEcdsaSignature *aSignature) { Error error = kErrorNone; mbedtls_pk_context pk; - mbedtls_ecp_keypair * keypair; + mbedtls_ecp_keypair *keypair; mbedtls_ecdsa_context ecdsa; mbedtls_mpi r; mbedtls_mpi s; @@ -613,7 +613,7 @@ exit: } OT_TOOL_WEAK otError otPlatCryptoEcdsaVerify(const otPlatCryptoEcdsaPublicKey *aPublicKey, - const otPlatCryptoSha256Hash * aHash, + const otPlatCryptoSha256Hash *aHash, const otPlatCryptoEcdsaSignature *aSignature) { Error error = kErrorNone; diff --git a/src/core/crypto/ecdsa.cpp b/src/core/crypto/ecdsa.cpp index cd71dc887..2f4a8c70b 100644 --- a/src/core/crypto/ecdsa.cpp +++ b/src/core/crypto/ecdsa.cpp @@ -51,8 +51,8 @@ namespace ot { namespace Crypto { namespace Ecdsa { -Error Sign(uint8_t * aOutput, - uint16_t & aOutputLength, +Error Sign(uint8_t *aOutput, + uint16_t &aOutputLength, const uint8_t *aInputHash, uint16_t aInputHashLength, const uint8_t *aPrivateKey, @@ -61,7 +61,7 @@ Error Sign(uint8_t * aOutput, Error error = kErrorNone; mbedtls_ecdsa_context ctx; mbedtls_pk_context pkCtx; - mbedtls_ecp_keypair * keypair; + mbedtls_ecp_keypair *keypair; mbedtls_mpi rMpi; mbedtls_mpi sMpi; diff --git a/src/core/crypto/ecdsa.hpp b/src/core/crypto/ecdsa.hpp index 56376e7d7..4c555dc0a 100644 --- a/src/core/crypto/ecdsa.hpp +++ b/src/core/crypto/ecdsa.hpp @@ -261,8 +261,8 @@ public: * @retval kErrorFailed Error during signing. * */ -Error Sign(uint8_t * aOutput, - uint16_t & aOutputLength, +Error Sign(uint8_t *aOutput, + uint16_t &aOutputLength, const uint8_t *aInputHash, uint16_t aInputHashLength, const uint8_t *aPrivateKey, diff --git a/src/core/crypto/pbkdf2_cmac.cpp b/src/core/crypto/pbkdf2_cmac.cpp index 988a57706..57cc1b75b 100644 --- a/src/core/crypto/pbkdf2_cmac.cpp +++ b/src/core/crypto/pbkdf2_cmac.cpp @@ -50,7 +50,7 @@ void GenerateKey(const uint8_t *aPassword, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, - uint8_t * aKey) + uint8_t *aKey) { const size_t kBlockSize = MBEDTLS_CIPHER_BLKSIZE_MAX; uint8_t prfInput[kMaxSaltLength + 4]; // Salt || INT(), for U1 calculation @@ -58,7 +58,7 @@ void GenerateKey(const uint8_t *aPassword, long prfTwo[kBlockSize / sizeof(long)]; long keyBlock[kBlockSize / sizeof(long)]; uint32_t blockCounter = 0; - uint8_t * key = aKey; + uint8_t *key = aKey; uint16_t keyLen = aKeyLen; uint16_t useLen = 0; diff --git a/src/core/crypto/pbkdf2_cmac.hpp b/src/core/crypto/pbkdf2_cmac.hpp index d98e33d2a..0615f6d82 100644 --- a/src/core/crypto/pbkdf2_cmac.hpp +++ b/src/core/crypto/pbkdf2_cmac.hpp @@ -70,7 +70,7 @@ void GenerateKey(const uint8_t *aPassword, uint16_t aSaltLen, uint32_t aIterationCounter, uint16_t aKeyLen, - uint8_t * aKey); + uint8_t *aKey); /** * @} diff --git a/src/core/crypto/storage.hpp b/src/core/crypto/storage.hpp index 725ab2755..7f4442e3b 100644 --- a/src/core/crypto/storage.hpp +++ b/src/core/crypto/storage.hpp @@ -133,7 +133,7 @@ inline bool IsKeyRefValid(KeyRef aKeyRef) * @retval kErrorInvalidArgs @p aKey was set to `nullptr`. * */ -inline Error ImportKey(KeyRef & aKeyRef, +inline Error ImportKey(KeyRef &aKeyRef, KeyType aKeyType, KeyAlgorithm aKeyAlgorithm, int aKeyUsage, @@ -250,7 +250,10 @@ public: * @retval FALSE The `Key` represents a literal key. * */ - bool IsKeyRef(void) const { return (mKey == nullptr); } + bool IsKeyRef(void) const + { + return (mKey == nullptr); + } /** * This method gets the `KeyRef`. @@ -260,7 +263,10 @@ public: * @returns The `KeyRef` associated with `Key`. * */ - Storage::KeyRef GetKeyRef(void) const { return mKeyRef; } + Storage::KeyRef GetKeyRef(void) const + { + return mKeyRef; + } /** * This method sets the `Key` as a `KeyRef`. diff --git a/src/core/diags/factory_diags.cpp b/src/core/diags/factory_diags.cpp index 7bb6fd35b..5ca598696 100644 --- a/src/core/diags/factory_diags.cpp +++ b/src/core/diags/factory_diags.cpp @@ -51,8 +51,8 @@ OT_TOOL_WEAK otError otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, - char * aArgs[], - char * aOutput, + char *aArgs[], + char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); @@ -644,7 +644,7 @@ Error Diags::ProcessLine(const char *aString, char *aOutput, size_t aOutputMaxLe Error error = kErrorNone; char buffer[kMaxCommandBuffer]; - char * args[kMaxArgs]; + char *args[kMaxArgs]; uint8_t argCount = 0; VerifyOrExit(StringLength(aString, kMaxCommandBuffer) < kMaxCommandBuffer, error = kErrorNoBufs); diff --git a/src/core/mac/data_poll_handler.cpp b/src/core/mac/data_poll_handler.cpp index 940c5cbdb..d918d4076 100644 --- a/src/core/mac/data_poll_handler.cpp +++ b/src/core/mac/data_poll_handler.cpp @@ -51,7 +51,7 @@ DataPollHandler::Callbacks::Callbacks(Instance &aInstance) inline Error DataPollHandler::Callbacks::PrepareFrameForChild(Mac::TxFrame &aFrame, FrameContext &aContext, - Child & aChild) + Child &aChild) { return Get().PrepareFrameForChild(aFrame, aContext, aChild); } @@ -59,7 +59,7 @@ inline Error DataPollHandler::Callbacks::PrepareFrameForChild(Mac::TxFrame &aFra inline void DataPollHandler::Callbacks::HandleSentFrameToChild(const Mac::TxFrame &aFrame, const FrameContext &aContext, Error aError, - Child & aChild) + Child &aChild) { Get().HandleSentFrameToChild(aFrame, aContext, aError, aChild); } @@ -128,7 +128,7 @@ void DataPollHandler::RequestFrameChange(FrameChange aChange, Child &aChild) void DataPollHandler::HandleDataPoll(Mac::RxFrame &aFrame) { Mac::Address macSource; - Child * child; + Child *child; uint16_t indirectMsgCount; VerifyOrExit(aFrame.GetSecurityEnabled()); diff --git a/src/core/mac/data_poll_handler.hpp b/src/core/mac/data_poll_handler.hpp index 37532c49c..af91a5f8b 100644 --- a/src/core/mac/data_poll_handler.hpp +++ b/src/core/mac/data_poll_handler.hpp @@ -94,31 +94,82 @@ public: #endif private: - bool IsDataPollPending(void) const { return mDataPollPending; } - void SetDataPollPending(bool aPending) { mDataPollPending = aPending; } + bool IsDataPollPending(void) const + { + return mDataPollPending; + } + void SetDataPollPending(bool aPending) + { + mDataPollPending = aPending; + } - uint32_t GetIndirectFrameCounter(void) const { return mIndirectFrameCounter; } - void SetIndirectFrameCounter(uint32_t aFrameCounter) { mIndirectFrameCounter = aFrameCounter; } + uint32_t GetIndirectFrameCounter(void) const + { + return mIndirectFrameCounter; + } + void SetIndirectFrameCounter(uint32_t aFrameCounter) + { + mIndirectFrameCounter = aFrameCounter; + } - uint8_t GetIndirectKeyId(void) const { return mIndirectKeyId; } - void SetIndirectKeyId(uint8_t aKeyId) { mIndirectKeyId = aKeyId; } + uint8_t GetIndirectKeyId(void) const + { + return mIndirectKeyId; + } + void SetIndirectKeyId(uint8_t aKeyId) + { + mIndirectKeyId = aKeyId; + } - uint8_t GetIndirectTxAttempts(void) const { return mIndirectTxAttempts; } - void ResetIndirectTxAttempts(void) { mIndirectTxAttempts = 0; } - void IncrementIndirectTxAttempts(void) { mIndirectTxAttempts++; } + uint8_t GetIndirectTxAttempts(void) const + { + return mIndirectTxAttempts; + } + void ResetIndirectTxAttempts(void) + { + mIndirectTxAttempts = 0; + } + void IncrementIndirectTxAttempts(void) + { + mIndirectTxAttempts++; + } - uint8_t GetIndirectDataSequenceNumber(void) const { return mIndirectDsn; } - void SetIndirectDataSequenceNumber(uint8_t aDsn) { mIndirectDsn = aDsn; } + uint8_t GetIndirectDataSequenceNumber(void) const + { + return mIndirectDsn; + } + void SetIndirectDataSequenceNumber(uint8_t aDsn) + { + mIndirectDsn = aDsn; + } - bool IsFramePurgePending(void) const { return mFramePurgePending; } - void SetFramePurgePending(bool aPurgePending) { mFramePurgePending = aPurgePending; } + bool IsFramePurgePending(void) const + { + return mFramePurgePending; + } + void SetFramePurgePending(bool aPurgePending) + { + mFramePurgePending = aPurgePending; + } - bool IsFrameReplacePending(void) const { return mFrameReplacePending; } - void SetFrameReplacePending(bool aReplacePending) { mFrameReplacePending = aReplacePending; } + bool IsFrameReplacePending(void) const + { + return mFrameReplacePending; + } + void SetFrameReplacePending(bool aReplacePending) + { + mFrameReplacePending = aReplacePending; + } #if OPENTHREAD_CONFIG_MULTI_RADIO - Mac::RadioType GetLastPollRadioType(void) const { return mLastPollRadioType; } - void SetLastPollRadioType(Mac::RadioType aRadioType) { mLastPollRadioType = aRadioType; } + Mac::RadioType GetLastPollRadioType(void) const + { + return mLastPollRadioType; + } + void SetLastPollRadioType(Mac::RadioType aRadioType) + { + mLastPollRadioType = aRadioType; + } #endif uint32_t mIndirectFrameCounter; // Frame counter for current indirect frame (used for retx). @@ -191,7 +242,7 @@ public: void HandleSentFrameToChild(const Mac::TxFrame &aFrame, const FrameContext &aContext, Error aError, - Child & aChild); + Child &aChild); /** * This callback method notifies that a requested frame change from `RequestFrameChange()` is processed. @@ -282,7 +333,7 @@ private: // indicates no active indirect tx). `mFrameContext` tracks the // context for the prepared frame for the current indirect tx. - Child * mIndirectTxChild; + Child *mIndirectTxChild; Callbacks::FrameContext mFrameContext; Callbacks mCallbacks; }; diff --git a/src/core/mac/data_poll_sender.hpp b/src/core/mac/data_poll_sender.hpp index 13e11beea..4c8ea25d6 100644 --- a/src/core/mac/data_poll_sender.hpp +++ b/src/core/mac/data_poll_sender.hpp @@ -276,7 +276,10 @@ private: void ScheduleNextPoll(PollPeriodSelector aPollPeriodSelector); uint32_t CalculatePollPeriod(void) const; const Neighbor &GetParent(void) const; - void HandlePollTimer(void) { IgnoreError(SendDataPoll()); } + void HandlePollTimer(void) + { + IgnoreError(SendDataPoll()); + } #if OPENTHREAD_CONFIG_MULTI_RADIO Error GetPollDestinationAddress(Mac::Address &aDest, Mac::RadioType &aRadioType) const; #else diff --git a/src/core/mac/link_raw.hpp b/src/core/mac/link_raw.hpp index e0a66c99f..0d4759539 100644 --- a/src/core/mac/link_raw.hpp +++ b/src/core/mac/link_raw.hpp @@ -303,7 +303,9 @@ public: uint8_t aRetryCount, bool aWillRetx); #else - void RecordFrameTransmitStatus(const TxFrame &, const RxFrame *, Error, uint8_t, bool) {} + void RecordFrameTransmitStatus(const TxFrame &, const RxFrame *, Error, uint8_t, bool) + { + } #endif private: diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 1e7106f83..4781b0e52 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -216,7 +216,7 @@ Error Mac::ConvertBeaconToActiveScanResult(const RxFrame *aBeaconFrame, ActiveSc Address address; #if OPENTHREAD_CONFIG_MAC_BEACON_PAYLOAD_PARSING_ENABLE const BeaconPayload *beaconPayload = nullptr; - const Beacon * beacon = nullptr; + const Beacon *beacon = nullptr; uint16_t payloadLength; #endif @@ -739,7 +739,7 @@ TxFrame *Mac::PrepareBeacon(void) { TxFrame *frame; uint16_t fcf; - Beacon * beacon = nullptr; + Beacon *beacon = nullptr; #if OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE uint8_t beaconLength; BeaconPayload *beaconPayload = nullptr; @@ -827,7 +827,7 @@ bool Mac::IsJoinable(void) const void Mac::ProcessTransmitSecurity(TxFrame &aFrame) { - KeyManager & keyManager = Get(); + KeyManager &keyManager = Get(); uint8_t keyIdMode; const ExtAddress *extAddress = nullptr; @@ -915,7 +915,7 @@ exit: void Mac::BeginTransmit(void) { - TxFrame * frame = nullptr; + TxFrame *frame = nullptr; TxFrames &txFrames = mLinks.GetTxFrames(); Address dstAddr; @@ -1486,7 +1486,7 @@ void Mac::HandleTimer(void) Error Mac::ProcessReceiveSecurity(RxFrame &aFrame, const Address &aSrcAddr, Neighbor *aNeighbor) { - KeyManager & keyManager = Get(); + KeyManager &keyManager = Get(); Error error = kErrorSecurity; uint8_t securityLevel; uint8_t keyIdMode; @@ -1494,7 +1494,7 @@ Error Mac::ProcessReceiveSecurity(RxFrame &aFrame, const Address &aSrcAddr, Neig uint8_t keyid; uint32_t keySequence = 0; const KeyMaterial *macKey; - const ExtAddress * extAddress; + const ExtAddress *extAddress; VerifyOrExit(aFrame.GetSecurityEnabled(), error = kErrorNone); @@ -1629,8 +1629,8 @@ Error Mac::ProcessEnhAckSecurity(TxFrame &aTxFrame, RxFrame &aAckFrame) uint32_t frameCounter; Address srcAddr; Address dstAddr; - Neighbor * neighbor = nullptr; - KeyManager & keyManager = Get(); + Neighbor *neighbor = nullptr; + KeyManager &keyManager = Get(); const KeyMaterial *macKey; VerifyOrExit(aAckFrame.GetSecurityEnabled(), error = kErrorNone); @@ -2310,8 +2310,8 @@ bool Mac::IsCslSupported(void) const void Mac::ProcessCsl(const RxFrame &aFrame, const Address &aSrcAddr) { const uint8_t *cur = aFrame.GetHeaderIe(CslIe::kHeaderIeId); - Child * child = Get().FindChild(aSrcAddr, Child::kInStateAnyExceptInvalid); - const CslIe * csl; + Child *child = Get().FindChild(aSrcAddr, Child::kInStateAnyExceptInvalid); + const CslIe *csl; VerifyOrExit(cur != nullptr && child != nullptr && aFrame.GetSecurityEnabled()); diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp index cb7867e58..7022d7735 100644 --- a/src/core/mac/mac.hpp +++ b/src/core/mac/mac.hpp @@ -239,7 +239,10 @@ public: * @returns A pointer to the IEEE 802.15.4 Extended Address. * */ - const ExtAddress &GetExtAddress(void) const { return mLinks.GetExtAddress(); } + const ExtAddress &GetExtAddress(void) const + { + return mLinks.GetExtAddress(); + } /** * This method sets the IEEE 802.15.4 Extended Address. @@ -247,7 +250,10 @@ public: * @param[in] aExtAddress A reference to the IEEE 802.15.4 Extended Address. * */ - void SetExtAddress(const ExtAddress &aExtAddress) { mLinks.SetExtAddress(aExtAddress); } + void SetExtAddress(const ExtAddress &aExtAddress) + { + mLinks.SetExtAddress(aExtAddress); + } /** * This method returns the IEEE 802.15.4 Short Address. @@ -255,7 +261,10 @@ public: * @returns The IEEE 802.15.4 Short Address. * */ - ShortAddress GetShortAddress(void) const { return mLinks.GetShortAddress(); } + ShortAddress GetShortAddress(void) const + { + return mLinks.GetShortAddress(); + } /** * This method sets the IEEE 802.15.4 Short Address. @@ -263,7 +272,10 @@ public: * @param[in] aShortAddress The IEEE 802.15.4 Short Address. * */ - void SetShortAddress(ShortAddress aShortAddress) { mLinks.SetShortAddress(aShortAddress); } + void SetShortAddress(ShortAddress aShortAddress) + { + mLinks.SetShortAddress(aShortAddress); + } /** * This method returns the IEEE 802.15.4 PAN Channel. @@ -271,7 +283,10 @@ public: * @returns The IEEE 802.15.4 PAN Channel. * */ - uint8_t GetPanChannel(void) const { return mPanChannel; } + uint8_t GetPanChannel(void) const + { + return mPanChannel; + } /** * This method sets the IEEE 802.15.4 PAN Channel. @@ -312,7 +327,10 @@ public: * @returns The supported channel mask. * */ - const ChannelMask &GetSupportedChannelMask(void) const { return mSupportedChannelMask; } + const ChannelMask &GetSupportedChannelMask(void) const + { + return mSupportedChannelMask; + } /** * This method sets the supported channel mask @@ -328,7 +346,10 @@ public: * @returns The IEEE 802.15.4 PAN ID. * */ - PanId GetPanId(void) const { return mPanId; } + PanId GetPanId(void) const + { + return mPanId; + } /** * This method sets the IEEE 802.15.4 PAN ID. @@ -344,7 +365,10 @@ public: * @returns The maximum number of retries during direct transmission. * */ - uint8_t GetMaxFrameRetriesDirect(void) const { return mMaxFrameRetriesDirect; } + uint8_t GetMaxFrameRetriesDirect(void) const + { + return mMaxFrameRetriesDirect; + } /** * This method sets the maximum number of frame retries during direct transmission. @@ -352,7 +376,10 @@ public: * @param[in] aMaxFrameRetriesDirect The maximum number of retries during direct transmission. * */ - void SetMaxFrameRetriesDirect(uint8_t aMaxFrameRetriesDirect) { mMaxFrameRetriesDirect = aMaxFrameRetriesDirect; } + void SetMaxFrameRetriesDirect(uint8_t aMaxFrameRetriesDirect) + { + mMaxFrameRetriesDirect = aMaxFrameRetriesDirect; + } #if OPENTHREAD_FTD /** @@ -361,7 +388,10 @@ public: * @returns The maximum number of retries during indirect transmission. * */ - uint8_t GetMaxFrameRetriesIndirect(void) const { return mMaxFrameRetriesIndirect; } + uint8_t GetMaxFrameRetriesIndirect(void) const + { + return mMaxFrameRetriesIndirect; + } /** * This method sets the maximum number of frame retries during indirect transmission. @@ -434,13 +464,19 @@ public: * This method returns if an active scan is in progress. * */ - bool IsActiveScanInProgress(void) const { return IsActiveOrPending(kOperationActiveScan); } + bool IsActiveScanInProgress(void) const + { + return IsActiveOrPending(kOperationActiveScan); + } /** * This method returns if an energy scan is in progress. * */ - bool IsEnergyScanInProgress(void) const { return IsActiveOrPending(kOperationEnergyScan); } + bool IsEnergyScanInProgress(void) const + { + return IsActiveOrPending(kOperationEnergyScan); + } #if OPENTHREAD_FTD /** @@ -449,7 +485,10 @@ public: * @returns TRUE if in middle of an indirect transmission, FALSE otherwise. * */ - bool IsPerformingIndirectTransmit(void) const { return (mOperation == kOperationTransmitDataIndirect); } + bool IsPerformingIndirectTransmit(void) const + { + return (mOperation == kOperationTransmitDataIndirect); + } #endif /** @@ -482,7 +521,10 @@ public: * @retval false Promiscuous mode is not enabled. * */ - bool IsPromiscuous(void) const { return mPromiscuous; } + bool IsPromiscuous(void) const + { + return mPromiscuous; + } /** * This method enables or disables the link layer promiscuous mode. @@ -498,7 +540,10 @@ public: * This method resets mac counters * */ - void ResetCounters(void) { memset(&mCounters, 0, sizeof(mCounters)); } + void ResetCounters(void) + { + memset(&mCounters, 0, sizeof(mCounters)); + } /** * This method returns the MAC counter. @@ -506,7 +551,10 @@ public: * @returns A reference to the MAC counter. * */ - otMacCounters &GetCounters(void) { return mCounters; } + otMacCounters &GetCounters(void) + { + return mCounters; + } #if OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE /** @@ -546,7 +594,10 @@ public: * @returns The noise floor value in dBm. * */ - int8_t GetNoiseFloor(void) const { return mLinks.GetNoiseFloor(); } + int8_t GetNoiseFloor(void) const + { + return mLinks.GetNoiseFloor(); + } /** * This method computes the link margin for a given a received signal strength value using noise floor. @@ -567,7 +618,10 @@ public: * @returns The CCA failure rate with maximum value `0xffff` corresponding to 100% failure rate. * */ - uint16_t GetCcaFailureRate(void) const { return mCcaSuccessRateTracker.GetFailureRate(); } + uint16_t GetCcaFailureRate(void) const + { + return mCcaSuccessRateTracker.GetFailureRate(); + } /** * This method Starts/Stops the Link layer. It may only be used when the Netif Interface is down. @@ -575,7 +629,10 @@ public: * @param[in] aEnable The requested State for the MAC layer. true - Start, false - Stop. * */ - void SetEnabled(bool aEnable) { mEnabled = aEnable; } + void SetEnabled(bool aEnable) + { + mEnabled = aEnable; + } /** * This method indicates whether or not the link layer is enabled. @@ -584,7 +641,10 @@ public: * @retval false Link layer is not enabled. * */ - bool IsEnabled(void) const { return mEnabled; } + bool IsEnabled(void) const + { + return mEnabled; + } #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE /** @@ -593,7 +653,10 @@ public: * @returns CSL channel. * */ - uint8_t GetCslChannel(void) const { return mCslChannel; } + uint8_t GetCslChannel(void) const + { + return mCslChannel; + } /** * This method sets the CSL channel. @@ -615,7 +678,10 @@ public: * @returns CSL period in units of 10 symbols. * */ - uint16_t GetCslPeriod(void) const { return mCslPeriod; } + uint16_t GetCslPeriod(void) const + { + return mCslPeriod; + } /** * This method sets the CSL period. @@ -658,7 +724,10 @@ public: * @returns The parent CSL accuracy. * */ - const CslAccuracy &GetCslParentAccuracy(void) const { return mLinks.GetSubMac().GetCslParentAccuracy(); } + const CslAccuracy &GetCslParentAccuracy(void) const + { + return mLinks.GetSubMac().GetCslParentAccuracy(); + } /** * This method sets parent CSL accuracy. @@ -693,7 +762,10 @@ public: * @retval FALSE If the radio filter is disabled. * */ - bool IsRadioFilterEnabled(void) const { return mLinks.GetSubMac().IsRadioFilterEnabled(); } + bool IsRadioFilterEnabled(void) const + { + return mLinks.GetSubMac().IsRadioFilterEnabled(); + } #endif private: @@ -745,11 +817,20 @@ private: Error ProcessEnhAckSecurity(TxFrame &aTxFrame, RxFrame &aAckFrame); #endif - void UpdateIdleMode(void); - bool IsPending(Operation aOperation) const { return mPendingOperations & (1U << aOperation); } - bool IsActiveOrPending(Operation aOperation) const; - void SetPending(Operation aOperation) { mPendingOperations |= (1U << aOperation); } - void ClearPending(Operation aOperation) { mPendingOperations &= ~(1U << aOperation); } + void UpdateIdleMode(void); + bool IsPending(Operation aOperation) const + { + return mPendingOperations & (1U << aOperation); + } + bool IsActiveOrPending(Operation aOperation) const; + void SetPending(Operation aOperation) + { + mPendingOperations |= (1U << aOperation); + } + void ClearPending(Operation aOperation) + { + mPendingOperations &= ~(1U << aOperation); + } void StartOperation(Operation aOperation); void FinishOperation(void); void PerformNextOperation(void); diff --git a/src/core/mac/mac_frame.cpp b/src/core/mac/mac_frame.cpp index e889e3467..c590c5ae8 100644 --- a/src/core/mac/mac_frame.cpp +++ b/src/core/mac/mac_frame.cpp @@ -1023,7 +1023,7 @@ exit: void Frame::SetCslIe(uint16_t aCslPeriod, uint16_t aCslPhase) { uint8_t *cur = GetHeaderIe(CslIe::kHeaderIeId); - CslIe * csl; + CslIe *csl; VerifyOrExit(cur != nullptr); @@ -1049,7 +1049,7 @@ void Frame::SetEnhAckProbingIe(const uint8_t *aValue, uint8_t aLen) #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE const TimeIe *Frame::GetTimeIe(void) const { - const TimeIe * timeIe = nullptr; + const TimeIe *timeIe = nullptr; const uint8_t *cur = nullptr; cur = GetHeaderIe(VendorIeHeader::kHeaderIeId); @@ -1136,7 +1136,7 @@ template Error Frame::AppendHeaderIeAt(uint8_t &aIndex); void TxFrame::CopyFrom(const TxFrame &aFromFrame) { - uint8_t * psduBuffer = mPsdu; + uint8_t *psduBuffer = mPsdu; otRadioIeInfo *ieInfoBuffer = mInfo.mTxInfo.mIeInfo; #if OPENTHREAD_CONFIG_MULTI_RADIO uint8_t radioType = mRadioType; diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index 9ffe2d57c..135143079 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -903,7 +903,10 @@ public: * @returns A pointer to the Time IE, `nullptr` if not found. * */ - TimeIe *GetTimeIe(void) { return AsNonConst(AsConst(this)->GetTimeIe()); } + TimeIe *GetTimeIe(void) + { + return AsNonConst(AsConst(this)->GetTimeIe()); + } /** * This method returns a pointer to the vendor specific Time IE. @@ -941,7 +944,10 @@ public: * @returns A pointer to the Header IE, `nullptr` if not found. * */ - uint8_t *GetHeaderIe(uint8_t aIeId) { return AsNonConst(AsConst(this)->GetHeaderIe(aIeId)); } + uint8_t *GetHeaderIe(uint8_t aIeId) + { + return AsNonConst(AsConst(this)->GetHeaderIe(aIeId)); + } /** * This method returns a pointer to the Header IE. @@ -963,7 +969,10 @@ public: * @returns A pointer to the Thread IE, `nullptr` if not found. * */ - uint8_t *GetThreadIe(uint8_t aSubType) { return AsNonConst(AsConst(this)->GetThreadIe(aSubType)); } + uint8_t *GetThreadIe(uint8_t aSubType) + { + return AsNonConst(AsConst(this)->GetThreadIe(aSubType)); + } /** * This method returns a pointer to a specific Thread IE. @@ -1008,7 +1017,10 @@ public: * @returns Frame's radio link type. * */ - RadioType GetRadioType(void) const { return static_cast(mRadioType); } + RadioType GetRadioType(void) const + { + return static_cast(mRadioType); + } /** * This method sets the radio link type of the frame. @@ -1016,7 +1028,10 @@ public: * @param[in] aRadioType A radio link type. * */ - void SetRadioType(RadioType aRadioType) { mRadioType = static_cast(aRadioType); } + void SetRadioType(RadioType aRadioType) + { + mRadioType = static_cast(aRadioType); + } #endif /** @@ -1088,11 +1103,20 @@ protected: static uint8_t GetKeySourceLength(uint8_t aKeyIdMode); - static bool IsDstAddrPresent(uint16_t aFcf) { return (aFcf & kFcfDstAddrMask) != kFcfDstAddrNone; } + static bool IsDstAddrPresent(uint16_t aFcf) + { + return (aFcf & kFcfDstAddrMask) != kFcfDstAddrNone; + } static bool IsDstPanIdPresent(uint16_t aFcf); - static bool IsSrcAddrPresent(uint16_t aFcf) { return (aFcf & kFcfSrcAddrMask) != kFcfSrcAddrNone; } + static bool IsSrcAddrPresent(uint16_t aFcf) + { + return (aFcf & kFcfSrcAddrMask) != kFcfSrcAddrNone; + } static bool IsSrcPanIdPresent(uint16_t aFcf); - static bool IsVersion2015(uint16_t aFcf) { return (aFcf & kFcfFrameVersionMask) == kFcfFrameVersion2015; } + static bool IsVersion2015(uint16_t aFcf) + { + return (aFcf & kFcfFrameVersionMask) == kFcfFrameVersion2015; + } static uint8_t CalculateAddrFieldSize(uint16_t aFcf); static uint8_t CalculateSecurityHeaderSize(uint8_t aSecurityControl); @@ -1188,7 +1212,10 @@ public: * @returns The time sync sequence. * */ - uint8_t ReadTimeSyncSeq(void) const { return GetTimeIe()->GetSequence(); } + uint8_t ReadTimeSyncSeq(void) const + { + return GetTimeIe()->GetSequence(); + } #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE }; @@ -1360,7 +1387,10 @@ public: * @param[in] aOffset The Time IE offset, 0 means no Time IE. * */ - void SetTimeIeOffset(uint8_t aOffset) { mInfo.mTxInfo.mIeInfo->mTimeIeOffset = aOffset; } + void SetTimeIeOffset(uint8_t aOffset) + { + mInfo.mTxInfo.mIeInfo->mTimeIeOffset = aOffset; + } /** * This method gets the Time IE offset. @@ -1368,7 +1398,10 @@ public: * @returns The Time IE offset, 0 means no Time IE. * */ - uint8_t GetTimeIeOffset(void) const { return mInfo.mTxInfo.mIeInfo->mTimeIeOffset; } + uint8_t GetTimeIeOffset(void) const + { + return mInfo.mTxInfo.mIeInfo->mTimeIeOffset; + } /** * This method sets the offset to network time. @@ -1387,7 +1420,10 @@ public: * @param[in] aTimeSyncSeq The time sync sequence. * */ - void SetTimeSyncSeq(uint8_t aTimeSyncSeq) { mInfo.mTxInfo.mIeInfo->mTimeSyncSeq = aTimeSyncSeq; } + void SetTimeSyncSeq(uint8_t aTimeSyncSeq) + { + mInfo.mTxInfo.mIeInfo->mTimeSyncSeq = aTimeSyncSeq; + } #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE /** @@ -1420,7 +1456,10 @@ public: * @param[in] aTxDelay The delay time for the TX frame. * */ - void SetTxDelay(uint32_t aTxDelay) { mInfo.mTxInfo.mTxDelay = aTxDelay; } + void SetTxDelay(uint32_t aTxDelay) + { + mInfo.mTxInfo.mTxDelay = aTxDelay; + } /** * Set TX delay base time field for the frame. @@ -1428,7 +1467,10 @@ public: * @param[in] aTxDelayBaseTime The delay base time for the TX frame. * */ - void SetTxDelayBaseTime(uint32_t aTxDelayBaseTime) { mInfo.mTxInfo.mTxDelayBaseTime = aTxDelayBaseTime; } + void SetTxDelayBaseTime(uint32_t aTxDelayBaseTime) + { + mInfo.mTxInfo.mTxDelayBaseTime = aTxDelayBaseTime; + } #endif }; @@ -1589,7 +1631,10 @@ public: * @returns The Network Name field as `NameData`. * */ - MeshCoP::NameData GetNetworkName(void) const { return MeshCoP::NameData(mNetworkName, sizeof(mNetworkName)); } + MeshCoP::NameData GetNetworkName(void) const + { + return MeshCoP::NameData(mNetworkName, sizeof(mNetworkName)); + } /** * This method sets the Network Name field. @@ -1597,7 +1642,10 @@ public: * @param[in] aNameData The Network Name (as a `NameData`). * */ - void SetNetworkName(const MeshCoP::NameData &aNameData) { aNameData.CopyTo(mNetworkName, sizeof(mNetworkName)); } + void SetNetworkName(const MeshCoP::NameData &aNameData) + { + aNameData.CopyTo(mNetworkName, sizeof(mNetworkName)); + } /** * This method returns the Extended PAN ID field. @@ -1605,7 +1653,10 @@ public: * @returns The Extended PAN ID field. * */ - const otExtendedPanId &GetExtendedPanId(void) const { return mExtendedPanId; } + const otExtendedPanId &GetExtendedPanId(void) const + { + return mExtendedPanId; + } /** * This method sets the Extended PAN ID field. @@ -1613,7 +1664,10 @@ public: * @param[in] aExtPanId An Extended PAN ID. * */ - void SetExtendedPanId(const otExtendedPanId &aExtPanId) { mExtendedPanId = aExtPanId; } + void SetExtendedPanId(const otExtendedPanId &aExtPanId) + { + mExtendedPanId = aExtPanId; + } private: uint8_t mProtocolId; diff --git a/src/core/mac/mac_links.hpp b/src/core/mac/mac_links.hpp index 693468a3b..319f4c4e5 100644 --- a/src/core/mac/mac_links.hpp +++ b/src/core/mac/mac_links.hpp @@ -114,7 +114,10 @@ public: * @returns The selected radio types. * */ - RadioTypes GetSelectedRadioTypes(void) const { return mSelectedRadioTypes; } + RadioTypes GetSelectedRadioTypes(void) const + { + return mSelectedRadioTypes; + } /** * This method gets the required radio types. @@ -128,7 +131,10 @@ public: * @returns The required radio types. * */ - RadioTypes GetRequiredRadioTypes(void) const { return mRequiredRadioTypes; } + RadioTypes GetRequiredRadioTypes(void) const + { + return mRequiredRadioTypes; + } /** * This method sets the required types. @@ -138,7 +144,10 @@ public: * @param[in] aRadioTypes A set of radio link types. * */ - void SetRequiredRadioTypes(RadioTypes aRadioTypes) { mRequiredRadioTypes = aRadioTypes; } + void SetRequiredRadioTypes(RadioTypes aRadioTypes) + { + mRequiredRadioTypes = aRadioTypes; + } #else // #if OPENTHREAD_CONFIG_MULTI_RADIO @@ -149,7 +158,10 @@ public: * @returns A reference to `TxFrame`. * */ - TxFrame &GetTxFrame(void) { return mTxFrame802154; } + TxFrame &GetTxFrame(void) + { + return mTxFrame802154; + } #elif OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE /** * This method gets the tx frame. @@ -157,7 +169,10 @@ public: * @returns A reference to `TxFrame`. * */ - TxFrame &GetTxFrame(void) { return mTxFrameTrel; } + TxFrame &GetTxFrame(void) + { + return mTxFrameTrel; + } #endif /** * This method gets a tx frame for sending a broadcast frame. @@ -165,7 +180,10 @@ public: * @returns A reference to a `TxFrame` for broadcast. * */ - TxFrame &GetBroadcastTxFrame(void) { return GetTxFrame(); } + TxFrame &GetBroadcastTxFrame(void) + { + return GetTxFrame(); + } #endif // #if OPENTHREAD_CONFIG_MULTI_RADIO @@ -520,7 +538,10 @@ public: * @returns The transmit frames. * */ - TxFrames &GetTxFrames(void) { return mTxFrames; } + TxFrames &GetTxFrames(void) + { + return mTxFrames; + } #if !OPENTHREAD_CONFIG_MULTI_RADIO @@ -634,7 +655,10 @@ public: * @returns A reference to the `SubMac` instance. * */ - SubMac &GetSubMac(void) { return mSubMac; } + SubMac &GetSubMac(void) + { + return mSubMac; + } /** * This methods gets a reference to the `SubMac` instance. @@ -642,7 +666,10 @@ public: * @returns A reference to the `SubMac` instance. * */ - const SubMac &GetSubMac(void) const { return mSubMac; } + const SubMac &GetSubMac(void) const + { + return mSubMac; + } /** * This method returns a reference to the current MAC key (for Key Mode 1) for a given Frame. diff --git a/src/core/mac/mac_types.hpp b/src/core/mac/mac_types.hpp index 3e03c75cb..08d720892 100644 --- a/src/core/mac/mac_types.hpp +++ b/src/core/mac/mac_types.hpp @@ -499,7 +499,10 @@ public: * @returns The literal `Key` * */ - const Key &GetKey(void) const { return static_cast(mKeyMaterial.mKey); } + const Key &GetKey(void) const + { + return static_cast(mKeyMaterial.mKey); + } #else /** @@ -508,7 +511,10 @@ public: * @returns The `KeyRef` * */ - KeyRef GetKeyRef(void) const { return mKeyMaterial.mKeyRef; } + KeyRef GetKeyRef(void) const + { + return mKeyMaterial.mKeyRef; + } #endif /** @@ -556,10 +562,19 @@ private: static constexpr KeyRef kInvalidKeyRef = Crypto::Storage::kInvalidKeyRef; void DestroyKey(void); - void SetKeyRef(KeyRef aKeyRef) { mKeyMaterial.mKeyRef = aKeyRef; } + void SetKeyRef(KeyRef aKeyRef) + { + mKeyMaterial.mKeyRef = aKeyRef; + } #endif - Key &GetKey(void) { return static_cast(mKeyMaterial.mKey); } - void SetKey(const Key &aKey) { mKeyMaterial.mKey = aKey; } + Key &GetKey(void) + { + return static_cast(mKeyMaterial.mKey); + } + void SetKey(const Key &aKey) + { + mKeyMaterial.mKey = aKey; + } }; #if OPENTHREAD_CONFIG_MULTI_RADIO @@ -814,7 +829,10 @@ public: * @returns The Link Frame Counter for 802.15.4 radio link. * */ - uint32_t Get154(void) const { return m154Counter; } + uint32_t Get154(void) const + { + return m154Counter; + } /** * This method sets the Link Frame Counter for 802.15.4 radio link. @@ -822,7 +840,10 @@ public: * @param[in] aCounter The new counter value. * */ - void Set154(uint32_t aCounter) { m154Counter = aCounter; } + void Set154(uint32_t aCounter) + { + m154Counter = aCounter; + } #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE @@ -832,13 +853,19 @@ public: * @returns The Link Frame Counter for TREL radio link. * */ - uint32_t GetTrel(void) const { return mTrelCounter; } + uint32_t GetTrel(void) const + { + return mTrelCounter; + } /** * This method increments the Link Frame Counter for TREL radio link. * */ - void IncrementTrel(void) { mTrelCounter++; } + void IncrementTrel(void) + { + mTrelCounter++; + } #endif /** diff --git a/src/core/mac/sub_mac.hpp b/src/core/mac/sub_mac.hpp index 080904b1d..80483019f 100644 --- a/src/core/mac/sub_mac.hpp +++ b/src/core/mac/sub_mac.hpp @@ -421,7 +421,10 @@ public: * @returns The parent CSL accuracy. * */ - const CslAccuracy &GetCslParentAccuracy(void) const { return mCslParentAccuracy; } + const CslAccuracy &GetCslParentAccuracy(void) const + { + return mCslParentAccuracy; + } /** * This method sets parent CSL accuracy. @@ -429,7 +432,10 @@ public: * @param[in] aCslAccuracy The parent CSL accuracy. * */ - void SetCslParentAccuracy(const CslAccuracy &aCslAccuracy) { mCslParentAccuracy = aCslAccuracy; } + void SetCslParentAccuracy(const CslAccuracy &aCslAccuracy) + { + mCslParentAccuracy = aCslAccuracy; + } #endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE @@ -455,7 +461,10 @@ public: * @returns A reference to the current MAC key. * */ - const KeyMaterial &GetCurrentMacKey(void) const { return mCurrKey; } + const KeyMaterial &GetCurrentMacKey(void) const + { + return mCurrKey; + } /** * This method returns a reference to the previous MAC key. @@ -463,7 +472,10 @@ public: * @returns A reference to the previous MAC key. * */ - const KeyMaterial &GetPreviousMacKey(void) const { return mPrevKey; } + const KeyMaterial &GetPreviousMacKey(void) const + { + return mPrevKey; + } /** * This method returns a reference to the next MAC key. @@ -471,7 +483,10 @@ public: * @returns A reference to the next MAC key. * */ - const KeyMaterial &GetNextMacKey(void) const { return mNextKey; } + const KeyMaterial &GetNextMacKey(void) const + { + return mNextKey; + } /** * This method returns the current MAC frame counter value. @@ -479,7 +494,10 @@ public: * @returns The current MAC frame counter value. * */ - uint32_t GetFrameCounter(void) const { return mFrameCounter; } + uint32_t GetFrameCounter(void) const + { + return mFrameCounter; + } /** * This method sets the current MAC Frame Counter value. @@ -500,7 +518,10 @@ public: * @param[in] aFilterEnabled TRUE to enable radio filter, FALSE to disable. * */ - void SetRadioFilterEnabled(bool aFilterEnabled) { mRadioFilterEnabled = aFilterEnabled; } + void SetRadioFilterEnabled(bool aFilterEnabled) + { + mRadioFilterEnabled = aFilterEnabled; + } /** * This method indicates whether the radio filter is enabled or not. @@ -509,7 +530,10 @@ public: * @retval FALSE If the radio filter is disabled. * */ - bool IsRadioFilterEnabled(void) const { return mRadioFilterEnabled; } + bool IsRadioFilterEnabled(void) const + { + return mRadioFilterEnabled; + } #endif private: @@ -576,12 +600,30 @@ private: return ((mRadioCaps & (OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_TRANSMIT_RETRIES)) != 0); } - bool RadioSupportsTransmitSecurity(void) const { return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_SEC) != 0); } - bool RadioSupportsRetries(void) const { return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_RETRIES) != 0); } - bool RadioSupportsAckTimeout(void) const { return ((mRadioCaps & OT_RADIO_CAPS_ACK_TIMEOUT) != 0); } - bool RadioSupportsEnergyScan(void) const { return ((mRadioCaps & OT_RADIO_CAPS_ENERGY_SCAN) != 0); } - bool RadioSupportsTransmitTiming(void) const { return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_TIMING) != 0); } - bool RadioSupportsReceiveTiming(void) const { return ((mRadioCaps & OT_RADIO_CAPS_RECEIVE_TIMING) != 0); } + bool RadioSupportsTransmitSecurity(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_SEC) != 0); + } + bool RadioSupportsRetries(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_RETRIES) != 0); + } + bool RadioSupportsAckTimeout(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_ACK_TIMEOUT) != 0); + } + bool RadioSupportsEnergyScan(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_ENERGY_SCAN) != 0); + } + bool RadioSupportsTransmitTiming(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_TRANSMIT_TIMING) != 0); + } + bool RadioSupportsReceiveTiming(void) const + { + return ((mRadioCaps & OT_RADIO_CAPS_RECEIVE_TIMING) != 0); + } bool ShouldHandleTransmitSecurity(void) const; bool ShouldHandleCsmaBackOff(void) const; @@ -626,10 +668,10 @@ private: #endif int8_t mEnergyScanMaxRssi; TimeMilli mEnergyScanEndTime; - TxFrame & mTransmitFrame; + TxFrame &mTransmitFrame; Callbacks mCallbacks; otLinkPcapCallback mPcapCallback; - void * mPcapCallbackContext; + void *mPcapCallbackContext; KeyMaterial mPrevKey; KeyMaterial mCurrKey; KeyMaterial mNextKey; diff --git a/src/core/meshcop/announce_begin_client.cpp b/src/core/meshcop/announce_begin_client.cpp index 5f164acb8..47e7fe718 100644 --- a/src/core/meshcop/announce_begin_client.cpp +++ b/src/core/meshcop/announce_begin_client.cpp @@ -63,7 +63,7 @@ Error AnnounceBeginClient::SendRequest(uint32_t aChannelMask, Error error = kErrorNone; MeshCoP::ChannelMaskTlv channelMask; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; VerifyOrExit(Get().IsActive(), error = kErrorInvalidState); VerifyOrExit((message = Get().NewPriorityMessage()) != nullptr, error = kErrorNoBufs); diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp index 6d1a344bb..13a3188e7 100644 --- a/src/core/meshcop/border_agent.cpp +++ b/src/core/meshcop/border_agent.cpp @@ -56,7 +56,7 @@ namespace { constexpr uint16_t kBorderAgentUdpPort = OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT; ///< UDP port of border agent service. } -void BorderAgent::ForwardContext::Init(Instance & aInstance, +void BorderAgent::ForwardContext::Init(Instance &aInstance, const Coap::Message &aMessage, bool aPetition, bool aSeparate) @@ -155,8 +155,8 @@ exit: LogError("send error CoAP message", error); } -void BorderAgent::HandleCoapResponse(void * aContext, - otMessage * aMessage, +void BorderAgent::HandleCoapResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -255,7 +255,7 @@ template <> void BorderAgent::HandleTmf(Coap::Message &aMessage, co OT_UNUSED_VARIABLE(aMessageInfo); Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; Ip6::MessageInfo messageInfo; uint16_t offset; uint16_t length; @@ -441,7 +441,7 @@ template <> void BorderAgent::HandleTmf(Coap::Message &aMessage, co Error error = kErrorNone; uint16_t joinerRouterRloc; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); uint16_t offset = 0; @@ -473,9 +473,9 @@ exit: Error BorderAgent::ForwardToLeader(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, Uri aUri) { Error error = kErrorNone; - ForwardContext * forwardContext = nullptr; + ForwardContext *forwardContext = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; uint16_t offset = 0; bool petition = false; bool separate = false; diff --git a/src/core/meshcop/border_agent.hpp b/src/core/meshcop/border_agent.hpp index cab457624..2b33d54fa 100644 --- a/src/core/meshcop/border_agent.hpp +++ b/src/core/meshcop/border_agent.hpp @@ -152,8 +152,8 @@ private: void HandleTimeout(void); - static void HandleCoapResponse(void * aContext, - otMessage * aMessage, + static void HandleCoapResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleCoapResponse(ForwardContext &aForwardContext, const Coap::Message *aResponse, Error aResult); diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index 8744a3f1f..6c496b865 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -212,7 +212,7 @@ Commissioner::Joiner *Commissioner::FindJoinerEntry(const JoinerDiscerner &aDisc Commissioner::Joiner *Commissioner::FindBestMatchingJoinerEntry(const Mac::ExtAddress &aReceivedJoinerId) { - Joiner * best = nullptr; + Joiner *best = nullptr; Mac::ExtAddress joinerId; // Prefer a full Joiner ID match, if not found use the entry @@ -437,7 +437,7 @@ void Commissioner::ClearJoiners(void) Error Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const JoinerDiscerner *aDiscerner, - const char * aPskd, + const char *aPskd, uint32_t aTimeout) { Error error = kErrorNone; @@ -683,7 +683,7 @@ void Commissioner::UpdateJoinerExpirationTimer(void) Error Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8_t aLength) { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); Tlv tlv; @@ -709,8 +709,8 @@ exit: return error; } -void Commissioner::HandleMgmtCommissionerGetResponse(void * aContext, - otMessage * aMessage, +void Commissioner::HandleMgmtCommissionerGetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -718,7 +718,7 @@ void Commissioner::HandleMgmtCommissionerGetResponse(void * aConte AsCoreTypePtr(aMessageInfo), aResult); } -void Commissioner::HandleMgmtCommissionerGetResponse(Coap::Message * aMessage, +void Commissioner::HandleMgmtCommissionerGetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -734,7 +734,7 @@ exit: Error Commissioner::SendMgmtCommissionerSetRequest(const Dataset &aDataset, const uint8_t *aTlvs, uint8_t aLength) { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); message = Get().NewPriorityConfirmablePostMessage(kUriCommissionerSet); @@ -778,8 +778,8 @@ exit: return error; } -void Commissioner::HandleMgmtCommissionerSetResponse(void * aContext, - otMessage * aMessage, +void Commissioner::HandleMgmtCommissionerSetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -787,7 +787,7 @@ void Commissioner::HandleMgmtCommissionerSetResponse(void * aConte AsCoreTypePtr(aMessageInfo), aResult); } -void Commissioner::HandleMgmtCommissionerSetResponse(Coap::Message * aMessage, +void Commissioner::HandleMgmtCommissionerSetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -803,7 +803,7 @@ exit: Error Commissioner::SendPetition(void) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); CommissionerIdTlv commissionerIdTlv; @@ -827,8 +827,8 @@ exit: return error; } -void Commissioner::HandleLeaderPetitionResponse(void * aContext, - otMessage * aMessage, +void Commissioner::HandleLeaderPetitionResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -836,7 +836,7 @@ void Commissioner::HandleLeaderPetitionResponse(void * aContext, AsCoreTypePtr(aMessageInfo), aResult); } -void Commissioner::HandleLeaderPetitionResponse(Coap::Message * aMessage, +void Commissioner::HandleLeaderPetitionResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -895,7 +895,7 @@ void Commissioner::SendKeepAlive(void) void Commissioner::SendKeepAlive(uint16_t aSessionId) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); message = Get().NewPriorityConfirmablePostMessage(kUriLeaderKeepAlive); @@ -917,8 +917,8 @@ exit: LogError("send keep alive", error); } -void Commissioner::HandleLeaderKeepAliveResponse(void * aContext, - otMessage * aMessage, +void Commissioner::HandleLeaderKeepAliveResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -926,7 +926,7 @@ void Commissioner::HandleLeaderKeepAliveResponse(void * aContext, AsCoreTypePtr(aMessageInfo), aResult); } -void Commissioner::HandleLeaderKeepAliveResponse(Coap::Message * aMessage, +void Commissioner::HandleLeaderKeepAliveResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -975,7 +975,7 @@ template <> void Commissioner::HandleTmf(Coap::Message &aMessage, c if (!Get().IsConnectionActive()) { Mac::ExtAddress receivedId; - Joiner * joiner; + Joiner *joiner; mJoinerIid = joinerIid; mJoinerIid.ConvertToExtAddress(receivedId); @@ -1076,7 +1076,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Message &aRequest, State { Error error = kErrorNone; Ip6::MessageInfo joinerMessageInfo; - Coap::Message * message; + Coap::Message *message; message = Get().NewPriorityResponseMessage(aRequest); VerifyOrExit(message != nullptr, error = kErrorNoBufs); @@ -1125,7 +1125,7 @@ Error Commissioner::SendRelayTransmit(Message &aMessage, const Ip6::MessageInfo Error error = kErrorNone; ExtendedTlv tlv; - Coap::Message * message; + Coap::Message *message; uint16_t offset; Tmf::MessageInfo messageInfo(GetInstance()); Kek kek; diff --git a/src/core/meshcop/commissioner.hpp b/src/core/meshcop/commissioner.hpp index 0dceef69b..3614a26e8 100644 --- a/src/core/meshcop/commissioner.hpp +++ b/src/core/meshcop/commissioner.hpp @@ -537,7 +537,7 @@ private: Error AddJoiner(const Mac::ExtAddress *aEui64, const JoinerDiscerner *aDiscerner, - const char * aPskd, + const char *aPskd, uint32_t aTimeout); Error RemoveJoiner(const Mac::ExtAddress *aEui64, const JoinerDiscerner *aDiscerner, uint32_t aDelay); void RemoveJoiner(Joiner &aJoiner, uint32_t aDelay); @@ -547,27 +547,27 @@ private: void UpdateJoinerExpirationTimer(void); - static void HandleMgmtCommissionerSetResponse(void * aContext, - otMessage * aMessage, + static void HandleMgmtCommissionerSetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); - void HandleMgmtCommissionerSetResponse(Coap::Message * aMessage, + void HandleMgmtCommissionerSetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); - static void HandleMgmtCommissionerGetResponse(void * aContext, - otMessage * aMessage, + static void HandleMgmtCommissionerGetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); - void HandleMgmtCommissionerGetResponse(Coap::Message * aMessage, + void HandleMgmtCommissionerGetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); - static void HandleLeaderPetitionResponse(void * aContext, - otMessage * aMessage, + static void HandleLeaderPetitionResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleLeaderPetitionResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); - static void HandleLeaderKeepAliveResponse(void * aContext, - otMessage * aMessage, + static void HandleLeaderKeepAliveResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleLeaderKeepAliveResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); @@ -601,7 +601,7 @@ private: Joiner mJoiners[OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES]; - Joiner * mActiveJoiner; + Joiner *mActiveJoiner; Ip6::InterfaceIdentifier mJoinerIid; uint16_t mJoinerPort; uint16_t mJoinerRloc; @@ -623,7 +623,7 @@ private: StateCallback mStateCallback; JoinerCallback mJoinerCallback; - void * mCallbackContext; + void *mCallbackContext; }; DeclareTmfHandler(Commissioner, kUriDatasetChanged); diff --git a/src/core/meshcop/dataset.cpp b/src/core/meshcop/dataset.cpp index 4588f852a..4f789dfa3 100644 --- a/src/core/meshcop/dataset.cpp +++ b/src/core/meshcop/dataset.cpp @@ -402,7 +402,7 @@ Error Dataset::SetTlv(Tlv::Type aType, const void *aValue, uint8_t aLength) { Error error = kErrorNone; uint16_t bytesAvailable = sizeof(mTlvs) - mLength; - Tlv * old = GetTlv(aType); + Tlv *old = GetTlv(aType); Tlv tlv; if (old != nullptr) @@ -523,7 +523,7 @@ void Dataset::RemoveTlv(Tlv *aTlv) Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdated) const { - Mac::Mac & mac = aInstance.Get(); + Mac::Mac &mac = aInstance.Get(); KeyManager &keyManager = aInstance.Get(); Error error = kErrorNone; diff --git a/src/core/meshcop/dataset_local.cpp b/src/core/meshcop/dataset_local.cpp index dfcb07713..58370c3fb 100644 --- a/src/core/meshcop/dataset_local.cpp +++ b/src/core/meshcop/dataset_local.cpp @@ -237,7 +237,7 @@ void DatasetLocal::MoveKeysToSecureStorage(Dataset &aDataset) const KeyRef networkKeyRef = IsActive() ? kActiveDatasetNetworkKeyRef : kPendingDatasetNetworkKeyRef; KeyRef pskcRef = IsActive() ? kActiveDatasetPskcRef : kPendingDatasetPskcRef; NetworkKeyTlv *networkKeyTlv = aDataset.GetTlv(); - PskcTlv * pskcTlv = aDataset.GetTlv(); + PskcTlv *pskcTlv = aDataset.GetTlv(); if (networkKeyTlv != nullptr) { @@ -269,7 +269,7 @@ void DatasetLocal::EmplaceSecurelyStoredKeys(Dataset &aDataset) const KeyRef networkKeyRef = IsActive() ? kActiveDatasetNetworkKeyRef : kPendingDatasetNetworkKeyRef; KeyRef pskcRef = IsActive() ? kActiveDatasetPskcRef : kPendingDatasetPskcRef; NetworkKeyTlv *networkKeyTlv = aDataset.GetTlv(); - PskcTlv * pskcTlv = aDataset.GetTlv(); + PskcTlv *pskcTlv = aDataset.GetTlv(); bool moveKeys = false; size_t keyLen; Error error; diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index c48023ba4..7b9c825a2 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -254,7 +254,7 @@ void DatasetManager::HandleTimer(void) void DatasetManager::SendSet(void) { Error error; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); Dataset dataset; @@ -309,8 +309,8 @@ exit: } } -void DatasetManager::HandleMgmtSetResponse(void * aContext, - otMessage * aMessage, +void DatasetManager::HandleMgmtSetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aError) { @@ -349,7 +349,7 @@ exit: if (mMgmtSetCallback != nullptr) { otDatasetMgmtSetCallback callback = mMgmtSetCallback; - void * context = mMgmtSetCallbackContext; + void *context = mMgmtSetCallbackContext; mMgmtSetCallback = nullptr; mMgmtSetCallbackContext = nullptr; @@ -405,9 +405,9 @@ exit: SendGetResponse(aMessage, aMessageInfo, tlvs, length); } -void DatasetManager::SendGetResponse(const Coap::Message & aRequest, +void DatasetManager::SendGetResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, - uint8_t * aTlvs, + uint8_t *aTlvs, uint8_t aLength) const { Error error = kErrorNone; @@ -468,14 +468,14 @@ exit: return error; } -Error DatasetManager::SendSetRequest(const Dataset::Info & aDatasetInfo, - const uint8_t * aTlvs, +Error DatasetManager::SendSetRequest(const Dataset::Info &aDatasetInfo, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext) + void *aContext) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); VerifyOrExit(!mMgmtPending, error = kErrorBusy); @@ -531,12 +531,12 @@ exit: } Error DatasetManager::SendGetRequest(const Dataset::Components &aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress) const + const otIp6Address *aAddress) const { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); Tlv tlv; uint8_t datasetTlvs[kMaxDatasetTlvs]; @@ -666,7 +666,7 @@ exit: } Error ActiveDatasetManager::Save(const Timestamp &aTimestamp, - const Message & aMessage, + const Message &aMessage, uint16_t aOffset, uint16_t aLength) { @@ -747,7 +747,7 @@ exit: } Error PendingDatasetManager::Save(const Timestamp &aTimestamp, - const Message & aMessage, + const Message &aMessage, uint16_t aOffset, uint16_t aLength) { diff --git a/src/core/meshcop/dataset_manager.hpp b/src/core/meshcop/dataset_manager.hpp index 40bb59dbc..a3fa81a2a 100644 --- a/src/core/meshcop/dataset_manager.hpp +++ b/src/core/meshcop/dataset_manager.hpp @@ -145,11 +145,11 @@ public: * @retval kErrorBusy A previous request is ongoing. * */ - Error SendSetRequest(const Dataset::Info & aDatasetInfo, - const uint8_t * aTlvs, + Error SendSetRequest(const Dataset::Info &aDatasetInfo, + const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, - void * aContext); + void *aContext); /** * This method sends a MGMT_GET request. @@ -164,9 +164,9 @@ public: * */ Error SendGetRequest(const Dataset::Components &aDatasetComponents, - const uint8_t * aTlvTypes, + const uint8_t *aTlvTypes, uint8_t aLength, - const otIp6Address * aAddress) const; + const otIp6Address *aAddress) const; #if OPENTHREAD_FTD /** * This method appends the MLE Dataset TLV but excluding MeshCoP Sub Timestamp TLV. @@ -221,7 +221,10 @@ protected: * @returns The Operational Dataset type. * */ - Dataset::Type GetType(void) const { return mLocal.GetType(); } + Dataset::Type GetType(void) const + { + return mLocal.GetType(); + } /** * This method clears the Operational Dataset. @@ -332,21 +335,27 @@ protected: bool mTimestampValid : 1; private: - static void HandleMgmtSetResponse(void * aContext, - otMessage * aMessage, + static void HandleMgmtSetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aError); void HandleMgmtSetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aError); - bool IsActiveDataset(void) const { return GetType() == Dataset::kActive; } - bool IsPendingDataset(void) const { return GetType() == Dataset::kPending; } + bool IsActiveDataset(void) const + { + return GetType() == Dataset::kActive; + } + bool IsPendingDataset(void) const + { + return GetType() == Dataset::kPending; + } void SignalDatasetChange(void) const; void HandleDatasetUpdated(void); Error AppendDatasetToMessage(const Dataset::Info &aDatasetInfo, Message &aMessage) const; void SendSet(void); - void SendGetResponse(const Coap::Message & aRequest, + void SendGetResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, - uint8_t * aTlvs, + uint8_t *aTlvs, uint8_t aLength) const; #if OPENTHREAD_FTD @@ -360,7 +369,7 @@ private: TimerMilli mTimer; otDatasetMgmtSetCallback mMgmtSetCallback; - void * mMgmtSetCallbackContext; + void *mMgmtSetCallbackContext; }; class ActiveDatasetManager : public DatasetManager, private NonCopyable @@ -463,7 +472,10 @@ public: * @retval kErrorFailed Failed to generate random values for new parameters. * */ - Error CreateNewNetwork(Dataset::Info &aDatasetInfo) { return aDatasetInfo.GenerateRandom(GetInstance()); } + Error CreateNewNetwork(Dataset::Info &aDatasetInfo) + { + return aDatasetInfo.GenerateRandom(GetInstance()); + } /** * This method starts the Leader functions for maintaining the Active Operational Dataset. @@ -486,7 +498,10 @@ private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); static void HandleTimer(Timer &aTimer); - void HandleTimer(void) { DatasetManager::HandleTimer(); } + void HandleTimer(void) + { + DatasetManager::HandleTimer(); + } }; DeclareTmfHandler(ActiveDatasetManager, kUriActiveGet); @@ -596,7 +611,10 @@ private: void StartDelayTimer(void); static void HandleTimer(Timer &aTimer); - void HandleTimer(void) { DatasetManager::HandleTimer(); } + void HandleTimer(void) + { + DatasetManager::HandleTimer(); + } void HandleDelayTimer(void); template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); diff --git a/src/core/meshcop/dataset_manager_ftd.cpp b/src/core/meshcop/dataset_manager_ftd.cpp index 5ba94ec0f..1110898fd 100644 --- a/src/core/meshcop/dataset_manager_ftd.cpp +++ b/src/core/meshcop/dataset_manager_ftd.cpp @@ -263,7 +263,7 @@ exit: return (state == StateTlv::kAccept) ? kErrorNone : kErrorDrop; } -void DatasetManager::SendSetResponse(const Coap::Message & aRequest, +void DatasetManager::SendSetResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, StateTlv::State aState) { diff --git a/src/core/meshcop/dataset_updater.hpp b/src/core/meshcop/dataset_updater.hpp index f43a71378..4c984c29e 100644 --- a/src/core/meshcop/dataset_updater.hpp +++ b/src/core/meshcop/dataset_updater.hpp @@ -126,9 +126,9 @@ private: using UpdaterTimer = TimerMilliIn; Callback mCallback; - void * mCallbackContext; + void *mCallbackContext; UpdaterTimer mTimer; - Message * mDataset; + Message *mDataset; }; } // namespace MeshCoP diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index 4c2e61eea..c1dce332b 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -756,9 +756,9 @@ void Dtls::HandleMbedtlsSetTimer(uint32_t aIntermediate, uint32_t aFinish) #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) -void Dtls::HandleMbedtlsExportKeys(void * aContext, +void Dtls::HandleMbedtlsExportKeys(void *aContext, mbedtls_ssl_key_export_type aType, - const unsigned char * aMasterSecret, + const unsigned char *aMasterSecret, size_t aMasterSecretLen, const unsigned char aClientRandom[32], const unsigned char aServerRandom[32], @@ -769,7 +769,7 @@ void Dtls::HandleMbedtlsExportKeys(void * aContext, } void Dtls::HandleMbedtlsExportKeys(mbedtls_ssl_key_export_type aType, - const unsigned char * aMasterSecret, + const unsigned char *aMasterSecret, size_t aMasterSecretLen, const unsigned char aClientRandom[32], const unsigned char aServerRandom[32], @@ -803,7 +803,7 @@ exit: #else -int Dtls::HandleMbedtlsExportKeys(void * aContext, +int Dtls::HandleMbedtlsExportKeys(void *aContext, const unsigned char *aMasterSecret, const unsigned char *aKeyBlock, size_t aMacLength, diff --git a/src/core/meshcop/dtls.hpp b/src/core/meshcop/dtls.hpp index 0ff6fe647..743f0e4f8 100644 --- a/src/core/meshcop/dtls.hpp +++ b/src/core/meshcop/dtls.hpp @@ -286,7 +286,10 @@ public: * @param[in] aVerifyPeerCertificate true, if the peer certificate should verify. * */ - void SetSslAuthMode(bool aVerifyPeerCertificate) { mVerifyPeerCertificate = aVerifyPeerCertificate; } + void SetSslAuthMode(bool aVerifyPeerCertificate) + { + mVerifyPeerCertificate = aVerifyPeerCertificate; + } #endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE #ifdef MBEDTLS_SSL_SRV_C @@ -329,7 +332,10 @@ public: * @param[in] aMessageSubType The default message sub-type. * */ - void SetDefaultMessageSubType(Message::SubType aMessageSubType) { mMessageDefaultSubType = aMessageSubType; } + void SetDefaultMessageSubType(Message::SubType aMessageSubType) + { + mMessageDefaultSubType = aMessageSubType; + } /** * This method returns the DTLS session's peer address. @@ -337,7 +343,10 @@ public: * @return DTLS session's message info. * */ - const Ip6::MessageInfo &GetMessageInfo(void) const { return mMessageInfo; } + const Ip6::MessageInfo &GetMessageInfo(void) const + { + return mMessageInfo; + } void HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); @@ -394,16 +403,16 @@ private: #ifdef MBEDTLS_SSL_EXPORT_KEYS #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) - static void HandleMbedtlsExportKeys(void * aContext, + static void HandleMbedtlsExportKeys(void *aContext, mbedtls_ssl_key_export_type aType, - const unsigned char * aMasterSecret, + const unsigned char *aMasterSecret, size_t aMasterSecretLen, const unsigned char aClientRandom[32], const unsigned char aServerRandom[32], mbedtls_tls_prf_types aTlsPrfType); void HandleMbedtlsExportKeys(mbedtls_ssl_key_export_type aType, - const unsigned char * aMasterSecret, + const unsigned char *aMasterSecret, size_t aMasterSecretLen, const unsigned char aClientRandom[32], const unsigned char aServerRandom[32], @@ -411,7 +420,7 @@ private: #else - static int HandleMbedtlsExportKeys(void * aContext, + static int HandleMbedtlsExportKeys(void *aContext, const unsigned char *aMasterSecret, const unsigned char *aKeyBlock, size_t aMacLength, @@ -458,11 +467,11 @@ private: #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE #ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED - const uint8_t * mCaChainSrc; + const uint8_t *mCaChainSrc; uint32_t mCaChainLength; - const uint8_t * mOwnCertSrc; + const uint8_t *mOwnCertSrc; uint32_t mOwnCertLength; - const uint8_t * mPrivateKeySrc; + const uint8_t *mPrivateKeySrc; uint32_t mPrivateKeyLength; mbedtls_x509_crt mCaChain; mbedtls_x509_crt mOwnCert; @@ -496,13 +505,13 @@ private: ConnectedHandler mConnectedHandler; ReceiveHandler mReceiveHandler; - void * mContext; + void *mContext; Ip6::MessageInfo mMessageInfo; Ip6::Udp::Socket mSocket; TransportCallback mTransportCallback; - void * mTransportContext; + void *mTransportContext; Message::SubType mMessageSubType; Message::SubType mMessageDefaultSubType; diff --git a/src/core/meshcop/energy_scan_client.cpp b/src/core/meshcop/energy_scan_client.cpp index 30b3d5763..1b98a9f0b 100644 --- a/src/core/meshcop/energy_scan_client.cpp +++ b/src/core/meshcop/energy_scan_client.cpp @@ -64,14 +64,14 @@ Error EnergyScanClient::SendQuery(uint32_t aChannelMas uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, - const Ip6::Address & aAddress, + const Ip6::Address &aAddress, otCommissionerEnergyReportCallback aCallback, - void * aContext) + void *aContext) { Error error = kErrorNone; MeshCoP::ChannelMaskTlv channelMask; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; VerifyOrExit(Get().IsActive(), error = kErrorInvalidState); VerifyOrExit((message = Get().NewPriorityMessage()) != nullptr, error = kErrorNoBufs); diff --git a/src/core/meshcop/energy_scan_client.hpp b/src/core/meshcop/energy_scan_client.hpp index 359fb0c1f..3649cf5c0 100644 --- a/src/core/meshcop/energy_scan_client.hpp +++ b/src/core/meshcop/energy_scan_client.hpp @@ -82,15 +82,15 @@ public: uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, - const Ip6::Address & aAddress, + const Ip6::Address &aAddress, otCommissionerEnergyReportCallback aCallback, - void * aContext); + void *aContext); private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); otCommissionerEnergyReportCallback mCallback; - void * mContext; + void *mContext; }; DeclareTmfHandler(EnergyScanClient, kUriEnergyReport); diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index c2ae16eee..59c3ea43c 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -126,14 +126,14 @@ exit: return; } -Error Joiner::Start(const char * aPskd, - const char * aProvisioningUrl, - const char * aVendorName, - const char * aVendorModel, - const char * aVendorSwVersion, - const char * aVendorData, +Error Joiner::Start(const char *aPskd, + const char *aProvisioningUrl, + const char *aVendorName, + const char *aVendorModel, + const char *aVendorSwVersion, + const char *aVendorData, otJoinerCallback aCallback, - void * aContext) + void *aContext) { Error error; JoinerPskd joinerPskd; @@ -501,8 +501,8 @@ exit: return; } -void Joiner::HandleJoinerFinalizeResponse(void * aContext, - otMessage * aMessage, +void Joiner::HandleJoinerFinalizeResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -570,7 +570,7 @@ exit: void Joiner::SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aRequestInfo) { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; Ip6::MessageInfo responseInfo(aRequestInfo); message = Get().NewPriorityResponseMessage(aRequest); diff --git a/src/core/meshcop/joiner.hpp b/src/core/meshcop/joiner.hpp index 168537b1d..0f7a99bb9 100644 --- a/src/core/meshcop/joiner.hpp +++ b/src/core/meshcop/joiner.hpp @@ -102,14 +102,14 @@ public: * @retval kErrorInvalidState The IPv6 stack is not enabled or Thread stack is fully enabled. * */ - Error Start(const char * aPskd, - const char * aProvisioningUrl, - const char * aVendorName, - const char * aVendorModel, - const char * aVendorSwVersion, - const char * aVendorData, + Error Start(const char *aPskd, + const char *aProvisioningUrl, + const char *aVendorName, + const char *aVendorModel, + const char *aVendorSwVersion, + const char *aVendorData, otJoinerCallback aCallback, - void * aContext); + void *aContext); /** * This method stops the Joiner service. @@ -201,8 +201,8 @@ private: static void HandleSecureCoapClientConnect(bool aConnected, void *aContext); void HandleSecureCoapClientConnect(bool aConnected); - static void HandleJoinerFinalizeResponse(void * aContext, - otMessage * aMessage, + static void HandleJoinerFinalizeResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleJoinerFinalizeResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); @@ -240,7 +240,7 @@ private: State mState; otJoinerCallback mCallback; - void * mContext; + void *mContext; JoinerRouter mJoinerRouters[OPENTHREAD_CONFIG_JOINER_MAX_CANDIDATES]; uint16_t mJoinerRouterIndex; diff --git a/src/core/meshcop/joiner_router.cpp b/src/core/meshcop/joiner_router.cpp index cc0749a70..1528450f8 100644 --- a/src/core/meshcop/joiner_router.cpp +++ b/src/core/meshcop/joiner_router.cpp @@ -130,7 +130,7 @@ void JoinerRouter::HandleUdpReceive(void *aContext, otMessage *aMessage, const o void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { Error error; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); ExtendedTlv tlv; uint16_t borderAgentRloc; @@ -174,7 +174,7 @@ template <> void JoinerRouter::HandleTmf(Coap::Message &aMessage, c Kek kek; uint16_t offset; uint16_t length; - Message * message = nullptr; + Message *message = nullptr; Message::Settings settings(Message::kNoLinkSecurity, Message::kPriorityNet); Ip6::MessageInfo messageInfo; @@ -211,7 +211,7 @@ exit: void JoinerRouter::DelaySendingJoinerEntrust(const Ip6::MessageInfo &aMessageInfo, const Kek &aKek) { Error error = kErrorNone; - Message * message = Get().Allocate(Message::kTypeOther); + Message *message = Get().Allocate(Message::kTypeOther); JoinerEntrustMetadata metadata; VerifyOrExit(message != nullptr, error = kErrorNoBufs); @@ -243,7 +243,7 @@ void JoinerRouter::HandleTimer(void) void JoinerRouter::SendDelayedJoinerEntrust(void) { JoinerEntrustMetadata metadata; - Message * message = mDelayedJoinEnts.GetHead(); + Message *message = mDelayedJoinEnts.GetHead(); VerifyOrExit(message != nullptr); VerifyOrExit(!mTimer.IsRunning()); @@ -298,7 +298,7 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void) Coap::Message *message = nullptr; Dataset dataset; NetworkNameTlv networkName; - const Tlv * tlv; + const Tlv *tlv; NetworkKey networkKey; message = Get().NewPriorityConfirmablePostMessage(kUriJoinerEntrust); @@ -368,8 +368,8 @@ exit: return message; } -void JoinerRouter::HandleJoinerEntrustResponse(void * aContext, - otMessage * aMessage, +void JoinerRouter::HandleJoinerEntrustResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -377,7 +377,7 @@ void JoinerRouter::HandleJoinerEntrustResponse(void * aContext, AsCoreTypePtr(aMessageInfo), aResult); } -void JoinerRouter::HandleJoinerEntrustResponse(Coap::Message * aMessage, +void JoinerRouter::HandleJoinerEntrustResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { diff --git a/src/core/meshcop/joiner_router.hpp b/src/core/meshcop/joiner_router.hpp index f739e477f..4831c2f2b 100644 --- a/src/core/meshcop/joiner_router.hpp +++ b/src/core/meshcop/joiner_router.hpp @@ -104,8 +104,8 @@ private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - static void HandleJoinerEntrustResponse(void * aContext, - otMessage * aMessage, + static void HandleJoinerEntrustResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleJoinerEntrustResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); diff --git a/src/core/meshcop/meshcop.cpp b/src/core/meshcop/meshcop.cpp index 80bb7b44f..793adc858 100644 --- a/src/core/meshcop/meshcop.cpp +++ b/src/core/meshcop/meshcop.cpp @@ -317,10 +317,10 @@ exit: } #if OPENTHREAD_FTD -Error GeneratePskc(const char * aPassPhrase, - const NetworkName & aNetworkName, +Error GeneratePskc(const char *aPassPhrase, + const NetworkName &aNetworkName, const ExtendedPanId &aExtPanId, - Pskc & aPskc) + Pskc &aPskc) { Error error = kErrorNone; const char saltPrefix[] = "Thread"; diff --git a/src/core/meshcop/meshcop.hpp b/src/core/meshcop/meshcop.hpp index 0de104702..e2554b05c 100644 --- a/src/core/meshcop/meshcop.hpp +++ b/src/core/meshcop/meshcop.hpp @@ -420,10 +420,10 @@ private: * @retval kErrorInvalidArgs If the length of passphrase is out of range. * */ -Error GeneratePskc(const char * aPassPhrase, - const NetworkName & aNetworkName, +Error GeneratePskc(const char *aPassPhrase, + const NetworkName &aNetworkName, const ExtendedPanId &aExtPanId, - Pskc & aPskc); + Pskc &aPskc); /** * This function computes the Joiner ID from a factory-assigned IEEE EUI-64. diff --git a/src/core/meshcop/meshcop_leader.cpp b/src/core/meshcop/meshcop_leader.cpp index a90439157..5308b997d 100644 --- a/src/core/meshcop/meshcop_leader.cpp +++ b/src/core/meshcop/meshcop_leader.cpp @@ -112,7 +112,7 @@ exit: SendPetitionResponse(aMessage, aMessageInfo, state); } -void Leader::SendPetitionResponse(const Coap::Message & aRequest, +void Leader::SendPetitionResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, StateTlv::State aState) { @@ -188,7 +188,7 @@ exit: return; } -void Leader::SendKeepAliveResponse(const Coap::Message & aRequest, +void Leader::SendKeepAliveResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, StateTlv::State aState) { @@ -213,7 +213,7 @@ void Leader::SendDatasetChanged(const Ip6::Address &aAddress) { Error error = kErrorNone; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message; + Coap::Message *message; message = Get().NewPriorityConfirmablePostMessage(kUriDatasetChanged); VerifyOrExit(message != nullptr, error = kErrorNoBufs); diff --git a/src/core/meshcop/meshcop_leader.hpp b/src/core/meshcop/meshcop_leader.hpp index 1695f491c..fa2a288d7 100644 --- a/src/core/meshcop/meshcop_leader.hpp +++ b/src/core/meshcop/meshcop_leader.hpp @@ -117,11 +117,11 @@ private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - void SendPetitionResponse(const Coap::Message & aRequest, + void SendPetitionResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, StateTlv::State aState); - void SendKeepAliveResponse(const Coap::Message & aRequest, + void SendKeepAliveResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aMessageInfo, StateTlv::State aState); diff --git a/src/core/meshcop/network_name.hpp b/src/core/meshcop/network_name.hpp index 1f6d84786..5bc2bd52e 100644 --- a/src/core/meshcop/network_name.hpp +++ b/src/core/meshcop/network_name.hpp @@ -234,7 +234,10 @@ public: * @returns The Thread Domain Name. * */ - const DomainName &GetDomainName(void) const { return mDomainName; } + const DomainName &GetDomainName(void) const + { + return mDomainName; + } /** * This method sets the Thread Domain Name. diff --git a/src/core/meshcop/panid_query_client.cpp b/src/core/meshcop/panid_query_client.cpp index 0a0961a49..0fb050836 100644 --- a/src/core/meshcop/panid_query_client.cpp +++ b/src/core/meshcop/panid_query_client.cpp @@ -60,14 +60,14 @@ PanIdQueryClient::PanIdQueryClient(Instance &aInstance) Error PanIdQueryClient::SendQuery(uint16_t aPanId, uint32_t aChannelMask, - const Ip6::Address & aAddress, + const Ip6::Address &aAddress, otCommissionerPanIdConflictCallback aCallback, - void * aContext) + void *aContext) { Error error = kErrorNone; MeshCoP::ChannelMaskTlv channelMask; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; VerifyOrExit(Get().IsActive(), error = kErrorInvalidState); VerifyOrExit((message = Get().NewPriorityMessage()) != nullptr, error = kErrorNoBufs); diff --git a/src/core/meshcop/panid_query_client.hpp b/src/core/meshcop/panid_query_client.hpp index 89230c573..495edfc7e 100644 --- a/src/core/meshcop/panid_query_client.hpp +++ b/src/core/meshcop/panid_query_client.hpp @@ -77,15 +77,15 @@ public: */ Error SendQuery(uint16_t aPanId, uint32_t aChannelMask, - const Ip6::Address & aAddress, + const Ip6::Address &aAddress, otCommissionerPanIdConflictCallback aCallback, - void * aContext); + void *aContext); private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); otCommissionerPanIdConflictCallback mCallback; - void * mContext; + void *mContext; }; DeclareTmfHandler(PanIdQueryClient, kUriPanIdConflict); diff --git a/src/core/net/checksum.cpp b/src/core/net/checksum.cpp index 16860cbdf..6c9d3aff1 100644 --- a/src/core/net/checksum.cpp +++ b/src/core/net/checksum.cpp @@ -93,7 +93,7 @@ void Checksum::WriteToMessage(uint16_t aOffset, Message &aMessage) const void Checksum::Calculate(const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t aIpProto, - const Message & aMessage) + const Message &aMessage) { Message::Chunk chunk; uint16_t length = aMessage.GetLength() - aMessage.GetOffset(); @@ -119,7 +119,7 @@ void Checksum::Calculate(const Ip6::Address &aSource, void Checksum::Calculate(const Ip4::Address &aSource, const Ip4::Address &aDestination, uint8_t aIpProto, - const Message & aMessage) + const Message &aMessage) { Message::Chunk chunk; uint16_t length = aMessage.GetLength() - aMessage.GetOffset(); @@ -154,7 +154,7 @@ Error Checksum::VerifyMessageChecksum(const Message &aMessage, const Ip6::Messag return (checksum.GetValue() == kValidRxChecksum) ? kErrorNone : kErrorDrop; } -void Checksum::UpdateMessageChecksum(Message & aMessage, +void Checksum::UpdateMessageChecksum(Message &aMessage, const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t aIpProto) @@ -189,7 +189,7 @@ exit: return; } -void Checksum::UpdateMessageChecksum(Message & aMessage, +void Checksum::UpdateMessageChecksum(Message &aMessage, const Ip4::Address &aSource, const Ip4::Address &aDestination, uint8_t aIpProto) diff --git a/src/core/net/checksum.hpp b/src/core/net/checksum.hpp index f335785ce..06d6e6901 100644 --- a/src/core/net/checksum.hpp +++ b/src/core/net/checksum.hpp @@ -80,7 +80,7 @@ public: * @param[in] aIpProto The Internet Protocol value. * */ - static void UpdateMessageChecksum(Message & aMessage, + static void UpdateMessageChecksum(Message &aMessage, const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t aIpProto); @@ -96,7 +96,7 @@ public: * @param[in] aIpProto The Internet Protocol value. * */ - static void UpdateMessageChecksum(Message & aMessage, + static void UpdateMessageChecksum(Message &aMessage, const Ip4::Address &aSource, const Ip4::Address &aDestination, uint8_t aIpProto); @@ -124,11 +124,11 @@ private: void Calculate(const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t aIpProto, - const Message & aMessage); + const Message &aMessage); void Calculate(const Ip4::Address &aSource, const Ip4::Address &aDestination, uint8_t aIpProto, - const Message & aMessage); + const Message &aMessage); static constexpr uint16_t kValidRxChecksum = 0xffff; diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp index 9c3e77278..75b2117f5 100644 --- a/src/core/net/dhcp6_client.cpp +++ b/src/core/net/dhcp6_client.cpp @@ -263,7 +263,7 @@ exit: void Client::Solicit(uint16_t aRloc16) { Error error = kErrorNone; - Message * message; + Message *message; Ip6::MessageInfo messageInfo; VerifyOrExit((message = mSocket.NewMessage(0)) != nullptr, error = kErrorNoBufs); diff --git a/src/core/net/dhcp6_client.hpp b/src/core/net/dhcp6_client.hpp index 7004cef96..533ded73f 100644 --- a/src/core/net/dhcp6_client.hpp +++ b/src/core/net/dhcp6_client.hpp @@ -110,7 +110,7 @@ private: void Stop(void); static bool MatchNetifAddressWithPrefix(const Ip6::Netif::UnicastAddress &aNetifAddress, - const Ip6::Prefix & aIp6Prefix); + const Ip6::Prefix &aIp6Prefix); void Solicit(uint16_t aRloc16); diff --git a/src/core/net/dhcp6_server.cpp b/src/core/net/dhcp6_server.cpp index eaab1b4dd..52bfe4fd9 100644 --- a/src/core/net/dhcp6_server.cpp +++ b/src/core/net/dhcp6_server.cpp @@ -333,14 +333,14 @@ exit: return error; } -Error Server::SendReply(const Ip6::Address & aDst, +Error Server::SendReply(const Ip6::Address &aDst, const TransactionId &aTransactionId, - ClientIdentifier & aClientId, - IaNa & aIaNa) + ClientIdentifier &aClientId, + IaNa &aIaNa) { Error error = kErrorNone; Ip6::MessageInfo messageInfo; - Message * message; + Message *message; VerifyOrExit((message = mSocket.NewMessage(0)) != nullptr, error = kErrorNoBufs); SuccessOrExit(error = AppendHeader(*message, aTransactionId)); diff --git a/src/core/net/dhcp6_server.hpp b/src/core/net/dhcp6_server.hpp index 8fa7db30a..fa14e8bd9 100644 --- a/src/core/net/dhcp6_server.hpp +++ b/src/core/net/dhcp6_server.hpp @@ -209,10 +209,10 @@ private: Error ProcessIaAddress(Message &aMessage, uint16_t aOffset); Error ProcessElapsedTime(Message &aMessage, uint16_t aOffset); - Error SendReply(const Ip6::Address & aDst, + Error SendReply(const Ip6::Address &aDst, const TransactionId &aTransactionId, - ClientIdentifier & aClientId, - IaNa & aIaNa); + ClientIdentifier &aClientId, + IaNa &aIaNa); Ip6::Udp::Socket mSocket; diff --git a/src/core/net/dns_client.cpp b/src/core/net/dns_client.cpp index 17f81b7be..a8dba7b3d 100644 --- a/src/core/net/dns_client.cpp +++ b/src/core/net/dns_client.cpp @@ -176,10 +176,10 @@ exit: } Error Client::Response::FindHostAddress(Section aSection, - const Name & aHostName, + const Name &aHostName, uint16_t aIndex, Ip6::Address &aAddress, - uint32_t & aTtl) const + uint32_t &aTtl) const { Error error; uint16_t offset; @@ -401,10 +401,10 @@ exit: return error; } -Error Client::BrowseResponse::GetHostAddress(const char * aHostName, +Error Client::BrowseResponse::GetHostAddress(const char *aHostName, uint16_t aIndex, Ip6::Address &aAddress, - uint32_t & aTtl) const + uint32_t &aTtl) const { return FindHostAddress(kAdditionalDataSection, Name(aHostName), aIndex, aAddress, aTtl); } @@ -468,9 +468,9 @@ exit: //--------------------------------------------------------------------------------------------------------------------- // Client::ServiceResponse -Error Client::ServiceResponse::GetServiceName(char * aLabelBuffer, +Error Client::ServiceResponse::GetServiceName(char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) const { Error error; @@ -493,10 +493,10 @@ Error Client::ServiceResponse::GetServiceInfo(ServiceInfo &aServiceInfo) const return FindServiceInfo(kAnswerSection, Name(*mQuery, kNameOffsetInQuery), aServiceInfo); } -Error Client::ServiceResponse::GetHostAddress(const char * aHostName, +Error Client::ServiceResponse::GetHostAddress(const char *aHostName, uint16_t aIndex, Ip6::Address &aAddress, - uint32_t & aTtl) const + uint32_t &aTtl) const { return FindHostAddress(kAdditionalDataSection, Name(aHostName), aIndex, aAddress, aTtl); } @@ -617,9 +617,9 @@ void Client::UpdateDefaultConfigAddress(void) } #endif -Error Client::ResolveAddress(const char * aHostName, +Error Client::ResolveAddress(const char *aHostName, AddressCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig) { QueryInfo info; @@ -632,9 +632,9 @@ Error Client::ResolveAddress(const char * aHostName, } #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE -Error Client::ResolveIp4Address(const char * aHostName, +Error Client::ResolveIp4Address(const char *aHostName, AddressCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig) { QueryInfo info; @@ -660,10 +660,10 @@ Error Client::Browse(const char *aServiceName, BrowseCallback aCallback, void *a return StartQuery(info, aConfig, nullptr, aServiceName, aContext); } -Error Client::ResolveService(const char * aInstanceLabel, - const char * aServiceName, +Error Client::ResolveService(const char *aInstanceLabel, + const char *aServiceName, ServiceCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig) { QueryInfo info; @@ -683,11 +683,11 @@ exit: #endif // OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE -Error Client::StartQuery(QueryInfo & aInfo, +Error Client::StartQuery(QueryInfo &aInfo, const QueryConfig *aConfig, - const char * aLabel, - const char * aName, - void * aContext) + const char *aLabel, + const char *aName, + void *aContext) { // This method assumes that `mQueryType` and `mCallback` to be // already set by caller on `aInfo`. The `aLabel` can be `nullptr` @@ -774,7 +774,7 @@ void Client::SendQuery(Query &aQuery, QueryInfo &aInfo, bool aUpdateTimer) // is handled by caller). Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; Header header; Ip6::MessageInfo messageInfo; @@ -871,7 +871,7 @@ void Client::FinalizeQuery(Query &aQuery, Error aError) void Client::FinalizeQuery(Response &aResponse, QueryType aType, Error aError) { Callback callback; - void * context; + void *context; GetCallback(*aResponse.mQuery, callback, context); @@ -919,7 +919,7 @@ void Client::GetCallback(const Query &aQuery, Callback &aCallback, void *&aConte Client::Query *Client::FindQueryById(uint16_t aMessageId) { - Query * matchedQuery = nullptr; + Query *matchedQuery = nullptr; QueryInfo info; for (Query &query : mQueries) diff --git a/src/core/net/dns_client.hpp b/src/core/net/dns_client.hpp index f4c9be6f8..2a187396b 100644 --- a/src/core/net/dns_client.hpp +++ b/src/core/net/dns_client.hpp @@ -164,7 +164,10 @@ public: * @returns The timeout interval in msec. * */ - uint32_t GetResponseTimeout(void) const { return mResponseTimeout; } + uint32_t GetResponseTimeout(void) const + { + return mResponseTimeout; + } /** * This method gets the maximum number of query transmit attempts before reporting failure. @@ -172,7 +175,10 @@ public: * @returns The maximum number of query transmit attempts. * */ - uint8_t GetMaxTxAttempts(void) const { return mMaxTxAttempts; } + uint8_t GetMaxTxAttempts(void) const + { + return mMaxTxAttempts; + } /** * This method gets the recursion flag indicating whether the server can resolve the query recursively or not. @@ -180,7 +186,10 @@ public: * @returns The recursion flag. * */ - RecursionFlag GetRecursionFlag(void) const { return static_cast(mRecursionFlag); } + RecursionFlag GetRecursionFlag(void) const + { + return static_cast(mRecursionFlag); + } #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE /** @@ -189,7 +198,10 @@ public: * @returns The NAT64 mode. * */ - Nat64Mode GetNat64Mode(void) const { return static_cast(mNat64Mode); } + Nat64Mode GetNat64Mode(void) const + { + return static_cast(mNat64Mode); + } #endif private: @@ -211,13 +223,28 @@ public: explicit QueryConfig(InitMode aMode); - Ip6::SockAddr &GetServerSockAddr(void) { return AsCoreType(&mServerSockAddr); } + Ip6::SockAddr &GetServerSockAddr(void) + { + return AsCoreType(&mServerSockAddr); + } - void SetResponseTimeout(uint32_t aResponseTimeout) { mResponseTimeout = aResponseTimeout; } - void SetMaxTxAttempts(uint8_t aMaxTxAttempts) { mMaxTxAttempts = aMaxTxAttempts; } - void SetRecursionFlag(RecursionFlag aFlag) { mRecursionFlag = static_cast(aFlag); } + void SetResponseTimeout(uint32_t aResponseTimeout) + { + mResponseTimeout = aResponseTimeout; + } + void SetMaxTxAttempts(uint8_t aMaxTxAttempts) + { + mMaxTxAttempts = aMaxTxAttempts; + } + void SetRecursionFlag(RecursionFlag aFlag) + { + mRecursionFlag = static_cast(aFlag); + } #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE - void SetNat64Mode(Nat64Mode aMode) { mNat64Mode = static_cast(aMode); } + void SetNat64Mode(Nat64Mode aMode) + { + mNat64Mode = static_cast(aMode); + } #endif void SetFrom(const QueryConfig &aConfig, const QueryConfig &aDefaultConfig); @@ -257,10 +284,10 @@ public: void SelectSection(Section aSection, uint16_t &aOffset, uint16_t &aNumRecord) const; Error CheckForHostNameAlias(Section aSection, Name &aHostName) const; Error FindHostAddress(Section aSection, - const Name & aHostName, + const Name &aHostName, uint16_t aIndex, Ip6::Address &aAddress, - uint32_t & aTtl) const; + uint32_t &aTtl) const; #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE Error FindARecord(Section aSection, const Name &aHostName, uint16_t aIndex, ARecord &aARecord) const; #endif @@ -269,8 +296,8 @@ public: Error FindServiceInfo(Section aSection, const Name &aName, ServiceInfo &aServiceInfo) const; #endif - Instance * mInstance; // The OpenThread instance. - Query * mQuery; // The associated query. + Instance *mInstance; // The OpenThread instance. + Query *mQuery; // The associated query. const Message *mMessage; // The response message. uint16_t mAnswerOffset; // Answer section offset in `mMessage`. uint16_t mAnswerRecordCount; // Number of records in answer section. @@ -486,9 +513,9 @@ public: * @retval kErrorNoBufs Either the label or name does not fit in the given buffers. * */ - Error GetServiceName(char * aLabelBuffer, + Error GetServiceName(char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) const; /** @@ -566,7 +593,10 @@ public: * @returns The current default query config. * */ - const QueryConfig &GetDefaultConfig(void) const { return mDefaultConfig; } + const QueryConfig &GetDefaultConfig(void) const + { + return mDefaultConfig; + } /** * This method sets the default query config. @@ -604,9 +634,9 @@ public: * @retval kErrorInvalidState Cannot send query since Thread interface is not up. * */ - Error ResolveAddress(const char * aHostName, + Error ResolveAddress(const char *aHostName, AddressCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig = nullptr); #if OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE @@ -631,9 +661,9 @@ public: * @retval kErrorInvalidState Cannot send query since Thread interface is not up, or there is no NAT64 prefix. * */ - Error ResolveIp4Address(const char * aHostName, + Error ResolveIp4Address(const char *aHostName, AddressCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig = nullptr); #endif @@ -655,9 +685,9 @@ public: * @retval kErrorNoBufs Insufficient buffer to prepare and send query. * */ - Error Browse(const char * aServiceName, + Error Browse(const char *aServiceName, BrowseCallback aCallback, - void * aContext, + void *aContext, const QueryConfig *aConfig = nullptr); /** @@ -678,11 +708,11 @@ public: * @retval kErrorInvalidArgs @p aInstanceLabel is `nullptr`. * */ - Error ResolveService(const char * aInstanceLabel, - const char * aServiceName, + Error ResolveService(const char *aInstanceLabel, + const char *aServiceName, otDnsServiceCallback aCallback, - void * aContext, - const QueryConfig * aConfig = nullptr); + void *aContext, + const QueryConfig *aConfig = nullptr); #endif // OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE @@ -717,7 +747,7 @@ private: QueryType mQueryType; uint16_t mMessageId; Callback mCallback; - void * mCallbackContext; + void *mCallbackContext; TimeMilli mRetransmissionTime; QueryConfig mConfig; uint8_t mTransmissionCount; @@ -726,20 +756,23 @@ private: static constexpr uint16_t kNameOffsetInQuery = sizeof(QueryInfo); - Error StartQuery(QueryInfo & aInfo, - const QueryConfig *aConfig, - const char * aLabel, - const char * aName, - void * aContext); - Error AllocateQuery(const QueryInfo &aInfo, const char *aLabel, const char *aName, Query *&aQuery); - void FreeQuery(Query &aQuery); - void UpdateQuery(Query &aQuery, const QueryInfo &aInfo) { aQuery.Write(0, aInfo); } + Error StartQuery(QueryInfo &aInfo, + const QueryConfig *aConfig, + const char *aLabel, + const char *aName, + void *aContext); + Error AllocateQuery(const QueryInfo &aInfo, const char *aLabel, const char *aName, Query *&aQuery); + void FreeQuery(Query &aQuery); + void UpdateQuery(Query &aQuery, const QueryInfo &aInfo) + { + aQuery.Write(0, aInfo); + } void SendQuery(Query &aQuery, QueryInfo &aInfo, bool aUpdateTimer); void FinalizeQuery(Query &aQuery, Error aError); void FinalizeQuery(Response &Response, QueryType aType, Error aError); static void GetCallback(const Query &aQuery, Callback &aCallback, void *&aContext); Error AppendNameFromQuery(const Query &aQuery, Message &aMessage); - Query * FindQueryById(uint16_t aMessageId); + Query *FindQueryById(uint16_t aMessageId); static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMsgInfo); void ProcessResponse(const Message &aMessage); Error ParseResponse(Response &aResponse, QueryType &aType, Error &aResponseError); diff --git a/src/core/net/dns_dso.cpp b/src/core/net/dns_dso.cpp index 49d090c44..b6d3648ed 100644 --- a/src/core/net/dns_dso.cpp +++ b/src/core/net/dns_dso.cpp @@ -81,9 +81,9 @@ extern "C" void otPlatDsoHandleDisconnected(otPlatDsoConnection *aConnection, ot //--------------------------------------------------------------------------------------------------------------------- // Dso::Connection -Dso::Connection::Connection(Instance & aInstance, +Dso::Connection::Connection(Instance &aInstance, const Ip6::SockAddr &aPeerSockAddr, - Callbacks & aCallbacks, + Callbacks &aCallbacks, uint32_t aInactivityTimeout, uint32_t aKeepAliveInterval) : InstanceLocator(aInstance) @@ -322,7 +322,7 @@ exit: Error Dso::Connection::SendRetryDelayMessage(uint32_t aDelay, Dns::Header::Response aResponseCode) { Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; RetryDelayTlv retryDelayTlv; MessageId messageId; @@ -412,7 +412,7 @@ Error Dso::Connection::SendKeepAliveMessage(MessageType aMessageType, MessageId // `kResponseMessage`. Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; KeepAliveTlv keepAliveTlv; switch (mState) @@ -480,9 +480,9 @@ exit: return error; } -Error Dso::Connection::SendMessage(Message & aMessage, +Error Dso::Connection::SendMessage(Message &aMessage, MessageType aMessageType, - MessageId & aMessageId, + MessageId &aMessageId, Dns::Header::Response aResponseCode, uint32_t aResponseTimeout) { @@ -788,7 +788,7 @@ exit: } Error Dso::Connection::ProcessRequestOrUnidirectionalMessage(const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Tlv::Type aPrimaryTlvType) { Error error = kErrorAbort; @@ -847,7 +847,7 @@ Error Dso::Connection::ProcessRequestOrUnidirectionalMessage(const Dns::Header & } Error Dso::Connection::ProcessResponseMessage(const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Tlv::Type aPrimaryTlvType) { Error error = kErrorAbort; @@ -1030,7 +1030,7 @@ exit: void Dso::Connection::SendErrorResponse(const Dns::Header &aHeader, Dns::Header::Response aResponseCode) { - Message * response = NewMessage(); + Message *response = NewMessage(); Dns::Header header; VerifyOrExit(response != nullptr); diff --git a/src/core/net/dns_dso.hpp b/src/core/net/dns_dso.hpp index 6ca02f9ef..6ab6800ce 100644 --- a/src/core/net/dns_dso.hpp +++ b/src/core/net/dns_dso.hpp @@ -306,7 +306,7 @@ public: * @retval kErrorAbort Fatal error (misbehavior by peer). This triggers aborting of the connection. * */ - typedef Error (&ProcessRequestMessage)(Connection & aConnection, + typedef Error (&ProcessRequestMessage)(Connection &aConnection, MessageId aMessageId, const Message &aMessage, Tlv::Type aPrimaryTlvType); @@ -329,7 +329,7 @@ public: * @p aPrimaryTlvType is not known in a unidirectional message, it is a fatal error. * */ - typedef Error (&ProcessUnidirectionalMessage)(Connection & aConnection, + typedef Error (&ProcessUnidirectionalMessage)(Connection &aConnection, const Message &aMessage, Tlv::Type aPrimaryTlvType); @@ -359,9 +359,9 @@ public: * @retval kErrorAbort Fatal error (misbehavior by peer). This triggers aborting of the connection. * */ - typedef Error (&ProcessResponseMessage)(Connection & aConnection, + typedef Error (&ProcessResponseMessage)(Connection &aConnection, const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Tlv::Type aResponseTlvType, Tlv::Type aRequestTlvType); /** @@ -412,9 +412,9 @@ public: * @param[in] aKeepAliveInterval The Keep Alive timeout interval (in msec). * */ - Connection(Instance & aInstance, + Connection(Instance &aInstance, const Ip6::SockAddr &aPeerSockAddr, - Callbacks & aCallbacks, + Callbacks &aCallbacks, uint32_t aInactivityTimeout = kDefaultTimeout, uint32_t aKeepAliveInterval = kDefaultTimeout); @@ -548,7 +548,7 @@ public: * @retval kErrorNoBufs Failed to allocate new buffer to prepare the message (append header or padding). * */ - Error SendRequestMessage(Message & aMessage, + Error SendRequestMessage(Message &aMessage, MessageId &aMessageId, uint32_t aResponseTimeout = kResponseTimeout); @@ -792,15 +792,15 @@ public: void MarkAsDisconnected(void); Error SendKeepAliveMessage(MessageType aMessageType, MessageId aResponseId); - Error SendMessage(Message & aMessage, + Error SendMessage(Message &aMessage, MessageType aMessageType, - MessageId & aMessageId, + MessageId &aMessageId, Dns::Header::Response aResponseCode = Dns::Header::kResponseSuccess, uint32_t aResponseTimeout = kResponseTimeout); void HandleReceive(Message &aMessage); Error ReadPrimaryTlv(const Message &aMessage, Tlv::Type &aPrimaryTlvType) const; Error ProcessRequestOrUnidirectionalMessage(const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Tlv::Type aPrimaryTlvType); Error ProcessResponseMessage(const Dns::Header &aHeader, const Message &aMessage, Tlv::Type aPrimaryTlvType); Error ProcessKeepAliveMessage(const Dns::Header &aHeader, const Message &aMessage); @@ -820,8 +820,8 @@ public: static const char *MessageTypeToString(MessageType aMessageType); static const char *DisconnectReasonToString(DisconnectReason aReason); - Connection * mNext; - Callbacks & mCallbacks; + Connection *mNext; + Callbacks &mCallbacks; Ip6::SockAddr mPeerSockAddr; State mState; MessageId mNextMessageId; diff --git a/src/core/net/dns_types.cpp b/src/core/net/dns_types.cpp index 04cefcb8d..ca7985ec9 100644 --- a/src/core/net/dns_types.cpp +++ b/src/core/net/dns_types.cpp @@ -739,11 +739,11 @@ exit: return error; } -Error ResourceRecord::FindRecord(const Message & aMessage, - uint16_t & aOffset, +Error ResourceRecord::FindRecord(const Message &aMessage, + uint16_t &aOffset, uint16_t aNumRecords, uint16_t aIndex, - const Name & aName, + const Name &aName, uint16_t aType, ResourceRecord &aRecord, uint16_t aMinRecordSize) @@ -798,8 +798,8 @@ exit: return error; } -Error ResourceRecord::ReadRecord(const Message & aMessage, - uint16_t & aOffset, +Error ResourceRecord::ReadRecord(const Message &aMessage, + uint16_t &aOffset, uint16_t aType, ResourceRecord &aRecord, uint16_t aMinRecordSize) @@ -832,9 +832,9 @@ exit: } Error ResourceRecord::ReadName(const Message &aMessage, - uint16_t & aOffset, + uint16_t &aOffset, uint16_t aStartOffset, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize, bool aSkipRecord) const { @@ -922,7 +922,7 @@ Error TxtEntry::Iterator::GetNextEntry(TxtEntry &aEntry) uint8_t length; uint8_t index; const char *cur; - char * keyBuffer = GetKeyBuffer(); + char *keyBuffer = GetKeyBuffer(); static_assert(sizeof(mChar) == TxtEntry::kMaxKeyLength + 1, "KeyBuffer cannot fit the max key length"); @@ -1104,10 +1104,10 @@ bool LeaseOption::IsValid(void) const } Error PtrRecord::ReadPtrName(const Message &aMessage, - uint16_t & aOffset, - char * aLabelBuffer, + uint16_t &aOffset, + char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) const { Error error = kErrorNone; @@ -1133,9 +1133,9 @@ exit: } Error TxtRecord::ReadTxtData(const Message &aMessage, - uint16_t & aOffset, - uint8_t * aTxtBuffer, - uint16_t & aTxtBufferSize) const + uint16_t &aOffset, + uint8_t *aTxtBuffer, + uint16_t &aTxtBufferSize) const { Error error = kErrorNone; diff --git a/src/core/net/dns_types.hpp b/src/core/net/dns_types.hpp index 0b90a29ef..0b3dc7625 100644 --- a/src/core/net/dns_types.hpp +++ b/src/core/net/dns_types.hpp @@ -1042,7 +1042,7 @@ private: { } - const char * mString; // String containing the name or `nullptr` if name is not from string. + const char *mString; // String containing the name or `nullptr` if name is not from string. const Message *mMessage; // Message containing the encoded name, or `nullptr` if `Name` is not from message. uint16_t mOffset; // Offset in `mMessage` to the start of name (used when name is from `mMessage`). }; @@ -1119,7 +1119,7 @@ public: uint16_t GetTxtDataPosition(void) const { return mData[kIndexTxtPosition]; } void SetTxtDataPosition(uint16_t aValue) { mData[kIndexTxtPosition] = aValue; } void IncreaseTxtDataPosition(uint16_t aIncrement) { mData[kIndexTxtPosition] += aIncrement; } - char * GetKeyBuffer(void) { return mChar; } + char *GetKeyBuffer(void) { return mChar; } const char *GetTxtDataEnd(void) const { return GetTxtData() + GetTxtDataLength(); } }; @@ -1405,11 +1405,11 @@ public: */ template static Error FindRecord(const Message &aMessage, - uint16_t & aOffset, + uint16_t &aOffset, uint16_t aNumRecords, uint16_t aIndex, - const Name & aName, - RecordType & aRecord) + const Name &aName, + RecordType &aRecord) { return FindRecord(aMessage, aOffset, aNumRecords, aIndex, aName, RecordType::kType, aRecord, sizeof(RecordType)); @@ -1456,9 +1456,9 @@ public: protected: Error ReadName(const Message &aMessage, - uint16_t & aOffset, + uint16_t &aOffset, uint16_t aStartOffset, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize, bool aSkipRecord) const; Error SkipRecord(const Message &aMessage, uint16_t &aOffset) const; @@ -1466,17 +1466,17 @@ protected: private: static constexpr uint16_t kType = kTypeAny; // This is intended for used by `ReadRecord()` only. - static Error FindRecord(const Message & aMessage, - uint16_t & aOffset, + static Error FindRecord(const Message &aMessage, + uint16_t &aOffset, uint16_t aNumRecords, uint16_t aIndex, - const Name & aName, + const Name &aName, uint16_t aType, ResourceRecord &aRecord, uint16_t aMinRecordSize); - static Error ReadRecord(const Message & aMessage, - uint16_t & aOffset, + static Error ReadRecord(const Message &aMessage, + uint16_t &aOffset, uint16_t aType, ResourceRecord &aRecord, uint16_t aMinRecordSize); @@ -1574,8 +1574,8 @@ public: * */ Error ReadCanonicalName(const Message &aMessage, - uint16_t & aOffset, - char * aNameBuffer, + uint16_t &aOffset, + char *aNameBuffer, uint16_t aNameBufferSize) const { return ResourceRecord::ReadName(aMessage, aOffset, /* aStartOffset */ aOffset - sizeof(CnameRecord), @@ -1661,10 +1661,10 @@ public: * */ Error ReadPtrName(const Message &aMessage, - uint16_t & aOffset, - char * aLabelBuffer, + uint16_t &aOffset, + char *aLabelBuffer, uint8_t aLabelBufferSize, - char * aNameBuffer, + char *aNameBuffer, uint16_t aNameBufferSize) const; } OT_TOOL_PACKED_END; @@ -1866,8 +1866,8 @@ public: * */ Error ReadTargetHostName(const Message &aMessage, - uint16_t & aOffset, - char * aNameBuffer, + uint16_t &aOffset, + char *aNameBuffer, uint16_t aNameBufferSize) const { return ResourceRecord::ReadName(aMessage, aOffset, /* aStartOffset */ aOffset - sizeof(SrvRecord), aNameBuffer, diff --git a/src/core/net/dnssd_server.cpp b/src/core/net/dnssd_server.cpp index bf9f0ff78..3b4d69577 100644 --- a/src/core/net/dnssd_server.cpp +++ b/src/core/net/dnssd_server.cpp @@ -142,7 +142,7 @@ exit: void Server::ProcessQuery(const Header &aRequestHeader, Message &aRequestMessage, const Ip6::MessageInfo &aMessageInfo) { Error error = kErrorNone; - Message * responseMessage = nullptr; + Message *responseMessage = nullptr; Header responseHeader; NameCompressInfo compressInfo(kDefaultDomainName); Header::Response response = Header::kResponseSuccess; @@ -199,9 +199,9 @@ exit: void Server::SendResponse(Header aHeader, Header::Response aResponseCode, - Message & aMessage, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - Ip6::Udp::Socket & aSocket) + Ip6::Udp::Socket &aSocket) { Error error; @@ -233,10 +233,10 @@ void Server::SendResponse(Header aHeader, UpdateResponseCounters(aResponseCode); } -Header::Response Server::AddQuestions(const Header & aRequestHeader, - const Message & aRequestMessage, - Header & aResponseHeader, - Message & aResponseMessage, +Header::Response Server::AddQuestions(const Header &aRequestHeader, + const Message &aRequestMessage, + Header &aResponseHeader, + Message &aResponseMessage, NameCompressInfo &aCompressInfo) { Question question; @@ -294,9 +294,9 @@ exit: return response; } -Error Server::AppendQuestion(const char * aName, - const Question & aQuestion, - Message & aMessage, +Error Server::AppendQuestion(const char *aName, + const Question &aQuestion, + Message &aMessage, NameCompressInfo &aCompressInfo) { Error error = kErrorNone; @@ -323,9 +323,9 @@ exit: return error; } -Error Server::AppendPtrRecord(Message & aMessage, - const char * aServiceName, - const char * aInstanceName, +Error Server::AppendPtrRecord(Message &aMessage, + const char *aServiceName, + const char *aInstanceName, uint32_t aTtl, NameCompressInfo &aCompressInfo) { @@ -350,9 +350,9 @@ exit: return error; } -Error Server::AppendSrvRecord(Message & aMessage, - const char * aInstanceName, - const char * aHostName, +Error Server::AppendSrvRecord(Message &aMessage, + const char *aInstanceName, + const char *aHostName, uint32_t aTtl, uint16_t aPriority, uint16_t aWeight, @@ -383,11 +383,11 @@ exit: return error; } -Error Server::AppendAaaaRecord(Message & aMessage, - const char * aHostName, +Error Server::AppendAaaaRecord(Message &aMessage, + const char *aHostName, const Ip6::Address &aAddress, uint32_t aTtl, - NameCompressInfo & aCompressInfo) + NameCompressInfo &aCompressInfo) { AaaaRecord aaaaRecord; Error error; @@ -496,9 +496,9 @@ exit: return error; } -Error Server::AppendTxtRecord(Message & aMessage, - const char * aInstanceName, - const void * aTxtData, +Error Server::AppendTxtRecord(Message &aMessage, + const char *aInstanceName, + const void *aTxtData, uint16_t aTxtLength, uint32_t aTtl, NameCompressInfo &aCompressInfo) @@ -658,8 +658,8 @@ exit: } #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE -Header::Response Server::ResolveBySrp(Header & aResponseHeader, - Message & aResponseMessage, +Header::Response Server::ResolveBySrp(Header &aResponseHeader, + Message &aResponseMessage, Server::NameCompressInfo &aCompressInfo) { Question question; @@ -703,10 +703,10 @@ exit: return response; } -Header::Response Server::ResolveQuestionBySrp(const char * aName, - const Question & aQuestion, - Header & aResponseHeader, - Message & aResponseMessage, +Header::Response Server::ResolveQuestionBySrp(const char *aName, + const Question &aQuestion, + Header &aResponseHeader, + Message &aResponseMessage, NameCompressInfo &aCompressInfo, bool aAdditional) { @@ -807,16 +807,16 @@ const Srp::Server::Host *Server::GetNextSrpHost(const Srp::Server::Host *aHost) return host; } -const Srp::Server::Service *Server::GetNextSrpService(const Srp::Server::Host & aHost, +const Srp::Server::Service *Server::GetNextSrpService(const Srp::Server::Host &aHost, const Srp::Server::Service *aService) { return aHost.FindNextService(aService, Srp::Server::kFlagsAnyTypeActiveService); } #endif // OPENTHREAD_CONFIG_SRP_SERVER_ENABLE -Error Server::ResolveByQueryCallbacks(Header & aResponseHeader, - Message & aResponseMessage, - NameCompressInfo & aCompressInfo, +Error Server::ResolveByQueryCallbacks(Header &aResponseHeader, + Message &aResponseMessage, + NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo) { QueryTransaction *query = nullptr; @@ -839,8 +839,8 @@ exit: return error; } -Server::QueryTransaction *Server::NewQuery(const Header & aResponseHeader, - Message & aResponseMessage, +Server::QueryTransaction *Server::NewQuery(const Header &aResponseHeader, + Message &aResponseMessage, const NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo) { @@ -866,8 +866,8 @@ exit: return newQuery; } -bool Server::CanAnswerQuery(const QueryTransaction & aQuery, - const char * aServiceFullName, +bool Server::CanAnswerQuery(const QueryTransaction &aQuery, + const char *aServiceFullName, const otDnssdServiceInstanceInfo &aInstanceInfo) { char name[Name::kMaxNameSize]; @@ -900,12 +900,12 @@ bool Server::CanAnswerQuery(const Server::QueryTransaction &aQuery, const char * return (sdType == kDnsQueryResolveHost) && StringMatch(name, aHostFullName, kStringCaseInsensitiveMatch); } -void Server::AnswerQuery(QueryTransaction & aQuery, - const char * aServiceFullName, +void Server::AnswerQuery(QueryTransaction &aQuery, + const char *aServiceFullName, const otDnssdServiceInstanceInfo &aInstanceInfo) { - Header & responseHeader = aQuery.GetResponseHeader(); - Message & responseMessage = aQuery.GetResponseMessage(); + Header &responseHeader = aQuery.GetResponseHeader(); + Message &responseMessage = aQuery.GetResponseMessage(); Error error = kErrorNone; NameCompressInfo &compressInfo = aQuery.GetNameCompressInfo(); @@ -960,8 +960,8 @@ exit: void Server::AnswerQuery(QueryTransaction &aQuery, const char *aHostFullName, const otDnssdHostInfo &aHostInfo) { - Header & responseHeader = aQuery.GetResponseHeader(); - Message & responseMessage = aQuery.GetResponseMessage(); + Header &responseHeader = aQuery.GetResponseHeader(); + Message &responseMessage = aQuery.GetResponseMessage(); Error error = kErrorNone; NameCompressInfo &compressInfo = aQuery.GetNameCompressInfo(); @@ -987,7 +987,7 @@ exit: void Server::SetQueryCallbacks(otDnssdQuerySubscribeCallback aSubscribe, otDnssdQueryUnsubscribeCallback aUnsubscribe, - void * aContext) + void *aContext) { OT_ASSERT((aSubscribe == nullptr) == (aUnsubscribe == nullptr)); @@ -996,7 +996,7 @@ void Server::SetQueryCallbacks(otDnssdQuerySubscribeCallback aSubscribe, mQueryCallbackContext = aContext; } -void Server::HandleDiscoveredServiceInstance(const char * aServiceFullName, +void Server::HandleDiscoveredServiceInstance(const char *aServiceFullName, const otDnssdServiceInstanceInfo &aInstanceInfo) { OT_ASSERT(StringEndsWith(aServiceFullName, Name::kLabelSeperatorChar)); @@ -1056,7 +1056,7 @@ Server::DnsQueryType Server::GetQueryTypeAndName(const otDnssdQuery *aQuery, cha return GetQueryTypeAndName(query->GetResponseHeader(), query->GetResponseMessage(), aName); } -Server::DnsQueryType Server::GetQueryTypeAndName(const Header & aHeader, +Server::DnsQueryType Server::GetQueryTypeAndName(const Header &aHeader, const Message &aMessage, char (&aName)[Name::kMaxNameSize]) { @@ -1197,11 +1197,11 @@ void Server::FinalizeQuery(QueryTransaction &aQuery, Header::Response aResponseC aQuery.Finalize(aResponseCode, mSocket); } -void Server::QueryTransaction::Init(const Header & aResponseHeader, - Message & aResponseMessage, +void Server::QueryTransaction::Init(const Header &aResponseHeader, + Message &aResponseMessage, const NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo, - Instance & aInstance) + Instance &aInstance) { OT_ASSERT(mResponseMessage == nullptr); diff --git a/src/core/net/dnssd_server.hpp b/src/core/net/dnssd_server.hpp index 088b875b1..869b73a46 100644 --- a/src/core/net/dnssd_server.hpp +++ b/src/core/net/dnssd_server.hpp @@ -122,7 +122,7 @@ public: */ void SetQueryCallbacks(otDnssdQuerySubscribeCallback aSubscribe, otDnssdQueryUnsubscribeCallback aUnsubscribe, - void * aContext); + void *aContext); /** * This method notifies a discovered service instance. @@ -297,23 +297,23 @@ private: { } - void Init(const Header & aResponseHeader, - Message & aResponseMessage, + void Init(const Header &aResponseHeader, + Message &aResponseMessage, const NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo, - Instance & aInstance); + Instance &aInstance); bool IsValid(void) const { return mResponseMessage != nullptr; } const Ip6::MessageInfo &GetMessageInfo(void) const { return mMessageInfo; } - const Header & GetResponseHeader(void) const { return mResponseHeader; } - Header & GetResponseHeader(void) { return mResponseHeader; } - const Message & GetResponseMessage(void) const { return *mResponseMessage; } - Message & GetResponseMessage(void) { return *mResponseMessage; } + const Header &GetResponseHeader(void) const { return mResponseHeader; } + Header &GetResponseHeader(void) { return mResponseHeader; } + const Message &GetResponseMessage(void) const { return *mResponseMessage; } + Message &GetResponseMessage(void) { return *mResponseMessage; } TimeMilli GetStartTime(void) const { return mStartTime; } - NameCompressInfo & GetNameCompressInfo(void) { return mCompressInfo; }; + NameCompressInfo &GetNameCompressInfo(void) { return mCompressInfo; }; void Finalize(Header::Response aResponseMessage, Ip6::Udp::Socket &aSocket); Header mResponseHeader; - Message * mResponseMessage; + Message *mResponseMessage; NameCompressInfo mCompressInfo; Ip6::MessageInfo mMessageInfo; TimeMilli mStartTime; @@ -325,39 +325,39 @@ private: static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo); void HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); void ProcessQuery(const Header &aRequestHeader, Message &aRequestMessage, const Ip6::MessageInfo &aMessageInfo); - static Header::Response AddQuestions(const Header & aRequestHeader, - const Message & aRequestMessage, - Header & aResponseHeader, - Message & aResponseMessage, + static Header::Response AddQuestions(const Header &aRequestHeader, + const Message &aRequestMessage, + Header &aResponseHeader, + Message &aResponseMessage, NameCompressInfo &aCompressInfo); - static Error AppendQuestion(const char * aName, - const Question & aQuestion, - Message & aMessage, + static Error AppendQuestion(const char *aName, + const Question &aQuestion, + Message &aMessage, NameCompressInfo &aCompressInfo); - static Error AppendPtrRecord(Message & aMessage, - const char * aServiceName, - const char * aInstanceName, + static Error AppendPtrRecord(Message &aMessage, + const char *aServiceName, + const char *aInstanceName, uint32_t aTtl, NameCompressInfo &aCompressInfo); - static Error AppendSrvRecord(Message & aMessage, - const char * aInstanceName, - const char * aHostName, + static Error AppendSrvRecord(Message &aMessage, + const char *aInstanceName, + const char *aHostName, uint32_t aTtl, uint16_t aPriority, uint16_t aWeight, uint16_t aPort, NameCompressInfo &aCompressInfo); - static Error AppendTxtRecord(Message & aMessage, - const char * aInstanceName, - const void * aTxtData, + static Error AppendTxtRecord(Message &aMessage, + const char *aInstanceName, + const void *aTxtData, uint16_t aTxtLength, uint32_t aTtl, NameCompressInfo &aCompressInfo); - static Error AppendAaaaRecord(Message & aMessage, - const char * aHostName, + static Error AppendAaaaRecord(Message &aMessage, + const char *aHostName, const Ip6::Address &aAddress, uint32_t aTtl, - NameCompressInfo & aCompressInfo); + NameCompressInfo &aCompressInfo); static Error AppendServiceName(Message &aMessage, const char *aName, NameCompressInfo &aCompressInfo); static Error AppendInstanceName(Message &aMessage, const char *aName, NameCompressInfo &aCompressInfo); static Error AppendHostName(Message &aMessage, const char *aName, NameCompressInfo &aCompressInfo); @@ -366,42 +366,42 @@ private: static Error FindPreviousLabel(const char *aName, uint8_t &aStart, uint8_t &aStop); void SendResponse(Header aHeader, Header::Response aResponseCode, - Message & aMessage, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, - Ip6::Udp::Socket & aSocket); + Ip6::Udp::Socket &aSocket); #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE - Header::Response ResolveBySrp(Header & aResponseHeader, - Message & aResponseMessage, + Header::Response ResolveBySrp(Header &aResponseHeader, + Message &aResponseMessage, Server::NameCompressInfo &aCompressInfo); - Header::Response ResolveQuestionBySrp(const char * aName, - const Question & aQuestion, - Header & aResponseHeader, - Message & aResponseMessage, + Header::Response ResolveQuestionBySrp(const char *aName, + const Question &aQuestion, + Header &aResponseHeader, + Message &aResponseMessage, NameCompressInfo &aCompressInfo, bool aAdditional); - const Srp::Server::Host * GetNextSrpHost(const Srp::Server::Host *aHost); - static const Srp::Server::Service *GetNextSrpService(const Srp::Server::Host & aHost, + const Srp::Server::Host *GetNextSrpHost(const Srp::Server::Host *aHost); + static const Srp::Server::Service *GetNextSrpService(const Srp::Server::Host &aHost, const Srp::Server::Service *aService); #endif - Error ResolveByQueryCallbacks(Header & aResponseHeader, - Message & aResponseMessage, - NameCompressInfo & aCompressInfo, + Error ResolveByQueryCallbacks(Header &aResponseHeader, + Message &aResponseMessage, + NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo); - QueryTransaction *NewQuery(const Header & aResponseHeader, - Message & aResponseMessage, + QueryTransaction *NewQuery(const Header &aResponseHeader, + Message &aResponseMessage, const NameCompressInfo &aCompressInfo, const Ip6::MessageInfo &aMessageInfo); - static bool CanAnswerQuery(const QueryTransaction & aQuery, - const char * aServiceFullName, + static bool CanAnswerQuery(const QueryTransaction &aQuery, + const char *aServiceFullName, const otDnssdServiceInstanceInfo &aInstanceInfo); - void AnswerQuery(QueryTransaction & aQuery, - const char * aServiceFullName, + void AnswerQuery(QueryTransaction &aQuery, + const char *aServiceFullName, const otDnssdServiceInstanceInfo &aInstanceInfo); static bool CanAnswerQuery(const Server::QueryTransaction &aQuery, const char *aHostFullName); void AnswerQuery(QueryTransaction &aQuery, const char *aHostFullName, const otDnssdHostInfo &aHostInfo); void FinalizeQuery(QueryTransaction &aQuery, Header::Response aResponseCode); - static DnsQueryType GetQueryTypeAndName(const Header & aHeader, + static DnsQueryType GetQueryTypeAndName(const Header &aHeader, const Message &aMessage, char (&aName)[Name::kMaxNameSize]); static bool HasQuestion(const Header &aHeader, const Message &aMessage, const char *aName, uint16_t aQuestionType); @@ -421,7 +421,7 @@ private: Ip6::Udp::Socket mSocket; QueryTransaction mQueryTransactions[kMaxConcurrentQueries]; - void * mQueryCallbackContext; + void *mQueryCallbackContext; otDnssdQuerySubscribeCallback mQuerySubscribe; otDnssdQueryUnsubscribeCallback mQueryUnsubscribe; ServerTimer mTimer; diff --git a/src/core/net/icmp6.cpp b/src/core/net/icmp6.cpp index 93542f688..431bed35d 100644 --- a/src/core/net/icmp6.cpp +++ b/src/core/net/icmp6.cpp @@ -103,7 +103,7 @@ Error Icmp::SendError(Header::Type aType, Header::Code aCode, const MessageInfo { Error error = kErrorNone; MessageInfo messageInfoLocal; - Message * message = nullptr; + Message *message = nullptr; Header icmp6Header; Message::Settings settings(Message::kWithLinkSecurity, Message::kPriorityNet); @@ -186,7 +186,7 @@ Error Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMess { Error error = kErrorNone; Header icmp6Header; - Message * replyMessage = nullptr; + Message *replyMessage = nullptr; MessageInfo replyMessageInfo; uint16_t payloadLength; diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index e6e011712..ccd5d5e49 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -112,7 +112,7 @@ exit: Message *Ip6::NewMessage(const uint8_t *aData, uint16_t aDataLength) { - Message * message = nullptr; + Message *message = nullptr; Message::Priority priority; SuccessOrExit(GetDatagramPriority(aData, aDataLength, priority)); @@ -624,7 +624,7 @@ Error Ip6::FragmentDatagram(Message &aMessage, uint8_t aIpProto) Error error = kErrorNone; Header header; FragmentHeader fragmentHeader; - Message * fragment = nullptr; + Message *fragment = nullptr; uint16_t fragmentCnt = 0; uint16_t payloadFragment = 0; uint16_t offset = 0; @@ -702,7 +702,7 @@ Error Ip6::HandleFragment(Message &aMessage, MessageOrigin aOrigin, MessageInfo Error error = kErrorNone; Header header, headerBuffer; FragmentHeader fragmentHeader; - Message * message = nullptr; + Message *message = nullptr; uint16_t offset = 0; uint16_t payloadFragment = 0; int assertValue = 0; @@ -895,12 +895,12 @@ exit: } #endif // OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE -Error Ip6::HandleExtensionHeaders(Message & aMessage, +Error Ip6::HandleExtensionHeaders(Message &aMessage, MessageOrigin aOrigin, - MessageInfo & aMessageInfo, - Header & aHeader, - uint8_t & aNextHeader, - bool & aReceive) + MessageInfo &aMessageInfo, + Header &aHeader, + uint8_t &aNextHeader, + bool &aReceive) { Error error = kErrorNone; bool isOutbound = (aOrigin != kFromThreadNetif); @@ -944,9 +944,9 @@ exit: return error; } -Error Ip6::HandlePayload(Header & aIp6Header, - Message & aMessage, - MessageInfo & aMessageInfo, +Error Ip6::HandlePayload(Header &aIp6Header, + Message &aMessage, + MessageInfo &aMessageInfo, uint8_t aIpProto, Message::Ownership aMessageOwnership) { @@ -1013,7 +1013,7 @@ exit: return error; } -Error Ip6::ProcessReceiveCallback(Message & aMessage, +Error Ip6::ProcessReceiveCallback(Message &aMessage, MessageOrigin aOrigin, const MessageInfo &aMessageInfo, uint8_t aIpProto, @@ -1272,7 +1272,7 @@ start: } } error = HandlePayload(header, aMessage, messageInfo, nextHeader, - (forwardThread || forwardHost ? Message::kCopyToUse : Message::kTakeCustody)); + (forwardThread || forwardHost ? Message::kCopyToUse : Message::kTakeCustody)); shouldFreeMessage = forwardThread || forwardHost; } @@ -1382,7 +1382,7 @@ bool Ip6::ShouldForwardToThread(const MessageInfo &aMessageInfo, MessageOrigin a const Netif::UnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo) { - Address * destination = &aMessageInfo.GetPeerAddr(); + Address *destination = &aMessageInfo.GetPeerAddr(); uint8_t destinationScope = destination->GetScope(); const bool destinationIsRoutingLocator = Get().IsRoutingLocator(*destination); const Netif::UnicastAddress *rvalAddr = nullptr; diff --git a/src/core/net/ip6.hpp b/src/core/net/ip6.hpp index 94449d26b..0287cda99 100644 --- a/src/core/net/ip6.hpp +++ b/src/core/net/ip6.hpp @@ -227,9 +227,9 @@ public: * @retval kErrorParse Encountered a malformed header when processing the message. * */ - Error HandleDatagram(Message & aMessage, + Error HandleDatagram(Message &aMessage, MessageOrigin aOrigin, - const void * aLinkMessageInfo = nullptr, + const void *aLinkMessageInfo = nullptr, bool aIsReassembled = false); /** @@ -272,7 +272,10 @@ public: * @sa SetReceiveIp6FilterEnabled * */ - bool IsReceiveIp6FilterEnabled(void) const { return mIsReceiveIp6FilterEnabled; } + bool IsReceiveIp6FilterEnabled(void) const + { + return mIsReceiveIp6FilterEnabled; + } /** * This method sets whether or not Thread control traffic is filtered out when delivering IPv6 datagrams @@ -284,7 +287,10 @@ public: * @sa IsReceiveIp6FilterEnabled * */ - void SetReceiveIp6FilterEnabled(bool aEnabled) { mIsReceiveIp6FilterEnabled = aEnabled; } + void SetReceiveIp6FilterEnabled(bool aEnabled) + { + mIsReceiveIp6FilterEnabled = aEnabled; + } /** * This method indicates whether or not IPv6 forwarding is enabled. @@ -292,7 +298,10 @@ public: * @returns TRUE if IPv6 forwarding is enabled, FALSE otherwise. * */ - bool IsForwardingEnabled(void) const { return mForwardingEnabled; } + bool IsForwardingEnabled(void) const + { + return mForwardingEnabled; + } /** * This method enables/disables IPv6 forwarding. @@ -300,7 +309,10 @@ public: * @param[in] aEnable TRUE to enable IPv6 forwarding, FALSE otherwise. * */ - void SetForwardingEnabled(bool aEnable) { mForwardingEnabled = aEnable; } + void SetForwardingEnabled(bool aEnable) + { + mForwardingEnabled = aEnable; + } /** * This method perform default source address selection. @@ -318,7 +330,10 @@ public: * @returns A reference to the send queue. * */ - const PriorityQueue &GetSendQueue(void) const { return mSendQueue; } + const PriorityQueue &GetSendQueue(void) const + { + return mSendQueue; + } /** * This static method converts an IP protocol number to a string. @@ -347,7 +362,10 @@ public: * @returns A reference to the Border Routing counters. * */ - const otBorderRoutingCounters &GetBorderRoutingCounters(void) const { return mBorderRoutingCounters; } + const otBorderRoutingCounters &GetBorderRoutingCounters(void) const + { + return mBorderRoutingCounters; + } /** * This method returns a reference to the Border Routing counters. @@ -355,13 +373,19 @@ public: * @returns A reference to the Border Routing counters. * */ - otBorderRoutingCounters &GetBorderRoutingCounters(void) { return mBorderRoutingCounters; } + otBorderRoutingCounters &GetBorderRoutingCounters(void) + { + return mBorderRoutingCounters; + } /** * This method resets the Border Routing counters. * */ - void ResetBorderRoutingCounters(void) { memset(&mBorderRoutingCounters, 0, sizeof(mBorderRoutingCounters)); } + void ResetBorderRoutingCounters(void) + { + memset(&mBorderRoutingCounters, 0, sizeof(mBorderRoutingCounters)); + } #endif private: @@ -376,18 +400,18 @@ private: static Error GetDatagramPriority(const uint8_t *aData, uint16_t aDataLen, Message::Priority &aPriority); void EnqueueDatagram(Message &aMessage); - Error ProcessReceiveCallback(Message & aMessage, + Error ProcessReceiveCallback(Message &aMessage, MessageOrigin aOrigin, const MessageInfo &aMessageInfo, uint8_t aIpProto, bool aAllowReceiveFilter, Message::Ownership aMessageOwnership); - Error HandleExtensionHeaders(Message & aMessage, + Error HandleExtensionHeaders(Message &aMessage, MessageOrigin aOrigin, - MessageInfo & aMessageInfo, - Header & aHeader, - uint8_t & aNextHeader, - bool & aReceive); + MessageInfo &aMessageInfo, + Header &aHeader, + uint8_t &aNextHeader, + bool &aReceive); Error FragmentDatagram(Message &aMessage, uint8_t aIpProto); Error HandleFragment(Message &aMessage, MessageOrigin aOrigin, MessageInfo &aMessageInfo); #if OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE @@ -401,9 +425,9 @@ private: Error InsertMplOption(Message &aMessage, Header &aHeader, MessageInfo &aMessageInfo); Error RemoveMplOption(Message &aMessage); Error HandleOptions(Message &aMessage, Header &aHeader, bool aIsOutbound, bool &aReceive); - Error HandlePayload(Header & aIp6Header, - Message & aMessage, - MessageInfo & aMessageInfo, + Error HandlePayload(Header &aIp6Header, + Message &aMessage, + MessageInfo &aMessageInfo, uint8_t aIpProto, Message::Ownership aMessageOwnership); bool ShouldForwardToThread(const MessageInfo &aMessageInfo, MessageOrigin aOrigin) const; @@ -417,11 +441,11 @@ private: bool mForwardingEnabled; bool mIsReceiveIp6FilterEnabled; otIp6ReceiveCallback mReceiveIp6DatagramCallback; - void * mReceiveIp6DatagramCallbackContext; + void *mReceiveIp6DatagramCallbackContext; #if OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE otNat64ReceiveIp4Callback mReceiveIp4DatagramCallback; - void * mReceiveIp4DatagramCallbackContext; + void *mReceiveIp4DatagramCallbackContext; #endif PriorityQueue mSendQueue; diff --git a/src/core/net/ip6_mpl.hpp b/src/core/net/ip6_mpl.hpp index e1fbdf7b6..e406d4826 100644 --- a/src/core/net/ip6_mpl.hpp +++ b/src/core/net/ip6_mpl.hpp @@ -231,7 +231,10 @@ public: * @returns A reference to the buffered message set. * */ - const MessageQueue &GetBufferedMessageSet(void) const { return mBufferedMessageSet; } + const MessageQueue &GetBufferedMessageSet(void) const + { + return mBufferedMessageSet; + } #endif private: diff --git a/src/core/net/nat64_translator.cpp b/src/core/net/nat64_translator.cpp index e6df3e62a..2dc82f15c 100644 --- a/src/core/net/nat64_translator.cpp +++ b/src/core/net/nat64_translator.cpp @@ -98,7 +98,7 @@ Translator::Result Translator::TranslateFromIp6(Message &aMessage) ErrorCounters::Reason dropReason = ErrorCounters::kUnknown; Ip6::Header ip6Header; Ip4::Header ip4Header; - AddressMapping * mapping = nullptr; + AddressMapping *mapping = nullptr; if (mIp4Cidr.mLength == 0 || !mNat64Prefix.IsValidNat64()) { @@ -185,7 +185,7 @@ Translator::Result Translator::TranslateToIp6(Message &aMessage) ErrorCounters::Reason dropReason = ErrorCounters::kUnknown; Ip6::Header ip6Header; Ip4::Header ip4Header; - AddressMapping * mapping = nullptr; + AddressMapping *mapping = nullptr; // Ip6::Header::ParseFrom may return an error value when the incoming message is an IPv4 datagram. // If the message is already an IPv6 datagram, forward it directly. diff --git a/src/core/net/nd6.cpp b/src/core/net/nd6.cpp index 78c7d8353..d7c5031c7 100644 --- a/src/core/net/nd6.cpp +++ b/src/core/net/nd6.cpp @@ -215,7 +215,7 @@ Option *RouterAdvertMessage::AppendOption(uint16_t aOptionSize) // returns `nullptr`. The returned option needs to be // initialized and populated by the caller. - Option * option = nullptr; + Option *option = nullptr; uint32_t newLength = mData.GetLength(); newLength += aOptionSize; @@ -249,7 +249,7 @@ exit: return error; } -Error RouterAdvertMessage::AppendRouteInfoOption(const Prefix & aPrefix, +Error RouterAdvertMessage::AppendRouteInfoOption(const Prefix &aPrefix, uint32_t aRouteLifetime, RoutePreference aPreference) { diff --git a/src/core/net/nd6.hpp b/src/core/net/nd6.hpp index 275f5b6b2..8a084a917 100644 --- a/src/core/net/nd6.hpp +++ b/src/core/net/nd6.hpp @@ -156,7 +156,7 @@ private: private: static const Option *Next(const Option *aOption); void Advance(void); - const Option * Validate(const Option *aOption) const; + const Option *Validate(const Option *aOption) const; const Option *mOption; const Option *mEnd; @@ -446,7 +446,7 @@ private: static constexpr uint8_t kPreferenceOffset = 3; static constexpr uint8_t kPreferenceMask = 3 << kPreferenceOffset; - uint8_t * GetPrefixBytes(void) { return AsNonConst(AsConst(this)->GetPrefixBytes()); } + uint8_t *GetPrefixBytes(void) { return AsNonConst(AsConst(this)->GetPrefixBytes()); } const uint8_t *GetPrefixBytes(void) const { return reinterpret_cast(this) + sizeof(*this); } uint8_t mPrefixLength; // The prefix length in bits. @@ -669,7 +669,7 @@ public: private: const uint8_t *GetOptionStart(void) const { return (mData.GetBytes() + sizeof(Header)); } const uint8_t *GetDataEnd(void) const { return mData.GetBytes() + mData.GetLength(); } - Option * AppendOption(uint16_t aOptionSize); + Option *AppendOption(uint16_t aOptionSize); Data mData; uint16_t mMaxLength; diff --git a/src/core/net/netif.cpp b/src/core/net/netif.cpp index a55914f83..4a41a5c56 100644 --- a/src/core/net/netif.cpp +++ b/src/core/net/netif.cpp @@ -169,7 +169,7 @@ exit: void Netif::UnsubscribeAllNodesMulticast(void) { - MulticastAddress * prev; + MulticastAddress *prev; const MulticastAddress &linkLocalAllNodesAddress = AsCoreType(&AsNonConst(kLinkLocalAllNodesMulticastAddress)); // The tail of multicast address linked list contains the diff --git a/src/core/net/netif.hpp b/src/core/net/netif.hpp index 650135593..1e53755fa 100644 --- a/src/core/net/netif.hpp +++ b/src/core/net/netif.hpp @@ -305,7 +305,7 @@ public: Iterator end(void) { return Iterator(mNetif, Iterator::kEndIterator); } private: - const Netif & mNetif; + const Netif &mNetif; Address::TypeFilter mFilter; }; @@ -322,7 +322,7 @@ public: void AdvanceFrom(const MulticastAddress *aAddr); void Advance(void) { AdvanceFrom(mItem->GetNext()); } - const Netif & mNetif; + const Netif &mNetif; Address::TypeFilter mFilter; }; @@ -333,7 +333,10 @@ public: * @returns The current Multicast Listener Registration state. * */ - MlrState GetMlrState(void) const { return mMlrState; } + MlrState GetMlrState(void) const + { + return mMlrState; + } /** * This method sets the Multicast Listener Registration (MLR) state. @@ -341,11 +344,17 @@ public: * @param[in] aState The new Multicast Listener Registration state. * */ - void SetMlrState(MlrState aState) { mMlrState = aState; } + void SetMlrState(MlrState aState) + { + mMlrState = aState; + } #endif private: - ExternalMulticastAddress *GetNext(void) { return static_cast(AsNonConst(mNext)); } + ExternalMulticastAddress *GetNext(void) + { + return static_cast(AsNonConst(mNext)); + } #if OPENTHREAD_CONFIG_MLR_ENABLE MlrState mMlrState; @@ -375,7 +384,10 @@ public: * @returns The linked list of unicast addresses. * */ - const LinkedList &GetUnicastAddresses(void) const { return mUnicastAddresses; } + const LinkedList &GetUnicastAddresses(void) const + { + return mUnicastAddresses; + } /** * This method adds a unicast address to the network interface. @@ -423,7 +435,10 @@ public: * @retval FALSE If @p aAddress is not assigned to the network interface. * */ - bool HasUnicastAddress(const UnicastAddress &aAddress) const { return mUnicastAddresses.Contains(aAddress); } + bool HasUnicastAddress(const UnicastAddress &aAddress) const + { + return mUnicastAddresses.Contains(aAddress); + } /** * This method indicates whether a unicast address is an external or internal address. @@ -502,7 +517,10 @@ public: * @returns The linked list of multicast addresses. * */ - const LinkedList &GetMulticastAddresses(void) const { return mMulticastAddresses; } + const LinkedList &GetMulticastAddresses(void) const + { + return mMulticastAddresses; + } /** * This method indicates whether a multicast address is an external or internal address. @@ -581,7 +599,10 @@ public: * @retval FALSE If the multicast promiscuous mode is disabled. * */ - bool IsMulticastPromiscuousEnabled(void) const { return mMulticastPromiscuous; } + bool IsMulticastPromiscuousEnabled(void) const + { + return mMulticastPromiscuous; + } /** * This method enables multicast promiscuous mode on the network interface. @@ -589,7 +610,10 @@ public: * @param[in] aEnabled TRUE if Multicast Promiscuous mode is enabled, FALSE otherwise. * */ - void SetMulticastPromiscuous(bool aEnabled) { mMulticastPromiscuous = aEnabled; } + void SetMulticastPromiscuous(bool aEnabled) + { + mMulticastPromiscuous = aEnabled; + } /** * This method enables range-based `for` loop iteration over external multicast addresses on the Netif that matches @@ -624,7 +648,10 @@ public: * @retval FALSE The network interface is not subscribed to any external multicast address. * */ - bool HasAnyExternalMulticastAddress(void) const { return !ExternalMulticastAddress::Iterator(*this).IsDone(); } + bool HasAnyExternalMulticastAddress(void) const + { + return !ExternalMulticastAddress::Iterator(*this).IsDone(); + } protected: /** @@ -649,7 +676,7 @@ private: bool mMulticastPromiscuous; otIp6AddressCallback mAddressCallback; - void * mAddressCallbackContext; + void *mAddressCallbackContext; Pool mExtUnicastAddressPool; Pool mExtMulticastAddressPool; diff --git a/src/core/net/sntp_client.cpp b/src/core/net/sntp_client.cpp index 01d796e45..2bfccf5cc 100644 --- a/src/core/net/sntp_client.cpp +++ b/src/core/net/sntp_client.cpp @@ -128,8 +128,8 @@ Error Client::Query(const otSntpQuery *aQuery, otSntpResponseHandler aHandler, v { Error error; QueryMetadata queryMetadata(aHandler, aContext); - Message * message = nullptr; - Message * messageCopy = nullptr; + Message *message = nullptr; + Message *messageCopy = nullptr; Header header; const Ip6::MessageInfo *messageInfo; @@ -256,7 +256,7 @@ Message *Client::FindRelatedQuery(const Header &aResponseHeader, QueryMetadata & return matchedMessage; } -void Client::FinalizeSntpTransaction(Message & aQuery, +void Client::FinalizeSntpTransaction(Message &aQuery, const QueryMetadata &aQueryMetadata, uint64_t aTime, Error aResult) @@ -326,7 +326,7 @@ void Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessag Error error = kErrorNone; Header responseHeader; QueryMetadata queryMetadata; - Message * message = nullptr; + Message *message = nullptr; uint64_t unixTime = 0; SuccessOrExit(aMessage.Read(aMessage.GetOffset(), responseHeader)); diff --git a/src/core/net/sntp_client.hpp b/src/core/net/sntp_client.hpp index 8f4917a30..f8338d58c 100644 --- a/src/core/net/sntp_client.hpp +++ b/src/core/net/sntp_client.hpp @@ -440,7 +440,7 @@ public: private: uint32_t mTransmitTimestamp; ///< Time at the client when the request departed for the server. otSntpResponseHandler mResponseHandler; ///< A function pointer that is called on response reception. - void * mResponseContext; ///< A pointer to arbitrary context information. + void *mResponseContext; ///< A pointer to arbitrary context information. TimeMilli mTransmissionTime; ///< Time when the timer should shoot for this message. Ip6::Address mSourceAddress; ///< IPv6 address of the message source. Ip6::Address mDestinationAddress; ///< IPv6 address of the message destination. diff --git a/src/core/net/srp_client.cpp b/src/core/net/srp_client.cpp index 085509401..1b9275110 100644 --- a/src/core/net/srp_client.cpp +++ b/src/core/net/srp_client.cpp @@ -1686,7 +1686,7 @@ Error Client::ProcessOptRecord(const Message &aMessage, uint16_t aOffset, const while (len > 0) { Dns::LeaseOption leaseOption; - Dns::Option & option = leaseOption; + Dns::Option &option = leaseOption; uint16_t size; SuccessOrExit(error = aMessage.Read(aOffset, option)); diff --git a/src/core/net/srp_client.hpp b/src/core/net/srp_client.hpp index d7182e800..e74817a08 100644 --- a/src/core/net/srp_client.hpp +++ b/src/core/net/srp_client.hpp @@ -413,7 +413,10 @@ public: * Note that a call to `Stop()` will also disable the auto-start mode. * */ - void DisableAutoStartMode(void) { mAutoStart.SetState(AutoStart::kDisabled); } + void DisableAutoStartMode(void) + { + mAutoStart.SetState(AutoStart::kDisabled); + } /** * This method indicates the current state of auto-start mode (enabled or disabled). @@ -421,7 +424,10 @@ public: * @returns TRUE if the auto-start mode is enabled, FALSE otherwise. * */ - bool IsAutoStartModeEnabled(void) const { return mAutoStart.GetState() != AutoStart::kDisabled; } + bool IsAutoStartModeEnabled(void) const + { + return mAutoStart.GetState() != AutoStart::kDisabled; + } /** * This method indicates whether or not the current SRP server's address is selected by auto-start. @@ -429,7 +435,10 @@ public: * @returns TRUE if the SRP server's address is selected by auto-start, FALSE otherwise. * */ - bool IsServerSelectedByAutoStart(void) const { return mAutoStart.HasSelectedServer(); } + bool IsServerSelectedByAutoStart(void) const + { + return mAutoStart.HasSelectedServer(); + } #endif // OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE /** @@ -438,7 +447,10 @@ public: * @returns TRUE if the SRP client is running, FALSE otherwise. * */ - bool IsRunning(void) const { return (mState != kStateStopped); } + bool IsRunning(void) const + { + return (mState != kStateStopped); + } /** * This method gets the socket address (IPv6 address and port number) of the SRP server which is being used by SRP @@ -449,7 +461,10 @@ public: * @returns The SRP server's socket address. * */ - const Ip6::SockAddr &GetServerAddress(void) const { return mSocket.GetPeerName(); } + const Ip6::SockAddr &GetServerAddress(void) const + { + return mSocket.GetPeerName(); + } /** * This method sets the callback used to notify caller of events/changes. @@ -474,7 +489,10 @@ public: * @returns The TTL (in seconds). * */ - uint32_t GetTtl(void) const { return mTtl; } + uint32_t GetTtl(void) const + { + return mTtl; + } /** * This method sets the TTL used in SRP update requests. @@ -486,7 +504,10 @@ public: * lease interval. * */ - void SetTtl(uint32_t aTtl) { mTtl = aTtl; } + void SetTtl(uint32_t aTtl) + { + mTtl = aTtl; + } /** * This method gets the lease interval used in SRP update requests. @@ -497,7 +518,10 @@ public: * @returns The lease interval (in seconds). * */ - uint32_t GetLeaseInterval(void) const { return mDefaultLease; } + uint32_t GetLeaseInterval(void) const + { + return mDefaultLease; + } /** * This method sets the lease interval used in SRP update requests. @@ -508,7 +532,10 @@ public: * @param[in] aInterval The lease interval (in seconds). If zero, the default value `kDefaultLease` would be used. * */ - void SetLeaseInterval(uint32_t aInterval) { mDefaultLease = DetermineLeaseInterval(aInterval, kDefaultLease); } + void SetLeaseInterval(uint32_t aInterval) + { + mDefaultLease = DetermineLeaseInterval(aInterval, kDefaultLease); + } /** * This method gets the key lease interval used in SRP update requests. @@ -516,7 +543,10 @@ public: * @returns The key lease interval (in seconds). * */ - uint32_t GetKeyLeaseInterval(void) const { return mDefaultKeyLease; } + uint32_t GetKeyLeaseInterval(void) const + { + return mDefaultKeyLease; + } /** * This method sets the key lease interval used in SRP update requests. @@ -539,7 +569,10 @@ public: * @returns A reference to host info structure. * */ - const HostInfo &GetHostInfo(void) const { return mHostInfo; } + const HostInfo &GetHostInfo(void) const + { + return mHostInfo; + } /** * This method sets the host name label. @@ -659,7 +692,10 @@ public: * @returns The list of services. * */ - const LinkedList &GetServices(void) const { return mServices; } + const LinkedList &GetServices(void) const + { + return mServices; + } /** * This method starts the remove process of the host info and all services. @@ -713,7 +749,10 @@ public: * @returns The domain name string. * */ - const char *GetDomainName(void) const { return mDomainName; } + const char *GetDomainName(void) const + { + return mDomainName; + } /** * This method sets the domain name to be used by SRP client. @@ -756,7 +795,10 @@ public: * @param[in] aEnabled TRUE to enable, FALSE to disable the "service key record inclusion" mode. * */ - void SetServiceKeyRecordEnabled(bool aEnabled) { mServiceKeyRecordEnabled = aEnabled; } + void SetServiceKeyRecordEnabled(bool aEnabled) + { + mServiceKeyRecordEnabled = aEnabled; + } /** * This method indicates whether the "service key record inclusion" mode is enabled or disabled. @@ -764,7 +806,10 @@ public: * @returns TRUE if "service key record inclusion" mode is enabled, FALSE otherwise. * */ - bool IsServiceKeyRecordEnabled(void) const { return mServiceKeyRecordEnabled; } + bool IsServiceKeyRecordEnabled(void) const + { + return mServiceKeyRecordEnabled; + } #endif // OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE private: @@ -929,9 +974,15 @@ private: void InvokeCallback(const Ip6::SockAddr *aServerSockAddr) const; #if OPENTHREAD_CONFIG_SRP_CLIENT_SWITCH_SERVER_ON_FAILURE - uint8_t GetTimoutFailureCount(void) const { return mTimoutFailureCount; } - void ResetTimoutFailureCount(void) { mTimoutFailureCount = 0; } - void IncrementTimoutFailureCount(void) + uint8_t GetTimoutFailureCount(void) const + { + return mTimoutFailureCount; + } + void ResetTimoutFailureCount(void) + { + mTimoutFailureCount = 0; + } + void IncrementTimoutFailureCount(void) { if (mTimoutFailureCount < NumericLimits::kMax) { @@ -946,7 +997,7 @@ private: static const char *StateToString(State aState); AutoStartCallback mCallback; - void * mContext; + void *mContext; State mState; uint8_t mAnycastSeqNum; #if OPENTHREAD_CONFIG_SRP_CLIENT_SWITCH_SERVER_ON_FAILURE @@ -965,15 +1016,18 @@ private: Crypto::Ecdsa::P256::KeyPair mKeyPair; // The ECDSA key pair. }; - Error Start(const Ip6::SockAddr &aServerSockAddr, Requester aRequester); - void Stop(Requester aRequester, StopMode aMode); - void Resume(void); - void Pause(void); - void HandleNotifierEvents(Events aEvents); - void HandleRoleChanged(void); - Error UpdateHostInfoStateOnAddressChange(void); - void UpdateServiceStateToRemove(Service &aService); - State GetState(void) const { return mState; } + Error Start(const Ip6::SockAddr &aServerSockAddr, Requester aRequester); + void Stop(Requester aRequester, StopMode aMode); + void Resume(void); + void Pause(void); + void HandleNotifierEvents(Events aEvents); + void HandleRoleChanged(void); + Error UpdateHostInfoStateOnAddressChange(void); + void UpdateServiceStateToRemove(Service &aService); + State GetState(void) const + { + return mState; + } void SetState(State aState); void ChangeHostAndServiceStates(const ItemState *aNewStates, ServiceStateChangeMode aMode); void InvokeCallback(Error aError) const; @@ -1000,13 +1054,19 @@ private: static Error ReadResourceRecord(const Message &aMessage, uint16_t &aOffset, Dns::ResourceRecord &aRecord); Error ProcessOptRecord(const Message &aMessage, uint16_t aOffset, const Dns::OptRecord &aOptRecord); void UpdateState(void); - uint32_t GetRetryWaitInterval(void) const { return mRetryWaitInterval; } - void ResetRetryWaitInterval(void) { mRetryWaitInterval = kMinRetryWaitInterval; } - void GrowRetryWaitInterval(void); - uint32_t DetermineLeaseInterval(uint32_t aInterval, uint32_t aDefaultInterval) const; - uint32_t DetermineTtl(void) const; - bool ShouldRenewEarly(const Service &aService) const; - void HandleTimer(void); + uint32_t GetRetryWaitInterval(void) const + { + return mRetryWaitInterval; + } + void ResetRetryWaitInterval(void) + { + mRetryWaitInterval = kMinRetryWaitInterval; + } + void GrowRetryWaitInterval(void); + uint32_t DetermineLeaseInterval(uint32_t aInterval, uint32_t aDefaultInterval) const; + uint32_t DetermineTtl(void) const; + bool ShouldRenewEarly(const Service &aService) const; + void HandleTimer(void); #if OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE void ProcessAutoStart(void); Error SelectUnicastEntry(DnsSrpUnicast::Origin aOrigin, DnsSrpUnicast::Info &aInfo) const; @@ -1019,7 +1079,9 @@ private: static const char *StateToString(State aState); void LogRetryWaitInterval(void) const; #else - void LogRetryWaitInterval(void) const {} + void LogRetryWaitInterval(void) const + { + } #endif static const char kDefaultDomainName[]; @@ -1050,8 +1112,8 @@ private: Ip6::Udp::Socket mSocket; Callback mCallback; - void * mCallbackContext; - const char * mDomainName; + void *mCallbackContext; + const char *mDomainName; HostInfo mHostInfo; LinkedList mServices; DelayTimer mTimer; diff --git a/src/core/net/srp_server.cpp b/src/core/net/srp_server.cpp index 154d99701..88058ccf1 100644 --- a/src/core/net/srp_server.cpp +++ b/src/core/net/srp_server.cpp @@ -443,13 +443,13 @@ void Server::CommitSrpUpdate(Error aError, UpdateMetadata &aUpdateMetadata) } void Server::CommitSrpUpdate(Error aError, - Host & aHost, + Host &aHost, const Dns::UpdateHeader &aDnsHeader, - const Ip6::MessageInfo * aMessageInfo, - const TtlConfig & aTtlConfig, - const LeaseConfig & aLeaseConfig) + const Ip6::MessageInfo *aMessageInfo, + const TtlConfig &aTtlConfig, + const LeaseConfig &aLeaseConfig) { - Host * existingHost; + Host *existingHost; uint32_t hostLease; uint32_t hostKeyLease; uint32_t grantedLease; @@ -828,8 +828,8 @@ exit: return error; } -Error Server::ProcessHostDescriptionInstruction(Host & aHost, - const Message & aMessage, +Error Server::ProcessHostDescriptionInstruction(Host &aHost, + const Message &aMessage, const MessageMetadata &aMetadata) const { Error error; @@ -914,8 +914,8 @@ exit: return error; } -Error Server::ProcessServiceDiscoveryInstructions(Host & aHost, - const Message & aMessage, +Error Server::ProcessServiceDiscoveryInstructions(Host &aHost, + const Message &aMessage, const MessageMetadata &aMetadata) const { Error error = kErrorNone; @@ -926,8 +926,8 @@ Error Server::ProcessServiceDiscoveryInstructions(Host & aHost, char serviceName[Dns::Name::kMaxNameSize]; char instanceName[Dns::Name::kMaxNameSize]; Dns::PtrRecord ptrRecord; - const char * subServiceName; - Service * service; + const char *subServiceName; + Service *service; bool isSubType; SuccessOrExit(error = Dns::Name::ReadName(aMessage, offset, serviceName, sizeof(serviceName))); @@ -992,8 +992,8 @@ exit: return error; } -Error Server::ProcessServiceDescriptionInstructions(Host & aHost, - const Message & aMessage, +Error Server::ProcessServiceDescriptionInstructions(Host &aHost, + const Message &aMessage, MessageMetadata &aMetadata) const { Error error = kErrorNone; @@ -1183,12 +1183,12 @@ exit: } Error Server::VerifySignature(const Dns::Ecdsa256KeyRecord &aKeyRecord, - const Message & aMessage, + const Message &aMessage, Dns::UpdateHeader aDnsHeader, uint16_t aSigOffset, uint16_t aSigRdataOffset, uint16_t aSigRdataLength, - const char * aSignerName) const + const char *aSignerName) const { Error error; uint16_t offset = aMessage.GetOffset(); @@ -1196,7 +1196,7 @@ Error Server::VerifySignature(const Dns::Ecdsa256KeyRecord &aKeyRecord, Crypto::Sha256 sha256; Crypto::Sha256::Hash hash; Crypto::Ecdsa::P256::Signature signature; - Message * signerNameMessage = nullptr; + Message *signerNameMessage = nullptr; VerifyOrExit(aSigRdataLength >= Crypto::Ecdsa::P256::Signature::kSize, error = kErrorInvalidArgs); @@ -1396,12 +1396,12 @@ exit: return; } -void Server::SendResponse(const Dns::UpdateHeader & aHeader, +void Server::SendResponse(const Dns::UpdateHeader &aHeader, Dns::UpdateHeader::Response aResponseCode, - const Ip6::MessageInfo & aMessageInfo) + const Ip6::MessageInfo &aMessageInfo) { Error error; - Message * response = nullptr; + Message *response = nullptr; Dns::UpdateHeader header; response = GetSocket().NewMessage(0); @@ -1437,10 +1437,10 @@ exit: void Server::SendResponse(const Dns::UpdateHeader &aHeader, uint32_t aLease, uint32_t aKeyLease, - const Ip6::MessageInfo & aMessageInfo) + const Ip6::MessageInfo &aMessageInfo) { Error error; - Message * response = nullptr; + Message *response = nullptr; Dns::UpdateHeader header; Dns::OptRecord optRecord; Dns::LeaseOption leaseOption; @@ -1503,10 +1503,10 @@ Error Server::ProcessMessage(Message &aMessage, const Ip6::MessageInfo &aMessage return ProcessMessage(aMessage, TimerMilli::GetNow(), mTtlConfig, mLeaseConfig, &aMessageInfo); } -Error Server::ProcessMessage(Message & aMessage, +Error Server::ProcessMessage(Message &aMessage, TimeMilli aRxTime, - const TtlConfig & aTtlConfig, - const LeaseConfig & aLeaseConfig, + const TtlConfig &aTtlConfig, + const LeaseConfig &aLeaseConfig, const Ip6::MessageInfo *aMessageInfo) { Error error; @@ -1534,7 +1534,7 @@ void Server::HandleLeaseTimer(void) { TimeMilli now = TimerMilli::GetNow(); TimeMilli earliestExpireTime = now.GetDistantFuture(); - Host * nextHost; + Host *nextHost; for (Host *host = mHosts.GetHead(); host != nullptr; host = nextHost) { @@ -2015,8 +2015,8 @@ exit: const Server::Service *Server::Host::FindNextService(const Service *aPrevService, Service::Flags aFlags, - const char * aServiceName, - const char * aInstanceName) const + const char *aServiceName, + const char *aInstanceName) const { const Service *service = (aPrevService == nullptr) ? GetServices().GetHead() : aPrevService->GetNext(); @@ -2048,7 +2048,7 @@ Server::Service *Server::Host::AddNewService(const char *aServiceName, bool aIsSubType, TimeMilli aUpdateTime) { - Service * service = nullptr; + Service *service = nullptr; RetainPtr desc(FindServiceDescription(aInstanceName)); if (desc == nullptr) diff --git a/src/core/net/srp_server.hpp b/src/core/net/srp_server.hpp index 0ddd3be02..37e5fa633 100644 --- a/src/core/net/srp_server.hpp +++ b/src/core/net/srp_server.hpp @@ -407,7 +407,7 @@ public: Description *mNext; Heap::String mInstanceName; - Host * mHost; + Host *mHost; Heap::Data mTxtData; uint16_t mPriority; uint16_t mWeight; @@ -435,7 +435,7 @@ public: Heap::String mServiceName; RetainPtr mDescription; - Service * mNext; + Service *mNext; TimeMilli mUpdateTime; bool mIsDeleted : 1; bool mIsSubType : 1; @@ -570,8 +570,8 @@ public: */ const Service *FindNextService(const Service *aPrevService, Service::Flags aFlags = kFlagsAnyService, - const char * aServiceName = nullptr, - const char * aInstanceName = nullptr) const; + const char *aServiceName = nullptr, + const char *aInstanceName = nullptr) const; /** * This method tells whether the host matches a given full name. @@ -595,7 +595,7 @@ public: Error ProcessTtl(uint32_t aTtl); LinkedList &GetServices(void) { return mServices; } - Service * AddNewService(const char *aServiceName, + Service *AddNewService(const char *aServiceName, const char *aInstanceName, bool aIsSubType, TimeMilli aUpdateTime); @@ -608,12 +608,12 @@ public: bool HasServiceInstance(const char *aInstanceName) const; RetainPtr FindServiceDescription(const char *aInstanceName); const RetainPtr FindServiceDescription(const char *aInstanceName) const; - Service * FindService(const char *aServiceName, const char *aInstanceName); - const Service * FindService(const char *aServiceName, const char *aInstanceName) const; - Service * FindBaseService(const char *aInstanceName); - const Service * FindBaseService(const char *aInstanceName) const; + Service *FindService(const char *aServiceName, const char *aInstanceName); + const Service *FindService(const char *aServiceName, const char *aInstanceName) const; + Service *FindBaseService(const char *aInstanceName); + const Service *FindBaseService(const char *aInstanceName) const; - Host * mNext; + Host *mNext; Heap::String mFullName; Heap::Array mAddresses; @@ -729,7 +729,10 @@ public: * @returns A pointer to the dot-joined domain string. * */ - const char *GetDomain(void) const { return mDomain.AsCString(); } + const char *GetDomain(void) const + { + return mDomain.AsCString(); + } /** * This method sets the domain on the SRP server. @@ -753,7 +756,10 @@ public: * @returns The SRP server's address mode. * */ - AddressMode GetAddressMode(void) const { return mAddressMode; } + AddressMode GetAddressMode(void) const + { + return mAddressMode; + } /** * This method sets the address mode to be used by the SRP server. @@ -774,7 +780,10 @@ public: * @returns The anycast sequence number. * */ - uint8_t GetAnycastModeSequenceNumber(void) const { return mAnycastSequenceNumber; } + uint8_t GetAnycastModeSequenceNumber(void) const + { + return mAnycastSequenceNumber; + } /** * This method sets the sequence number used with anycast address mode. @@ -793,7 +802,10 @@ public: * @returns The state of the server. * */ - State GetState(void) const { return mState; } + State GetState(void) const + { + return mState; + } /** * This method tells the port the SRP server is listening to. @@ -801,7 +813,10 @@ public: * @returns The port of the server or 0 if the SRP server is not running. * */ - uint16_t GetPort(void) const { return (mState == kStateRunning) ? mPort : 0; } + uint16_t GetPort(void) const + { + return (mState == kStateRunning) ? mPort : 0; + } /** * This method enables/disables the SRP server. @@ -837,7 +852,10 @@ public: * @retval FALSE The auto-enable mode is disabled. * */ - bool IsAutoEnableMode(void) const { return mAutoEnable; } + bool IsAutoEnableMode(void) const + { + return mAutoEnable; + } #endif /** @@ -846,7 +864,10 @@ public: * @param[out] aTtlConfig A reference to the `TtlConfig` instance. * */ - void GetTtlConfig(TtlConfig &aTtlConfig) const { aTtlConfig = mTtlConfig; } + void GetTtlConfig(TtlConfig &aTtlConfig) const + { + aTtlConfig = mTtlConfig; + } /** * This method sets the TTL configuration. @@ -865,7 +886,10 @@ public: * @param[out] aLeaseConfig A reference to the `LeaseConfig` instance. * */ - void GetLeaseConfig(LeaseConfig &aLeaseConfig) const { aLeaseConfig = mLeaseConfig; } + void GetLeaseConfig(LeaseConfig &aLeaseConfig) const + { + aLeaseConfig = mLeaseConfig; + } /** * This method sets the LEASE and KEY-LEASE configurations. @@ -898,7 +922,10 @@ public: * @returns A pointer to the response counters of the SRP server. * */ - const otSrpServerResponseCounters *GetResponseCounters(void) const { return &mResponseCounters; } + const otSrpServerResponseCounters *GetResponseCounters(void) const + { + return &mResponseCounters; + } /** * This method receives the service update result from service handler set by @@ -955,23 +982,23 @@ private: TimeMilli GetExpireTime(void) const { return mExpireTime; } const Dns::UpdateHeader &GetDnsHeader(void) const { return mDnsHeader; } ServiceUpdateId GetId(void) const { return mId; } - const TtlConfig & GetTtlConfig(void) const { return mTtlConfig; } - const LeaseConfig & GetLeaseConfig(void) const { return mLeaseConfig; } - Host & GetHost(void) { return mHost; } - const Ip6::MessageInfo & GetMessageInfo(void) const { return mMessageInfo; } + const TtlConfig &GetTtlConfig(void) const { return mTtlConfig; } + const LeaseConfig &GetLeaseConfig(void) const { return mLeaseConfig; } + Host &GetHost(void) { return mHost; } + const Ip6::MessageInfo &GetMessageInfo(void) const { return mMessageInfo; } bool IsDirectRxFromClient(void) const { return mIsDirectRxFromClient; } bool Matches(ServiceUpdateId aId) const { return mId == aId; } private: UpdateMetadata(Instance &aInstance, Host &aHost, const MessageMetadata &aMessageMetadata); - UpdateMetadata * mNext; + UpdateMetadata *mNext; TimeMilli mExpireTime; Dns::UpdateHeader mDnsHeader; ServiceUpdateId mId; // The ID of this service update transaction. TtlConfig mTtlConfig; // TTL config to use when processing the message. LeaseConfig mLeaseConfig; // Lease config to use when processing the message. - Host & mHost; // The `UpdateMetadata` has no ownership of this host. + Host &mHost; // The `UpdateMetadata` has no ownership of this host. Ip6::MessageInfo mMessageInfo; // Valid when `mIsDirectRxFromClient` is true. bool mIsDirectRxFromClient; }; @@ -991,40 +1018,43 @@ private: void HandleNetDataPublisherEvent(NetworkData::Publisher::Event aEvent); - ServiceUpdateId AllocateId(void) { return mServiceUpdateId++; } + ServiceUpdateId AllocateId(void) + { + return mServiceUpdateId++; + } void InformUpdateHandlerOrCommit(Error aError, Host &aHost, const MessageMetadata &aMetadata); void CommitSrpUpdate(Error aError, Host &aHost, const MessageMetadata &aMessageMetadata); void CommitSrpUpdate(Error aError, UpdateMetadata &aUpdateMetadata); void CommitSrpUpdate(Error aError, - Host & aHost, + Host &aHost, const Dns::UpdateHeader &aDnsHeader, - const Ip6::MessageInfo * aMessageInfo, - const TtlConfig & aTtlConfig, - const LeaseConfig & aLeaseConfig); + const Ip6::MessageInfo *aMessageInfo, + const TtlConfig &aTtlConfig, + const LeaseConfig &aLeaseConfig); Error ProcessMessage(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - Error ProcessMessage(Message & aMessage, + Error ProcessMessage(Message &aMessage, TimeMilli aRxTime, - const TtlConfig & aTtlConfig, - const LeaseConfig & aLeaseConfig, + const TtlConfig &aTtlConfig, + const LeaseConfig &aLeaseConfig, const Ip6::MessageInfo *aMessageInfo); void ProcessDnsUpdate(Message &aMessage, MessageMetadata &aMetadata); Error ProcessUpdateSection(Host &aHost, const Message &aMessage, MessageMetadata &aMetadata) const; Error ProcessAdditionalSection(Host *aHost, const Message &aMessage, MessageMetadata &aMetadata) const; Error VerifySignature(const Dns::Ecdsa256KeyRecord &aKeyRecord, - const Message & aMessage, + const Message &aMessage, Dns::UpdateHeader aDnsHeader, uint16_t aSigOffset, uint16_t aSigRdataOffset, uint16_t aSigRdataLength, - const char * aSignerName) const; + const char *aSignerName) const; Error ValidateServiceSubTypes(Host &aHost, const MessageMetadata &aMetadata); Error ProcessZoneSection(const Message &aMessage, MessageMetadata &aMetadata) const; - Error ProcessHostDescriptionInstruction(Host & aHost, - const Message & aMessage, + Error ProcessHostDescriptionInstruction(Host &aHost, + const Message &aMessage, const MessageMetadata &aMetadata) const; - Error ProcessServiceDiscoveryInstructions(Host & aHost, - const Message & aMessage, + Error ProcessServiceDiscoveryInstructions(Host &aHost, + const Message &aMessage, const MessageMetadata &aMetadata) const; Error ProcessServiceDescriptionInstructions(Host &aHost, const Message &aMessage, MessageMetadata &aMetadata) const; @@ -1034,13 +1064,13 @@ private: void AddHost(Host &aHost); void RemoveHost(Host *aHost, RetainName aRetainName, NotifyMode aNotifyServiceHandler); bool HasNameConflictsWith(Host &aHost) const; - void SendResponse(const Dns::UpdateHeader & aHeader, + void SendResponse(const Dns::UpdateHeader &aHeader, Dns::UpdateHeader::Response aResponseCode, - const Ip6::MessageInfo & aMessageInfo); + const Ip6::MessageInfo &aMessageInfo); void SendResponse(const Dns::UpdateHeader &aHeader, uint32_t aLease, uint32_t aKeyLease, - const Ip6::MessageInfo & aMessageInfo); + const Ip6::MessageInfo &aMessageInfo); static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo); void HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); void HandleLeaseTimer(void); @@ -1049,7 +1079,7 @@ private: void HandleServiceUpdateResult(UpdateMetadata *aUpdate, Error aError); const UpdateMetadata *FindOutstandingUpdate(const MessageMetadata &aMessageMetadata) const; - static const char * AddressModeToString(AddressMode aMode); + static const char *AddressModeToString(AddressMode aMode); void UpdateResponseCounters(Dns::Header::Response aResponseCode); @@ -1058,7 +1088,7 @@ private: Ip6::Udp::Socket mSocket; otSrpServerServiceUpdateHandler mServiceUpdateHandler; - void * mServiceUpdateHandlerContext; + void *mServiceUpdateHandlerContext; Heap::String mDomain; diff --git a/src/core/net/tcp6.cpp b/src/core/net/tcp6.cpp index 0b9ac475a..e866001cf 100644 --- a/src/core/net/tcp6.cpp +++ b/src/core/net/tcp6.cpp @@ -172,7 +172,7 @@ exit: Error Tcp::Endpoint::Connect(const SockAddr &aSockName, uint32_t aFlags) { Error error = kErrorNone; - struct tcpcb & tp = GetTcb(); + struct tcpcb &tp = GetTcb(); struct sockaddr_in6 sin6p; OT_UNUSED_VARIABLE(aFlags); @@ -630,7 +630,7 @@ Error Tcp::HandleMessage(ot::Ip6::Header &aIp6Header, Message &aMessage, Message uint8_t headerSize; struct ip6_hdr *ip6Header; - struct tcphdr * tcpHeader; + struct tcphdr *tcpHeader; Endpoint *endpoint; Endpoint *endpointPrev; @@ -660,7 +660,7 @@ Error Tcp::HandleMessage(ot::Ip6::Header &aIp6Header, Message &aMessage, Message { struct tcplp_signals sig; int nextAction; - struct tcpcb * tp = &endpoint->GetTcb(); + struct tcpcb *tp = &endpoint->GetTcb(); otLinkedBuffer *priorHead = lbuf_head(&tp->sendbuf); size_t priorBacklog = endpoint->GetSendBufferBytes() - endpoint->GetInFlightBytes(); @@ -691,8 +691,8 @@ exit: return error; } -void Tcp::ProcessSignals(Endpoint & aEndpoint, - otLinkedBuffer * aPriorHead, +void Tcp::ProcessSignals(Endpoint &aEndpoint, + otLinkedBuffer *aPriorHead, size_t aPriorBacklog, struct tcplp_signals &aSignals) { @@ -944,7 +944,7 @@ extern "C" { otMessage *tcplp_sys_new_message(otInstance *aInstance) { Instance &instance = AsCoreType(aInstance); - Message * message = instance.Get().NewMessage(0); + Message *message = instance.Get().NewMessage(0); if (message) { @@ -963,8 +963,8 @@ void tcplp_sys_free_message(otInstance *aInstance, otMessage *aMessage) void tcplp_sys_send_message(otInstance *aInstance, otMessage *aMessage, otMessageInfo *aMessageInfo) { - Instance & instance = AsCoreType(aInstance); - Message & message = AsCoreType(aMessage); + Instance &instance = AsCoreType(aInstance); + Message &message = AsCoreType(aMessage); MessageInfo &info = AsCoreType(aMessageInfo); LogDebg("Sending TCP segment: payload_size = %d", static_cast(message.GetLength())); @@ -996,11 +996,11 @@ void tcplp_sys_stop_timer(struct tcpcb *aTcb, uint8_t aTimerFlag) struct tcpcb *tcplp_sys_accept_ready(struct tcpcb_listen *aTcbListen, struct in6_addr *aAddr, uint16_t aPort) { - Tcp::Listener & listener = Tcp::Listener::FromTcbListen(*aTcbListen); - Tcp & tcp = listener.Get(); - struct tcpcb * rv = (struct tcpcb *)-1; + Tcp::Listener &listener = Tcp::Listener::FromTcbListen(*aTcbListen); + Tcp &tcp = listener.Get(); + struct tcpcb *rv = (struct tcpcb *)-1; otSockAddr addr; - otTcpEndpoint * endpointPtr; + otTcpEndpoint *endpointPtr; otTcpIncomingConnectionAction action; VerifyOrExit(listener.mAcceptReadyCallback != nullptr); @@ -1042,13 +1042,13 @@ exit: } bool tcplp_sys_accepted_connection(struct tcpcb_listen *aTcbListen, - struct tcpcb * aAccepted, - struct in6_addr * aAddr, + struct tcpcb *aAccepted, + struct in6_addr *aAddr, uint16_t aPort) { Tcp::Listener &listener = Tcp::Listener::FromTcbListen(*aTcbListen); Tcp::Endpoint &endpoint = Tcp::Endpoint::FromTcb(*aAccepted); - Tcp & tcp = endpoint.Get(); + Tcp &tcp = endpoint.Get(); bool accepted = true; if (listener.mAcceptDoneCallback != nullptr) @@ -1132,9 +1132,9 @@ void tcplp_sys_panic(const char *aFormat, ...) OT_ASSERT(false); } -bool tcplp_sys_autobind(otInstance * aInstance, +bool tcplp_sys_autobind(otInstance *aInstance, const otSockAddr *aPeer, - otSockAddr * aToBind, + otSockAddr *aToBind, bool aBindAddress, bool aBindPort) { diff --git a/src/core/net/tcp6.hpp b/src/core/net/tcp6.hpp index 01c163f2d..f3abdc117 100644 --- a/src/core/net/tcp6.hpp +++ b/src/core/net/tcp6.hpp @@ -400,9 +400,9 @@ public: size_t GetInFlightBytes(void) const; size_t GetBacklogBytes(void) const; - Address & GetLocalIp6Address(void); + Address &GetLocalIp6Address(void); const Address &GetLocalIp6Address(void) const; - Address & GetForeignIp6Address(void); + Address &GetForeignIp6Address(void); const Address &GetForeignIp6Address(void) const; bool Matches(const MessageInfo &aMessageInfo) const; }; @@ -529,7 +529,7 @@ public: bool IsClosed(void) const; private: - Address & GetLocalIp6Address(void); + Address &GetLocalIp6Address(void); const Address &GetLocalIp6Address(void) const; bool Matches(const MessageInfo &aMessageInfo) const; }; @@ -678,8 +678,8 @@ private: static constexpr uint8_t kReceiveAvailableCallbackFlag = (1 << 3); static constexpr uint8_t kDisconnectedCallbackFlag = (1 << 4); - void ProcessSignals(Endpoint & aEndpoint, - otLinkedBuffer * aPriorHead, + void ProcessSignals(Endpoint &aEndpoint, + otLinkedBuffer *aPriorHead, size_t aPriorBacklog, struct tcplp_signals &aSignals); diff --git a/src/core/net/tcp6_ext.cpp b/src/core/net/tcp6_ext.cpp index a344373fa..bcb7a642f 100644 --- a/src/core/net/tcp6_ext.cpp +++ b/src/core/net/tcp6_ext.cpp @@ -55,9 +55,9 @@ void TcpCircularSendBuffer::Initialize(void *aDataBuffer, size_t aCapacity) } Error TcpCircularSendBuffer::Write(Tcp::Endpoint &aEndpoint, - const void * aData, + const void *aData, size_t aLength, - size_t & aWritten, + size_t &aWritten, uint32_t aFlags) { Error error = kErrorNone; diff --git a/src/core/net/udp6.hpp b/src/core/net/udp6.hpp index 0ddb60cc1..d517040cb 100644 --- a/src/core/net/udp6.hpp +++ b/src/core/net/udp6.hpp @@ -471,7 +471,10 @@ public: * @returns If the UDP socket is open. * */ - bool IsOpen(const SocketHandle &aSocket) const { return mSockets.Contains(aSocket); } + bool IsOpen(const SocketHandle &aSocket) const + { + return mSockets.Contains(aSocket); + } /** * This method binds a UDP socket. @@ -583,7 +586,10 @@ public: * @returns A pointer to the head of UDP Socket linked list. * */ - SocketHandle *GetUdpSockets(void) { return mSockets.GetHead(); } + SocketHandle *GetUdpSockets(void) + { + return mSockets.GetHead(); + } #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE /** @@ -652,7 +658,7 @@ private: SocketHandle *mPrevBackboneSockets; #endif #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE - void * mUdpForwarderContext; + void *mUdpForwarderContext; otUdpForwarder mUdpForwarder; #endif }; diff --git a/src/core/radio/radio.hpp b/src/core/radio/radio.hpp index e47a74b31..0cf958fb0 100644 --- a/src/core/radio/radio.hpp +++ b/src/core/radio/radio.hpp @@ -638,7 +638,7 @@ public: */ Error ConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, const Mac::ShortAddress &aShortAddress, - const Mac::ExtAddress & aExtAddress) + const Mac::ExtAddress &aExtAddress) { return otPlatRadioConfigureEnhAckProbing(GetInstancePtr(), aLinkMetrics, aShortAddress, &aExtAddress); } @@ -658,7 +658,10 @@ public: } private: - otInstance *GetInstancePtr(void) const { return reinterpret_cast(&InstanceLocator::GetInstance()); } + otInstance *GetInstancePtr(void) const + { + return reinterpret_cast(&InstanceLocator::GetInstance()); + } Callbacks mCallbacks; }; diff --git a/src/core/radio/radio_platform.cpp b/src/core/radio/radio_platform.cpp index fe994c1ec..b801f74bd 100644 --- a/src/core/radio/radio_platform.cpp +++ b/src/core/radio/radio_platform.cpp @@ -47,7 +47,7 @@ using namespace ot; extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); Mac::RxFrame *rxFrame = static_cast(aFrame); VerifyOrExit(instance.IsInitialized()); @@ -67,7 +67,7 @@ exit: extern "C" void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame) { - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); Mac::TxFrame &txFrame = *static_cast(aFrame); VerifyOrExit(instance.IsInitialized()); @@ -84,7 +84,7 @@ exit: extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) { - Instance & instance = AsCoreType(aInstance); + Instance &instance = AsCoreType(aInstance); Mac::TxFrame &txFrame = *static_cast(aFrame); Mac::RxFrame *ackFrame = static_cast(aAckFrame); @@ -201,7 +201,7 @@ OT_TOOL_WEAK otRadioState otPlatRadioGetState(otInstance *aInstance) return OT_RADIO_STATE_INVALID; } -OT_TOOL_WEAK void otPlatRadioSetMacKey(otInstance * aInstance, +OT_TOOL_WEAK void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKeyMaterial *aPrevKey, diff --git a/src/core/radio/trel_interface.cpp b/src/core/radio/trel_interface.cpp index 40a008182..89bf38b7c 100644 --- a/src/core/radio/trel_interface.cpp +++ b/src/core/radio/trel_interface.cpp @@ -173,7 +173,7 @@ exit: void Interface::HandleDiscoveredPeerInfo(const Peer::Info &aInfo) { - Peer * entry; + Peer *entry; Mac::ExtAddress extAddress; MeshCoP::ExtendedPanId extPanId; bool isNew = false; @@ -234,8 +234,8 @@ exit: return; } -Error Interface::ParsePeerInfoTxtData(const Peer::Info & aInfo, - Mac::ExtAddress & aExtAddress, +Error Interface::ParsePeerInfoTxtData(const Peer::Info &aInfo, + Mac::ExtAddress &aExtAddress, MeshCoP::ExtendedPanId &aExtPanId) const { Error error; diff --git a/src/core/radio/trel_interface.hpp b/src/core/radio/trel_interface.hpp index 4d9f86e6a..f68c8ffb2 100644 --- a/src/core/radio/trel_interface.hpp +++ b/src/core/radio/trel_interface.hpp @@ -134,7 +134,7 @@ public: { public: bool IsRemoved(void) const { return mRemoved; } - const uint8_t * GetTxtData(void) const { return mTxtData; } + const uint8_t *GetTxtData(void) const { return mTxtData; } uint16_t GetTxtLength(void) const { return mTxtLength; } const Ip6::SockAddr &GetSockAddr(void) const { return static_cast(mSockAddr); } }; @@ -243,8 +243,8 @@ private: void HandleDiscoveredPeerInfo(const Peer::Info &aInfo); void RegisterService(void); - Error ParsePeerInfoTxtData(const Peer::Info & aInfo, - Mac::ExtAddress & aExtAddress, + Error ParsePeerInfoTxtData(const Peer::Info &aInfo, + Mac::ExtAddress &aExtAddress, MeshCoP::ExtendedPanId &aExtPanId) const; Peer *GetNewPeerEntry(void); void RemovePeerEntry(Peer &aEntry); diff --git a/src/core/radio/trel_link.cpp b/src/core/radio/trel_link.cpp index c67735e66..85dbef66a 100644 --- a/src/core/radio/trel_link.cpp +++ b/src/core/radio/trel_link.cpp @@ -127,7 +127,7 @@ void Link::BeginTransmit(void) Mac::PanId destPanId; Header::Type type; Packet txPacket; - Neighbor * neighbor = nullptr; + Neighbor *neighbor = nullptr; Mac::RxFrame *ackFrame = nullptr; bool isDisovery = false; @@ -391,7 +391,7 @@ void Link::HandleAck(Packet &aAckPacket) { Error ackError; Mac::Address srcAddress; - Neighbor * neighbor; + Neighbor *neighbor; uint32_t ackNumber; LogDebg("HandleAck() [%s]", aAckPacket.GetHeader().ToString().AsCString()); diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index 812986502..6e27346a5 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -90,7 +90,7 @@ Error AddressResolver::GetNextCacheEntry(EntryInfo &aInfo, Iterator &aIterator) { Error error = kErrorNone; const CacheEntryList *list = aIterator.GetList(); - const CacheEntry * entry = aIterator.GetEntry(); + const CacheEntry *entry = aIterator.GetEntry(); while (entry == nullptr) { @@ -207,10 +207,10 @@ void AddressResolver::Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId) } AddressResolver::CacheEntry *AddressResolver::FindCacheEntry(const Ip6::Address &aEid, - CacheEntryList *& aList, - CacheEntry *& aPrevEntry) + CacheEntryList *&aList, + CacheEntry *&aPrevEntry) { - CacheEntry * entry = nullptr; + CacheEntry *entry = nullptr; CacheEntryList *lists[] = {&mCachedList, &mSnoopedList, &mQueryList, &mQueryRetryList}; for (CacheEntryList *list : lists) @@ -231,8 +231,8 @@ void AddressResolver::Remove(const Ip6::Address &aEid) void AddressResolver::Remove(const Ip6::Address &aEid, Reason aReason) { - CacheEntry * entry; - CacheEntry * prev; + CacheEntry *entry; + CacheEntry *prev; CacheEntryList *list; entry = FindCacheEntry(aEid, list, prev); @@ -247,8 +247,8 @@ exit: AddressResolver::CacheEntry *AddressResolver::NewCacheEntry(bool aSnoopedEntry) { - CacheEntry * newEntry = nullptr; - CacheEntry * prevEntry = nullptr; + CacheEntry *newEntry = nullptr; + CacheEntry *prevEntry = nullptr; CacheEntryList *lists[] = {&mSnoopedList, &mQueryRetryList, &mQueryList, &mCachedList}; // The following order is used when trying to allocate a new cache @@ -311,9 +311,9 @@ exit: return newEntry; } -void AddressResolver::RemoveCacheEntry(CacheEntry & aEntry, +void AddressResolver::RemoveCacheEntry(CacheEntry &aEntry, CacheEntryList &aList, - CacheEntry * aPrevEntry, + CacheEntry *aPrevEntry, Reason aReason) { aList.PopAfter(aPrevEntry); @@ -334,8 +334,8 @@ Error AddressResolver::UpdateCacheEntry(const Ip6::Address &aEid, Mac::ShortAddr Error error = kErrorNone; CacheEntryList *list; - CacheEntry * entry; - CacheEntry * prev; + CacheEntry *entry; + CacheEntry *prev; entry = FindCacheEntry(aEid, list, prev); VerifyOrExit(entry != nullptr, error = kErrorNotFound); @@ -371,7 +371,7 @@ void AddressResolver::UpdateSnoopedCacheEntry(const Ip6::Address &aEid, Mac::ShortAddress aDest) { uint16_t numNonEvictable = 0; - CacheEntry * entry; + CacheEntry *entry; Mac::ShortAddress macAddress; VerifyOrExit(Get().IsFullThreadDevice()); @@ -470,8 +470,8 @@ Mac::ShortAddress AddressResolver::LookUp(const Ip6::Address &aEid) Error AddressResolver::Resolve(const Ip6::Address &aEid, Mac::ShortAddress &aRloc16, bool aAllowAddressQuery) { Error error = kErrorNone; - CacheEntry * entry; - CacheEntry * prev = nullptr; + CacheEntry *entry; + CacheEntry *prev = nullptr; CacheEntryList *list; #if OPENTHREAD_CONFIG_TMF_ALLOW_ADDRESS_RESOLUTION_USING_NET_DATA_SERVICES @@ -594,7 +594,7 @@ exit: Error AddressResolver::SendAddressQuery(const Ip6::Address &aEid) { Error error; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); message = Get().NewPriorityNonConfirmablePostMessage(kUriAddressQuery); @@ -634,9 +634,9 @@ void AddressResolver::HandleTmf(Coap::Message &aMessage, cons Ip6::InterfaceIdentifier meshLocalIid; uint16_t rloc16; uint32_t lastTransactionTime; - CacheEntryList * list; - CacheEntry * entry; - CacheEntry * prev; + CacheEntryList *list; + CacheEntry *entry; + CacheEntry *prev; VerifyOrExit(aMessage.IsConfirmablePostRequest()); @@ -696,12 +696,12 @@ exit: return; } -void AddressResolver::SendAddressError(const Ip6::Address & aTarget, +void AddressResolver::SendAddressError(const Ip6::Address &aTarget, const Ip6::InterfaceIdentifier &aMeshLocalIid, - const Ip6::Address * aDestination) + const Ip6::Address *aDestination) { Error error; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); VerifyOrExit((message = Get().NewMessage()) != nullptr, error = kErrorNoBufs); @@ -868,13 +868,13 @@ exit: return; } -void AddressResolver::SendAddressQueryResponse(const Ip6::Address & aTarget, +void AddressResolver::SendAddressQueryResponse(const Ip6::Address &aTarget, const Ip6::InterfaceIdentifier &aMeshLocalIid, - const uint32_t * aLastTransactionTime, - const Ip6::Address & aDestination) + const uint32_t *aLastTransactionTime, + const Ip6::Address &aDestination) { Error error; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); message = Get().NewPriorityConfirmablePostMessage(kUriAddressNotify); @@ -982,8 +982,8 @@ void AddressResolver::HandleTimeTick(void) } } -void AddressResolver::HandleIcmpReceive(void * aContext, - otMessage * aMessage, +void AddressResolver::HandleIcmpReceive(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, const otIcmp6Header *aIcmpHeader) { @@ -993,8 +993,8 @@ void AddressResolver::HandleIcmpReceive(void * aContext, AsCoreType(aIcmpHeader)); } -void AddressResolver::HandleIcmpReceive(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +void AddressResolver::HandleIcmpReceive(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const Ip6::Icmp::Header &aIcmpHeader) { OT_UNUSED_VARIABLE(aMessageInfo); @@ -1018,7 +1018,7 @@ exit: void AddressResolver::LogCacheEntryChange(EntryChange aChange, Reason aReason, const CacheEntry &aEntry, - CacheEntryList * aList) + CacheEntryList *aList) { static const char *const kChangeStrings[] = { "added", // (0) kEntryAdded diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index 6695fc32d..7b87d30f7 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -84,7 +84,7 @@ public: static constexpr uint8_t kListIndex = 0; static constexpr uint8_t kEntryIndex = 1; - const CacheEntry * GetEntry(void) const { return static_cast(mData[kEntryIndex]); } + const CacheEntry *GetEntry(void) const { return static_cast(mData[kEntryIndex]); } void SetEntry(const CacheEntry *aEntry) { mData[kEntryIndex] = aEntry; } const CacheEntryList *GetList(void) const { return static_cast(mData[kListIndex]); } void SetList(const CacheEntryList *aList) { mData[kListIndex] = aList; } @@ -215,10 +215,10 @@ public: * @param[in] aDestination The destination to send the ADDR_NTF.ans message. * */ - void SendAddressQueryResponse(const Ip6::Address & aTarget, + void SendAddressQueryResponse(const Ip6::Address &aTarget, const Ip6::InterfaceIdentifier &aMeshLocalIid, - const uint32_t * aLastTransactionTimeTlv, - const Ip6::Address & aDestination); + const uint32_t *aLastTransactionTimeTlv, + const Ip6::Address &aDestination); /** * This method sends an Address Error Notification (ADDR_ERR.ntf) message. @@ -228,9 +228,9 @@ public: * @param aDestination The destination to send the ADDR_ERR.ntf message. * */ - void SendAddressError(const Ip6::Address & aTarget, + void SendAddressError(const Ip6::Address &aTarget, const Ip6::InterfaceIdentifier &aMeshLocalIid, - const Ip6::Address * aDestination); + const Ip6::Address *aDestination); private: static constexpr uint16_t kCacheEntries = OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES; @@ -247,7 +247,7 @@ private: public: void Init(Instance &aInstance); - CacheEntry * GetNext(void); + CacheEntry *GetNext(void); const CacheEntry *GetNext(void) const; void SetNext(CacheEntry *aEntry); @@ -329,7 +329,10 @@ private: kReasonRemovingEid, }; - CacheEntryPool &GetCacheEntryPool(void) { return mCacheEntryPool; } + CacheEntryPool &GetCacheEntryPool(void) + { + return mCacheEntryPool; + } Error Resolve(const Ip6::Address &aEid, Mac::ShortAddress &aRloc16, bool aAllowAddressQuery); void Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId); @@ -351,19 +354,19 @@ private: #if OPENTHREAD_FTD - static void HandleIcmpReceive(void * aContext, - otMessage * aMessage, + static void HandleIcmpReceive(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, const otIcmp6Header *aIcmpHeader); - void HandleIcmpReceive(Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + void HandleIcmpReceive(Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const Ip6::Icmp::Header &aIcmpHeader); void HandleTimeTick(void); void LogCacheEntryChange(EntryChange aChange, Reason aReason, const CacheEntry &aEntry, - CacheEntryList * aList = nullptr); + CacheEntryList *aList = nullptr); const char *ListToString(const CacheEntryList *aList) const; static AddressResolver::CacheEntry *GetEntryAfter(CacheEntry *aPrev, CacheEntryList &aList); diff --git a/src/core/thread/anycast_locator.cpp b/src/core/thread/anycast_locator.cpp index 28777a815..e403542c5 100644 --- a/src/core/thread/anycast_locator.cpp +++ b/src/core/thread/anycast_locator.cpp @@ -55,7 +55,7 @@ AnycastLocator::AnycastLocator(Instance &aInstance) Error AnycastLocator::Locate(const Ip6::Address &aAnycastAddress, Callback aCallback, void *aContext) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); VerifyOrExit((aCallback != nullptr) && Get().IsAnycastLocator(aAnycastAddress), @@ -81,8 +81,8 @@ exit: return error; } -void AnycastLocator::HandleResponse(void * aContext, - otMessage * aMessage, +void AnycastLocator::HandleResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aError) { diff --git a/src/core/thread/anycast_locator.hpp b/src/core/thread/anycast_locator.hpp index 65f34b20d..c823676f7 100644 --- a/src/core/thread/anycast_locator.hpp +++ b/src/core/thread/anycast_locator.hpp @@ -104,7 +104,7 @@ private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); Callback mCallback; - void * mContext; + void *mContext; }; #if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE diff --git a/src/core/thread/child_table.cpp b/src/core/thread/child_table.cpp index 19462b085..e5ec20936 100644 --- a/src/core/thread/child_table.cpp +++ b/src/core/thread/child_table.cpp @@ -184,7 +184,7 @@ exit: Error ChildTable::GetChildInfoById(uint16_t aChildId, Child::Info &aChildInfo) { Error error = kErrorNone; - Child * child; + Child *child; uint16_t rloc16; if ((aChildId & ~Mle::kMaxChildId) != 0) diff --git a/src/core/thread/csl_tx_scheduler.cpp b/src/core/thread/csl_tx_scheduler.cpp index f2dfbd4fc..0866366c7 100644 --- a/src/core/thread/csl_tx_scheduler.cpp +++ b/src/core/thread/csl_tx_scheduler.cpp @@ -46,7 +46,7 @@ CslTxScheduler::Callbacks::Callbacks(Instance &aInstance) inline Error CslTxScheduler::Callbacks::PrepareFrameForChild(Mac::TxFrame &aFrame, FrameContext &aContext, - Child & aChild) + Child &aChild) { return Get().PrepareFrameForChild(aFrame, aContext, aChild); } @@ -54,7 +54,7 @@ inline Error CslTxScheduler::Callbacks::PrepareFrameForChild(Mac::TxFrame &aFram inline void CslTxScheduler::Callbacks::HandleSentFrameToChild(const Mac::TxFrame &aFrame, const FrameContext &aContext, Error aError, - Child & aChild) + Child &aChild) { Get().HandleSentFrameToChild(aFrame, aContext, aError, aChild); } @@ -122,7 +122,7 @@ void CslTxScheduler::Clear(void) void CslTxScheduler::RescheduleCslTx(void) { uint32_t minDelayTime = Time::kMaxDuration; - Child * bestChild = nullptr; + Child *bestChild = nullptr; for (Child &child : Get().Iterate(Child::kInStateAnyExceptInvalid)) { @@ -152,7 +152,7 @@ void CslTxScheduler::RescheduleCslTx(void) } uint32_t CslTxScheduler::GetNextCslTransmissionDelay(const Child &aChild, - uint32_t & aDelayFromLastRx, + uint32_t &aDelayFromLastRx, uint32_t aAheadUs) const { uint64_t radioNow = otPlatRadioGetNow(&GetInstance()); diff --git a/src/core/thread/csl_tx_scheduler.hpp b/src/core/thread/csl_tx_scheduler.hpp index 708de8a14..b07357db8 100644 --- a/src/core/thread/csl_tx_scheduler.hpp +++ b/src/core/thread/csl_tx_scheduler.hpp @@ -160,7 +160,7 @@ public: void HandleSentFrameToChild(const Mac::TxFrame &aFrame, const FrameContext &aContext, Error aError, - Child & aChild); + Child &aChild); }; /** * This constructor initializes the CSL tx scheduler object. @@ -202,8 +202,8 @@ private: void HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, Child &aChild); uint32_t mCslFrameRequestAheadUs; - Child * mCslTxChild; - Message * mCslTxMessage; + Child *mCslTxChild; + Message *mCslTxMessage; Callbacks::FrameContext mFrameContext; Callbacks mCallbacks; }; diff --git a/src/core/thread/discover_scanner.cpp b/src/core/thread/discover_scanner.cpp index 89214cbe1..78688b9cd 100644 --- a/src/core/thread/discover_scanner.cpp +++ b/src/core/thread/discover_scanner.cpp @@ -64,12 +64,12 @@ Error DiscoverScanner::Discover(const Mac::ChannelMask &aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableFiltering, - const FilterIndexes * aFilterIndexes, + const FilterIndexes *aFilterIndexes, Handler aCallback, - void * aContext) + void *aContext) { Error error = kErrorNone; - Mle::TxMessage * message = nullptr; + Mle::TxMessage *message = nullptr; Tlv tlv; Ip6::Address destination; MeshCoP::DiscoveryRequestTlv discoveryRequest; @@ -291,7 +291,7 @@ exit: void DiscoverScanner::HandleDiscoveryResponse(Mle::RxInfo &aRxInfo) const { Error error = kErrorNone; - const ThreadLinkInfo * linkInfo = aRxInfo.mMessageInfo.GetThreadLinkInfo(); + const ThreadLinkInfo *linkInfo = aRxInfo.mMessageInfo.GetThreadLinkInfo(); MeshCoP::Tlv meshcopTlv; MeshCoP::DiscoveryResponseTlv discoveryResponse; MeshCoP::NetworkNameTlv networkName; diff --git a/src/core/thread/discover_scanner.hpp b/src/core/thread/discover_scanner.hpp index aff91bc7b..496b38db2 100644 --- a/src/core/thread/discover_scanner.hpp +++ b/src/core/thread/discover_scanner.hpp @@ -127,9 +127,9 @@ public: Mac::PanId aPanId, bool aJoiner, bool aEnableFiltering, - const FilterIndexes * aFilterIndexes, + const FilterIndexes *aFilterIndexes, Handler aCallback, - void * aContext); + void *aContext); /** * This method indicates whether or not an MLE Thread Discovery Scan is currently in progress. @@ -178,7 +178,7 @@ private: using ScanDoneTask = TaskletIn; Handler mHandler; - void * mHandlerContext; + void *mHandlerContext; ScanDoneTask mScanDoneTask; ScanTimer mTimer; FilterIndexes mFilterIndexes; diff --git a/src/core/thread/dua_manager.cpp b/src/core/thread/dua_manager.cpp index 2cc7c5e51..0c3bf021a 100644 --- a/src/core/thread/dua_manager.cpp +++ b/src/core/thread/dua_manager.cpp @@ -414,8 +414,8 @@ void DuaManager::UpdateTimeTickerRegistration(void) void DuaManager::PerformNextRegistration(void) { Error error = kErrorNone; - Mle::MleRouter & mle = Get(); - Coap::Message * message = nullptr; + Mle::MleRouter &mle = Get(); + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); Ip6::Address dua; @@ -465,7 +465,7 @@ void DuaManager::PerformNextRegistration(void) #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE uint32_t lastTransactionTime; const Ip6::Address *duaPtr = nullptr; - Child * child = nullptr; + Child *child = nullptr; OT_ASSERT(mChildIndexDuaRegistering == Mle::kMaxChildren); @@ -535,8 +535,8 @@ exit: FreeMessageOnError(message, error); } -void DuaManager::HandleDuaResponse(void * aContext, - otMessage * aMessage, +void DuaManager::HandleDuaResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -651,7 +651,7 @@ Error DuaManager::ProcessDuaResponse(Coap::Message &aMessage) #endif #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE { - Child * child = nullptr; + Child *child = nullptr; uint16_t childIndex; for (Child &iter : Get().Iterate(Child::kInStateValid)) @@ -707,11 +707,11 @@ exit: } #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE -void DuaManager::SendAddressNotification(Ip6::Address & aAddress, +void DuaManager::SendAddressNotification(Ip6::Address &aAddress, ThreadStatusTlv::DuaStatus aStatus, - const Child & aChild) + const Child &aChild) { - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); Error error; diff --git a/src/core/thread/dua_manager.hpp b/src/core/thread/dua_manager.hpp index 03ed43dd2..8ac3ff3fd 100644 --- a/src/core/thread/dua_manager.hpp +++ b/src/core/thread/dua_manager.hpp @@ -121,7 +121,10 @@ public: * @returns A reference to the Domain Unicast Address. * */ - const Ip6::Address &GetDomainUnicastAddress(void) const { return mDomainUnicastAddress.GetAddress(); } + const Ip6::Address &GetDomainUnicastAddress(void) const + { + return mDomainUnicastAddress.GetAddress(); + } /** * This method sets the Interface Identifier manually specified for the Thread Domain Unicast Address. @@ -148,7 +151,10 @@ public: * @retval false If there is no Interface Identifier manually specified. * */ - bool IsFixedDuaInterfaceIdentifierSet(void) { return !mFixedDuaInterfaceIdentifier.IsUnspecified(); } + bool IsFixedDuaInterfaceIdentifierSet(void) + { + return !mFixedDuaInterfaceIdentifier.IsUnspecified(); + } /** * This method gets the Interface Identifier for the Thread Domain Unicast Address if manually specified. @@ -156,7 +162,10 @@ public: * @returns A reference to the Interface Identifier. * */ - const Ip6::InterfaceIdentifier &GetFixedDuaInterfaceIdentifier(void) const { return mFixedDuaInterfaceIdentifier; } + const Ip6::InterfaceIdentifier &GetFixedDuaInterfaceIdentifier(void) const + { + return mFixedDuaInterfaceIdentifier; + } /* * This method restores duplicate address detection information from non-volatile memory. @@ -198,8 +207,8 @@ private: void UpdateTimeTickerRegistration(void); - static void HandleDuaResponse(void * aContext, - otMessage * aMessage, + static void HandleDuaResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleDuaResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); diff --git a/src/core/thread/indirect_sender.cpp b/src/core/thread/indirect_sender.cpp index f20727594..08cc61f6f 100644 --- a/src/core/thread/indirect_sender.cpp +++ b/src/core/thread/indirect_sender.cpp @@ -411,7 +411,7 @@ void IndirectSender::PrepareEmptyFrame(Mac::TxFrame &aFrame, Child &aChild, bool void IndirectSender::HandleSentFrameToChild(const Mac::TxFrame &aFrame, const FrameContext &aContext, Error aError, - Child & aChild) + Child &aChild) { Message *message = aChild.GetIndirectMessage(); uint16_t nextOffset = aContext.mMessageNextOffset; diff --git a/src/core/thread/indirect_sender.hpp b/src/core/thread/indirect_sender.hpp index 4e5fdb9fc..86d491d59 100644 --- a/src/core/thread/indirect_sender.hpp +++ b/src/core/thread/indirect_sender.hpp @@ -145,7 +145,10 @@ public: * This method enables indirect transmissions. * */ - void Start(void) { mEnabled = true; } + void Start(void) + { + mEnabled = true; + } /** * This method disables indirect transmission. diff --git a/src/core/thread/key_manager.hpp b/src/core/thread/key_manager.hpp index 048c22355..f205a45a2 100644 --- a/src/core/thread/key_manager.hpp +++ b/src/core/thread/key_manager.hpp @@ -148,7 +148,10 @@ public: * @retval kErrorFailed Failed to generate random sequence. * */ - Error GenerateRandom(void) { return Random::Crypto::FillBuffer(m8, sizeof(m8)); } + Error GenerateRandom(void) + { + return Random::Crypto::FillBuffer(m8, sizeof(m8)); + } #endif } OT_TOOL_PACKED_END; @@ -178,7 +181,10 @@ public: * @retval kErrorNone Successfully generated a random Thread PSKc. * */ - Error GenerateRandom(void) { return Random::Crypto::FillBuffer(m8, sizeof(m8)); } + Error GenerateRandom(void) + { + return Random::Crypto::FillBuffer(m8, sizeof(m8)); + } #endif } OT_TOOL_PACKED_END; @@ -254,7 +260,10 @@ public: * @returns A key reference to the Thread Network Key. * */ - NetworkKeyRef GetNetworkKeyRef(void) { return mNetworkKeyRef; } + NetworkKeyRef GetNetworkKeyRef(void) + { + return mNetworkKeyRef; + } /** * This method sets the Thread Network Key using Key Reference. @@ -274,7 +283,10 @@ public: * @retval FALSE if the PSKc is not not configured. * */ - bool IsPskcSet(void) const { return mIsPskcSet; } + bool IsPskcSet(void) const + { + return mIsPskcSet; + } /** * This method gets the PKSc. @@ -299,7 +311,10 @@ public: * @returns A key reference to the PSKc. * */ - const PskcRef &GetPskcRef(void) { return mPskcRef; } + const PskcRef &GetPskcRef(void) + { + return mPskcRef; + } /** * This method sets the PSKc as a Key reference. @@ -316,7 +331,10 @@ public: * @returns The current key sequence value. * */ - uint32_t GetCurrentKeySequence(void) const { return mKeySequence; } + uint32_t GetCurrentKeySequence(void) const + { + return mKeySequence; + } /** * This method sets the current key sequence value. @@ -333,7 +351,10 @@ public: * @returns The current TREL MAC key. * */ - const Mac::KeyMaterial &GetCurrentTrelMacKey(void) const { return mTrelKey; } + const Mac::KeyMaterial &GetCurrentTrelMacKey(void) const + { + return mTrelKey; + } /** * This method returns a temporary MAC key for TREL radio link computed from the given key sequence. @@ -352,7 +373,10 @@ public: * @returns The current MLE key. * */ - const Mle::KeyMaterial &GetCurrentMleKey(void) const { return mMleKey; } + const Mle::KeyMaterial &GetCurrentMleKey(void) const + { + return mMleKey; + } /** * This method returns a temporary MLE key Material computed from the given key sequence. @@ -371,7 +395,10 @@ public: * @returns The current MAC Frame Counter value. * */ - uint32_t Get154MacFrameCounter(void) const { return mMacFrameCounters.Get154(); } + uint32_t Get154MacFrameCounter(void) const + { + return mMacFrameCounters.Get154(); + } #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE @@ -381,7 +408,10 @@ public: * @returns The current MAC Frame Counter value for TREL radio link. * */ - uint32_t GetTrelMacFrameCounter(void) const { return mMacFrameCounters.GetTrel(); } + uint32_t GetTrelMacFrameCounter(void) const + { + return mMacFrameCounters.GetTrel(); + } /** * This method increments the current MAC Frame Counter value for TREL radio link. @@ -396,7 +426,10 @@ public: * @return The maximum MAC frame Counter among all supported radio links. * */ - uint32_t GetMaximumMacFrameCounter(void) const { return mMacFrameCounters.GetMaximum(); } + uint32_t GetMaximumMacFrameCounter(void) const + { + return mMacFrameCounters.GetMaximum(); + } /** * This method sets the current MAC Frame Counter value for all radio links. @@ -412,7 +445,10 @@ public: * @param[in] aStoredMacFrameCounter The stored MAC Frame Counter value. * */ - void SetStoredMacFrameCounter(uint32_t aStoredMacFrameCounter) { mStoredMacFrameCounter = aStoredMacFrameCounter; } + void SetStoredMacFrameCounter(uint32_t aStoredMacFrameCounter) + { + mStoredMacFrameCounter = aStoredMacFrameCounter; + } /** * This method returns the current MLE Frame Counter value. @@ -420,7 +456,10 @@ public: * @returns The current MLE Frame Counter value. * */ - uint32_t GetMleFrameCounter(void) const { return mMleFrameCounter; } + uint32_t GetMleFrameCounter(void) const + { + return mMleFrameCounter; + } /** * This method sets the current MLE Frame Counter value. @@ -428,7 +467,10 @@ public: * @param[in] aMleFrameCounter The MLE Frame Counter value. * */ - void SetMleFrameCounter(uint32_t aMleFrameCounter) { mMleFrameCounter = aMleFrameCounter; } + void SetMleFrameCounter(uint32_t aMleFrameCounter) + { + mMleFrameCounter = aMleFrameCounter; + } /** * This method sets the MLE Frame Counter value which is stored in non-volatile memory. @@ -436,7 +478,10 @@ public: * @param[in] aStoredMleFrameCounter The stored MLE Frame Counter value. * */ - void SetStoredMleFrameCounter(uint32_t aStoredMleFrameCounter) { mStoredMleFrameCounter = aStoredMleFrameCounter; } + void SetStoredMleFrameCounter(uint32_t aStoredMleFrameCounter) + { + mStoredMleFrameCounter = aStoredMleFrameCounter; + } /** * This method increments the current MLE Frame Counter value. @@ -450,7 +495,10 @@ public: * @returns The KEK as `KekKeyMaterial`. * */ - const KekKeyMaterial &GetKek(void) const { return mKek; } + const KekKeyMaterial &GetKek(void) const + { + return mKek; + } /** * This method retrieves the KEK as literal `Kek` key. @@ -458,7 +506,10 @@ public: * @param[out] aKek A reference to a `Kek` to output the retrieved KEK. * */ - void ExtractKek(Kek &aKek) { mKek.ExtractKey(aKek); } + void ExtractKek(Kek &aKek) + { + mKek.ExtractKey(aKek); + } /** * This method sets the KEK. @@ -474,7 +525,10 @@ public: * @param[in] aKekBytes A pointer to the KEK bytes. * */ - void SetKek(const uint8_t *aKekBytes) { SetKek(*reinterpret_cast(aKekBytes)); } + void SetKek(const uint8_t *aKekBytes) + { + SetKek(*reinterpret_cast(aKekBytes)); + } /** * This method returns the current KEK Frame Counter value. @@ -482,13 +536,19 @@ public: * @returns The current KEK Frame Counter value. * */ - uint32_t GetKekFrameCounter(void) const { return mKekFrameCounter; } + uint32_t GetKekFrameCounter(void) const + { + return mKekFrameCounter; + } /** * This method increments the current KEK Frame Counter value. * */ - void IncrementKekFrameCounter(void) { mKekFrameCounter++; } + void IncrementKekFrameCounter(void) + { + mKekFrameCounter++; + } /** * This method returns the KeySwitchGuardTime. @@ -498,7 +558,10 @@ public: * @returns The KeySwitchGuardTime value in hours. * */ - uint32_t GetKeySwitchGuardTime(void) const { return mKeySwitchGuardTime; } + uint32_t GetKeySwitchGuardTime(void) const + { + return mKeySwitchGuardTime; + } /** * This method sets the KeySwitchGuardTime. @@ -508,7 +571,10 @@ public: * @param[in] aKeySwitchGuardTime The KeySwitchGuardTime value in hours. * */ - void SetKeySwitchGuardTime(uint32_t aKeySwitchGuardTime) { mKeySwitchGuardTime = aKeySwitchGuardTime; } + void SetKeySwitchGuardTime(uint32_t aKeySwitchGuardTime) + { + mKeySwitchGuardTime = aKeySwitchGuardTime; + } /** * This method returns the Security Policy. @@ -519,7 +585,10 @@ public: * @returns The SecurityPolicy. * */ - const SecurityPolicy &GetSecurityPolicy(void) const { return mSecurityPolicy; } + const SecurityPolicy &GetSecurityPolicy(void) const + { + return mSecurityPolicy; + } /** * This method sets the Security Policy. diff --git a/src/core/thread/link_metrics.cpp b/src/core/thread/link_metrics.cpp index c0bf8148f..2768c66af 100644 --- a/src/core/thread/link_metrics.cpp +++ b/src/core/thread/link_metrics.cpp @@ -94,11 +94,11 @@ exit: #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE Error LinkMetrics::SendMgmtRequestForwardTrackingSeries(const Ip6::Address &aDestination, uint8_t aSeriesId, - const SeriesFlags & aSeriesFlags, - const Metrics * aMetrics) + const SeriesFlags &aSeriesFlags, + const Metrics *aMetrics) { Error error; - Neighbor * neighbor; + Neighbor *neighbor; uint8_t typeIdCount = 0; FwdProbingRegSubTlv fwdProbingSubTlv; @@ -126,10 +126,10 @@ exit: Error LinkMetrics::SendMgmtRequestEnhAckProbing(const Ip6::Address &aDestination, const EnhAckFlags aEnhAckFlags, - const Metrics * aMetrics) + const Metrics *aMetrics) { Error error; - Neighbor * neighbor; + Neighbor *neighbor; uint8_t typeIdCount = 0; EnhAckConfigSubTlv enhAckConfigSubTlv; @@ -396,7 +396,7 @@ exit: return error; } -void LinkMetrics::HandleReport(const Message & aMessage, +void LinkMetrics::HandleReport(const Message &aMessage, uint16_t aOffset, uint16_t aLength, const Ip6::Address &aAddress) @@ -595,7 +595,7 @@ exit: Status LinkMetrics::ConfigureForwardTrackingSeries(uint8_t aSeriesId, uint8_t aSeriesFlagsMask, const Metrics &aMetrics, - Neighbor & aNeighbor) + Neighbor &aNeighbor) { Status status = kStatusSuccess; @@ -686,7 +686,7 @@ exit: Error LinkMetrics::ReadTypeIdsFromMessage(const Message &aMessage, uint16_t aStartOffset, uint16_t aEndOffset, - Metrics & aMetrics) + Metrics &aMetrics) { Error error = kErrorNone; diff --git a/src/core/thread/link_metrics.hpp b/src/core/thread/link_metrics.hpp index daefc780f..f63ca1cfe 100644 --- a/src/core/thread/link_metrics.hpp +++ b/src/core/thread/link_metrics.hpp @@ -136,8 +136,8 @@ public: */ Error SendMgmtRequestForwardTrackingSeries(const Ip6::Address &aDestination, uint8_t aSeriesId, - const SeriesFlags & aSeriesFlags, - const Metrics * aMetrics); + const SeriesFlags &aSeriesFlags, + const Metrics *aMetrics); #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE /** @@ -157,7 +157,7 @@ public: */ Error SendMgmtRequestEnhAckProbing(const Ip6::Address &aDestination, EnhAckFlags aEnhAckFlags, - const Metrics * aMetrics); + const Metrics *aMetrics); /** * This method sends an MLE Link Probe message. @@ -303,7 +303,7 @@ private: Status ConfigureForwardTrackingSeries(uint8_t aSeriesId, uint8_t aSeriesFlags, const Metrics &aMetrics, - Neighbor & aNeighbor); + Neighbor &aNeighbor); Status ConfigureEnhAckProbing(EnhAckFlags aEnhAckFlags, const Metrics &aMetrics, Neighbor &aNeighbor); @@ -312,7 +312,7 @@ private: static Error ReadTypeIdsFromMessage(const Message &aMessage, uint16_t aStartOffset, uint16_t aEndOffset, - Metrics & aMetrics); + Metrics &aMetrics); static Error AppendReportSubTlvToMessage(Message &aMessage, const MetricsValues &aValues); static uint8_t ScaleLinkMarginToRawValue(uint8_t aLinkMargin); @@ -321,11 +321,11 @@ private: static int8_t ScaleRawValueToRssi(uint8_t aRawValue); ReportCallback mReportCallback; - void * mReportCallbackContext; + void *mReportCallbackContext; MgmtResponseCallback mMgmtResponseCallback; - void * mMgmtResponseCallbackContext; + void *mMgmtResponseCallbackContext; EnhAckProbingIeReportCallback mEnhAckProbingIeReportCallback; - void * mEnhAckProbingIeReportCallbackContext; + void *mEnhAckProbingIeReportCallbackContext; Pool mSeriesInfoPool; }; diff --git a/src/core/thread/lowpan.cpp b/src/core/thread/lowpan.cpp index 764514467..3c816bdc9 100644 --- a/src/core/thread/lowpan.cpp +++ b/src/core/thread/lowpan.cpp @@ -98,9 +98,9 @@ exit: Error Lowpan::CompressSourceIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, - const Context & aContext, - uint16_t & aHcCtl, - FrameBuilder & aFrameBuilder) + const Context &aContext, + uint16_t &aHcCtl, + FrameBuilder &aFrameBuilder) { Error error = kErrorNone; Ip6::InterfaceIdentifier iid; @@ -127,9 +127,9 @@ Error Lowpan::CompressSourceIid(const Mac::Address &aMacAddr, Error Lowpan::CompressDestinationIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, - const Context & aContext, - uint16_t & aHcCtl, - FrameBuilder & aFrameBuilder) + const Context &aContext, + uint16_t &aHcCtl, + FrameBuilder &aFrameBuilder) { Error error = kErrorNone; Ip6::InterfaceIdentifier iid; @@ -235,17 +235,17 @@ exit: return error; } -Error Lowpan::Compress(Message & aMessage, +Error Lowpan::Compress(Message &aMessage, const Mac::Addresses &aMacAddrs, - FrameBuilder & aFrameBuilder, - uint8_t & aHeaderDepth) + FrameBuilder &aFrameBuilder, + uint8_t &aHeaderDepth) { Error error = kErrorNone; uint16_t startOffset = aMessage.GetOffset(); uint16_t hcCtl = kHcDispatch; uint16_t hcCtlOffset = 0; Ip6::Header ip6Header; - uint8_t * ip6HeaderBytes = reinterpret_cast(&ip6Header); + uint8_t *ip6HeaderBytes = reinterpret_cast(&ip6Header); Context srcContext, dstContext; uint8_t nextHeader; uint8_t ecn; @@ -609,10 +609,10 @@ exit: return error; } -Error Lowpan::DecompressBaseHeader(Ip6::Header & aIp6Header, - bool & aCompressedNextHeader, +Error Lowpan::DecompressBaseHeader(Ip6::Header &aIp6Header, + bool &aCompressedNextHeader, const Mac::Addresses &aMacAddrs, - FrameData & aFrameData) + FrameData &aFrameData) { Error error = kErrorParse; uint16_t hcCtl; @@ -995,9 +995,9 @@ exit: return error; } -Error Lowpan::Decompress(Message & aMessage, +Error Lowpan::Decompress(Message &aMessage, const Mac::Addresses &aMacAddrs, - FrameData & aFrameData, + FrameData &aFrameData, uint16_t aDatagramLength) { Error error = kErrorParse; diff --git a/src/core/thread/lowpan.hpp b/src/core/thread/lowpan.hpp index 7f9da24a7..21a70695b 100644 --- a/src/core/thread/lowpan.hpp +++ b/src/core/thread/lowpan.hpp @@ -150,9 +150,9 @@ public: * @retval kErrorNoBufs Could not grow @p aMessage to write the parsed IPv6 header. * */ - Error Decompress(Message & aMessage, + Error Decompress(Message &aMessage, const Mac::Addresses &aMacAddrs, - FrameData & aFrameData, + FrameData &aFrameData, uint16_t aDatagramLength); /** @@ -169,10 +169,10 @@ public: * @retval kErrorParse Failed to parse the lowpan header. * */ - Error DecompressBaseHeader(Ip6::Header & aIp6Header, - bool & aCompressedNextHeader, + Error DecompressBaseHeader(Ip6::Header &aIp6Header, + bool &aCompressedNextHeader, const Mac::Addresses &aMacAddrs, - FrameData & aFrameData); + FrameData &aFrameData); /** * This method decompresses a LOWPAN_NHC UDP header. @@ -264,22 +264,22 @@ private: void FindContextForId(uint8_t aContextId, Context &aContext) const; void FindContextToCompressAddress(const Ip6::Address &aIp6Address, Context &aContext) const; - Error Compress(Message & aMessage, + Error Compress(Message &aMessage, const Mac::Addresses &aMacAddrs, - FrameBuilder & aFrameBuilder, - uint8_t & aHeaderDepth); + FrameBuilder &aFrameBuilder, + uint8_t &aHeaderDepth); Error CompressExtensionHeader(Message &aMessage, FrameBuilder &aFrameBuilder, uint8_t &aNextHeader); Error CompressSourceIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, - const Context & aContext, - uint16_t & aHcCtl, - FrameBuilder & aFrameBuilder); + const Context &aContext, + uint16_t &aHcCtl, + FrameBuilder &aFrameBuilder); Error CompressDestinationIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, - const Context & aContext, - uint16_t & aHcCtl, - FrameBuilder & aFrameBuilder); + const Context &aContext, + uint16_t &aHcCtl, + FrameBuilder &aFrameBuilder); Error CompressMulticast(const Ip6::Address &aIpAddr, uint16_t &aHcCtl, FrameBuilder &aFrameBuilder); Error CompressUdp(Message &aMessage, FrameBuilder &aFrameBuilder); diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 5d6975aff..ec5dca259 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -833,8 +833,8 @@ exit: // It returns the next offset into the message after the prepared // frame. // -uint16_t MeshForwarder::PrepareDataFrame(Mac::TxFrame & aFrame, - Message & aMessage, +uint16_t MeshForwarder::PrepareDataFrame(Mac::TxFrame &aFrame, + Message &aMessage, const Mac::Addresses &aMacAddrs, bool aAddMeshHeader, uint16_t aMeshSource, @@ -968,7 +968,7 @@ start: // Initialize Mesh header if (aAddMeshHeader) { - Mle::MleRouter & mle = Get(); + Mle::MleRouter &mle = Get(); Lowpan::MeshHeader meshHeader; uint8_t hopsLeft; uint16_t maxPayloadLength; @@ -1135,7 +1135,7 @@ start: return nextOffset; } -Neighbor *MeshForwarder::UpdateNeighborOnSentFrame(Mac::TxFrame & aFrame, +Neighbor *MeshForwarder::UpdateNeighborOnSentFrame(Mac::TxFrame &aFrame, Error aError, const Mac::Address &aMacDest, bool aIsDataPoll) @@ -1230,7 +1230,7 @@ exit: void MeshForwarder::HandleSentFrame(Mac::TxFrame &aFrame, Error aError) { - Neighbor * neighbor = nullptr; + Neighbor *neighbor = nullptr; Mac::Address macDest; OT_ASSERT((aError == kErrorNone) || (aError == kErrorChannelAccessFailure) || (aError == kErrorAbort) || @@ -1449,13 +1449,13 @@ exit: } } -void MeshForwarder::HandleFragment(FrameData & aFrameData, +void MeshForwarder::HandleFragment(FrameData &aFrameData, const Mac::Addresses &aMacAddrs, const ThreadLinkInfo &aLinkInfo) { Error error = kErrorNone; Lowpan::FragmentHeader fragmentHeader; - Message * message = nullptr; + Message *message = nullptr; SuccessOrExit(error = fragmentHeader.ParseFrom(aFrameData)); @@ -1639,10 +1639,10 @@ bool MeshForwarder::UpdateReassemblyList(void) return mReassemblyList.GetHead() != nullptr; } -Error MeshForwarder::FrameToMessage(const FrameData & aFrameData, +Error MeshForwarder::FrameToMessage(const FrameData &aFrameData, uint16_t aDatagramSize, const Mac::Addresses &aMacAddrs, - Message *& aMessage) + Message *&aMessage) { Error error = kErrorNone; FrameData frameData = aFrameData; @@ -1662,7 +1662,7 @@ exit: return error; } -void MeshForwarder::HandleLowpanHC(const FrameData & aFrameData, +void MeshForwarder::HandleLowpanHC(const FrameData &aFrameData, const Mac::Addresses &aMacAddrs, const ThreadLinkInfo &aLinkInfo) { @@ -1712,9 +1712,9 @@ Error MeshForwarder::HandleDatagram(Message &aMessage, const ThreadLinkInfo &aLi return Get().HandleDatagram(aMessage, Ip6::Ip6::kFromThreadNetif, &aLinkInfo); } -Error MeshForwarder::GetFramePriority(const FrameData & aFrameData, +Error MeshForwarder::GetFramePriority(const FrameData &aFrameData, const Mac::Addresses &aMacAddrs, - Message::Priority & aPriority) + Message::Priority &aPriority) { Error error = kErrorNone; Ip6::Headers headers; @@ -1931,7 +1931,7 @@ void MeshForwarder::LogIp6SourceDestAddresses(const Ip6::Headers &, LogLevel) #endif void MeshForwarder::LogIp6Message(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aMacAddress, Error aError, LogLevel aLogLevel) @@ -1939,7 +1939,7 @@ void MeshForwarder::LogIp6Message(MessageAction aAction, Ip6::Headers headers; bool shouldLogRss; bool shouldLogRadio = false; - const char * radioString = ""; + const char *radioString = ""; SuccessOrExit(headers.ParseFrom(aMessage)); @@ -1971,7 +1971,7 @@ exit: } void MeshForwarder::LogMessage(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, Error aError, const Mac::Address *aMacAddress) @@ -2038,7 +2038,7 @@ void MeshForwarder::LogFrame(const char *aActionText, const Mac::Frame &aFrame, void MeshForwarder::LogFragmentFrameDrop(Error aError, uint16_t aFrameLength, - const Mac::Addresses & aMacAddrs, + const Mac::Addresses &aMacAddrs, const Lowpan::FragmentHeader &aFragmentHeader, bool aIsSecure) { diff --git a/src/core/thread/mesh_forwarder.hpp b/src/core/thread/mesh_forwarder.hpp index 932e8f5c3..16aab6820 100644 --- a/src/core/thread/mesh_forwarder.hpp +++ b/src/core/thread/mesh_forwarder.hpp @@ -138,7 +138,10 @@ public: * @returns The Time Sync Sequence. * */ - uint8_t GetTimeSyncSeq(void) const { return mTimeSyncSeq; } + uint8_t GetTimeSyncSeq(void) const + { + return mTimeSyncSeq; + } /** * This method returns the time offset to the Thread network time (in microseconds). @@ -146,7 +149,10 @@ public: * @returns The time offset to the Thread network time (in microseconds). * */ - int64_t GetNetworkTimeOffset(void) const { return mNetworkTimeOffset; } + int64_t GetNetworkTimeOffset(void) const + { + return mNetworkTimeOffset; + } #endif /** @@ -287,7 +293,10 @@ public: * @returns A reference to the send queue. * */ - const PriorityQueue &GetSendQueue(void) const { return mSendQueue; } + const PriorityQueue &GetSendQueue(void) const + { + return mSendQueue; + } /** * This method returns a reference to the reassembly queue. @@ -295,7 +304,10 @@ public: * @returns A reference to the reassembly queue. * */ - const MessageQueue &GetReassemblyQueue(void) const { return mReassemblyList; } + const MessageQueue &GetReassemblyQueue(void) const + { + return mReassemblyList; + } /** * This method returns a reference to the IP level counters. @@ -303,13 +315,19 @@ public: * @returns A reference to the IP level counters. * */ - const otIpCounters &GetCounters(void) const { return mIpCounters; } + const otIpCounters &GetCounters(void) const + { + return mIpCounters; + } /** * This method resets the IP level counters. * */ - void ResetCounters(void) { memset(&mIpCounters, 0, sizeof(mIpCounters)); } + void ResetCounters(void) + { + memset(&mIpCounters, 0, sizeof(mIpCounters)); + } #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE /** @@ -382,10 +400,22 @@ private: kReassemblyTimeout; #endif - Message::Priority GetPriority(void) const { return static_cast(mPriority); } - bool IsExpired(void) const { return (mLifetime == 0); } - void DecrementLifetime(void) { mLifetime--; } - void ResetLifetime(void) { mLifetime = kLifetime; } + Message::Priority GetPriority(void) const + { + return static_cast(mPriority); + } + bool IsExpired(void) const + { + return (mLifetime == 0); + } + void DecrementLifetime(void) + { + mLifetime--; + } + void ResetLifetime(void) + { + mLifetime = kLifetime; + } bool Matches(uint16_t aSrcRloc16, uint16_t aTag) const { @@ -393,8 +423,14 @@ private: } #if OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_ENABLE - bool ShouldDrop(void) const { return mShouldDrop; } - void MarkToDrop(void) { mShouldDrop = true; } + bool ShouldDrop(void) const + { + return mShouldDrop; + } + void MarkToDrop(void) + { + mShouldDrop = true; + } #endif private: @@ -429,18 +465,18 @@ private: void SendIcmpErrorIfDstUnreach(const Message &aMessage, const Mac::Addresses &aMacAddrs); Error CheckReachability(const FrameData &aFrameData, const Mac::Addresses &aMeshAddrs); void UpdateRoutes(const FrameData &aFrameData, const Mac::Addresses &aMeshAddrs); - Error FrameToMessage(const FrameData & aFrameData, + Error FrameToMessage(const FrameData &aFrameData, uint16_t aDatagramSize, const Mac::Addresses &aMacAddrs, - Message *& aMessage); + Message *&aMessage); void GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr); void GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr); Message *PrepareNextDirectTransmission(void); void HandleMesh(FrameData &aFrameData, const Mac::Address &aMacSource, const ThreadLinkInfo &aLinkInfo); void HandleFragment(FrameData &aFrameData, const Mac::Addresses &aMacAddrs, const ThreadLinkInfo &aLinkInfo); void HandleLowpanHC(const FrameData &aFrameData, const Mac::Addresses &aMacAddrs, const ThreadLinkInfo &aLinkInfo); - uint16_t PrepareDataFrame(Mac::TxFrame & aFrame, - Message & aMessage, + uint16_t PrepareDataFrame(Mac::TxFrame &aFrame, + Message &aMessage, const Mac::Addresses &aMacAddrs, bool aAddMeshHeader = false, uint16_t aMeshSource = 0xffff, @@ -475,7 +511,7 @@ private: void HandleReceivedFrame(Mac::RxFrame &aFrame); Mac::TxFrame *HandleFrameRequest(Mac::TxFrames &aTxFrames); - Neighbor * UpdateNeighborOnSentFrame(Mac::TxFrame & aFrame, + Neighbor *UpdateNeighborOnSentFrame(Mac::TxFrame &aFrame, Error aError, const Mac::Address &aMacDest, bool aIsDataPoll = false); @@ -493,10 +529,10 @@ private: Error GetFramePriority(const FrameData &aFrameData, const Mac::Addresses &aMacAddrs, Message::Priority &aPriority); Error GetFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader, uint16_t aSrcRloc16, - Message::Priority & aPriority); - void GetForwardFramePriority(const FrameData & aFrameData, + Message::Priority &aPriority); + void GetForwardFramePriority(const FrameData &aFrameData, const Mac::Addresses &aMeshAddrs, - Message::Priority & aPriority); + Message::Priority &aPriority); bool CalcIePresent(const Message *aMessage); uint16_t CalcFrameVersion(const Neighbor *aNeighbor, bool aIePresent); @@ -504,7 +540,10 @@ private: void AppendHeaderIe(const Message *aMessage, Mac::TxFrame &aFrame); #endif - void PauseMessageTransmissions(void) { mTxPaused = true; } + void PauseMessageTransmissions(void) + { + mTxPaused = true; + } void ResumeMessageTransmissions(void); #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_MAC_COLLISION_AVOIDANCE_DELAY_ENABLE @@ -512,13 +551,13 @@ private: #endif void LogMessage(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, Error aError = kErrorNone, const Mac::Address *aAddress = nullptr); void LogFrame(const char *aActionText, const Mac::Frame &aFrame, Error aError); void LogFragmentFrameDrop(Error aError, uint16_t aFrameLength, - const Mac::Addresses & aMacAddrs, + const Mac::Addresses &aMacAddrs, const Lowpan::FragmentHeader &aFragmentHeader, bool aIsSecure); void LogLowpanHcFrameDrop(Error aError, uint16_t aFrameLength, const Mac::Addresses &aMacAddrs, bool aIsSecure); @@ -529,25 +568,25 @@ private: #if OPENTHREAD_FTD Error LogMeshFragmentHeader(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aMacAddress, Error aError, - uint16_t & aOffset, - Mac::Addresses & aMeshAddrs, + uint16_t &aOffset, + Mac::Addresses &aMeshAddrs, LogLevel aLogLevel); - void LogMeshIpHeader(const Message & aMessage, + void LogMeshIpHeader(const Message &aMessage, uint16_t aOffset, const Mac::Addresses &aMeshAddrs, LogLevel aLogLevel); void LogMeshMessage(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aAddress, Error aError, LogLevel aLogLevel); #endif void LogIp6SourceDestAddresses(const Ip6::Headers &aHeaders, LogLevel aLogLevel); void LogIp6Message(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aAddress, Error aError, LogLevel aLogLevel); diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 1b501e0fc..300f8859b 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -387,7 +387,7 @@ Error MeshForwarder::UpdateMeshRoute(Message &aMessage) { Error error = kErrorNone; Lowpan::MeshHeader meshHeader; - Neighbor * neighbor; + Neighbor *neighbor; uint16_t nextHop; IgnoreError(meshHeader.ParseFrom(aMessage)); @@ -554,7 +554,7 @@ Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage { Mle::MleRouter &mle = Get(); Error error = kErrorNone; - Neighbor * neighbor; + Neighbor *neighbor; if (aMessage.GetOffset() > 0) { @@ -647,7 +647,7 @@ void MeshForwarder::SendIcmpErrorIfDstUnreach(const Message &aMessage, const Mac { Error error; Ip6::Headers ip6Headers; - Child * child; + Child *child; VerifyOrExit(aMacAddrs.mSource.IsShort() && aMacAddrs.mDestination.IsShort()); @@ -708,7 +708,7 @@ void MeshForwarder::SendDestinationUnreachable(uint16_t aMeshSource, const Ip6:: void MeshForwarder::HandleMesh(FrameData &aFrameData, const Mac::Address &aMacSource, const ThreadLinkInfo &aLinkInfo) { Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; Mac::Addresses meshAddrs; Lowpan::MeshHeader meshHeader; @@ -790,7 +790,7 @@ exit: void MeshForwarder::UpdateRoutes(const FrameData &aFrameData, const Mac::Addresses &aMeshAddrs) { Ip6::Headers ip6Headers; - Neighbor * neighbor; + Neighbor *neighbor; VerifyOrExit(!aMeshAddrs.mDestination.IsBroadcast() && aMeshAddrs.mSource.IsShort()); @@ -920,7 +920,7 @@ MeshForwarder::FragmentPriorityList::Entry *MeshForwarder::FragmentPriorityList: Error MeshForwarder::GetFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader, uint16_t aSrcRloc16, - Message::Priority & aPriority) + Message::Priority &aPriority) { Error error = kErrorNone; FragmentPriorityList::Entry *entry; @@ -933,9 +933,9 @@ exit: return error; } -void MeshForwarder::GetForwardFramePriority(const FrameData & aFrameData, +void MeshForwarder::GetForwardFramePriority(const FrameData &aFrameData, const Mac::Addresses &aMeshAddrs, - Message::Priority & aPriority) + Message::Priority &aPriority) { Error error = kErrorNone; FrameData frameData = aFrameData; @@ -974,11 +974,11 @@ exit: #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_NOTE) Error MeshForwarder::LogMeshFragmentHeader(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aMacAddress, Error aError, - uint16_t & aOffset, - Mac::Addresses & aMeshAddrs, + uint16_t &aOffset, + Mac::Addresses &aMeshAddrs, LogLevel aLogLevel) { Error error = kErrorFailed; @@ -988,7 +988,7 @@ Error MeshForwarder::LogMeshFragmentHeader(MessageAction aAction, Lowpan::FragmentHeader fragmentHeader; uint16_t headerLength; bool shouldLogRadio = false; - const char * radioString = ""; + const char *radioString = ""; SuccessOrExit(meshHeader.ParseFrom(aMessage, headerLength)); @@ -1035,7 +1035,7 @@ exit: return error; } -void MeshForwarder::LogMeshIpHeader(const Message & aMessage, +void MeshForwarder::LogMeshIpHeader(const Message &aMessage, uint16_t aOffset, const Mac::Addresses &aMeshAddrs, LogLevel aLogLevel) @@ -1054,7 +1054,7 @@ exit: } void MeshForwarder::LogMeshMessage(MessageAction aAction, - const Message & aMessage, + const Message &aMessage, const Mac::Address *aMacAddress, Error aError, LogLevel aLogLevel) diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 4e741f605..48df9bc71 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -252,7 +252,7 @@ exit: if (mDetachGracefullyCallback != nullptr) { otDetachGracefullyCallback callback = mDetachGracefullyCallback; - void * context = mDetachGracefullyContext; + void *context = mDetachGracefullyContext; mDetachGracefullyCallback = nullptr; mDetachGracefullyContext = nullptr; @@ -1689,7 +1689,7 @@ void Mle::RemoveDelayedMessage(Message::SubType aSubType, MessageType aMessageTy void Mle::SendParentRequest(ParentRequestType aType) { Error error = kErrorNone; - TxMessage * message; + TxMessage *message; uint8_t scanMask = 0; Ip6::Address destination; @@ -1748,7 +1748,7 @@ Error Mle::SendChildIdRequest(void) Error error = kErrorNone; uint8_t tlvsLen = sizeof(kTlvs); - TxMessage * message = nullptr; + TxMessage *message = nullptr; Ip6::Address destination; if (mParent.GetExtAddress() == mParentCandidate.GetExtAddress()) @@ -1810,8 +1810,8 @@ exit: } #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -Error Mle::SendDataRequest(const Ip6::Address & aDestination, - const uint8_t * aTlvs, +Error Mle::SendDataRequest(const Ip6::Address &aDestination, + const uint8_t *aTlvs, uint8_t aTlvsLength, uint16_t aDelay, const LinkMetrics::LinkMetrics::QueryInfo *aQueryInfo) @@ -1992,7 +1992,7 @@ Error Mle::SendChildUpdateRequest(bool aAppendChallenge, uint32_t aTimeout) { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message = nullptr; + TxMessage *message = nullptr; AddressRegistrationMode mode = kAppendAllAddresses; if (!mParent.IsStateValidOrRestoring()) @@ -2072,7 +2072,7 @@ Error Mle::SendChildUpdateResponse(const TlvList &aTlvList, const Challenge &aCh { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message; + TxMessage *message; bool checkAddress = false; VerifyOrExit((message = NewMleMessage(kCommandChildUpdateResponse)) != nullptr, error = kErrorNoBufs); @@ -2157,7 +2157,7 @@ void Mle::SendAnnounce(uint8_t aChannel, const Ip6::Address &aDestination, Annou Error error = kErrorNone; ChannelTlv channelTlv; MeshCoP::Timestamp activeTimestamp; - TxMessage * message = nullptr; + TxMessage *message = nullptr; VerifyOrExit(Get().GetSupportedChannelMask().ContainsChannel(aChannel), error = kErrorInvalidArgs); VerifyOrExit((message = NewMleMessage(kCommandAnnounce)) != nullptr, error = kErrorNoBufs); @@ -2267,10 +2267,10 @@ exit: #endif Error Mle::ProcessMessageSecurity(Crypto::AesCcm::Mode aMode, - Message & aMessage, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, uint16_t aCmdOffset, - const SecurityHeader & aHeader) + const SecurityHeader &aHeader) { // This method performs MLE message security. Based on `aMode` it // can be used to encrypt and append tag to `aMessage` or to @@ -2373,7 +2373,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn uint32_t frameCounter; Mac::ExtAddress extAddr; uint8_t command; - Neighbor * neighbor; + Neighbor *neighbor; LogDebg("Receive MLE message"); @@ -2993,7 +2993,7 @@ exit: bool Mle::IsBetterParent(uint16_t aRloc16, LinkQuality aLinkQuality, uint8_t aLinkMargin, - const ConnectivityTlv & aConnectivityTlv, + const ConnectivityTlv &aConnectivityTlv, uint16_t aVersion, const Mac::CslAccuracy &aCslAccuracy) { @@ -3860,7 +3860,7 @@ Error Mle::CheckReachability(uint16_t aMeshDest, const Ip6::Header &aIp6Header) void Mle::InformPreviousParent(void) { Error error = kErrorNone; - Message * message = nullptr; + Message *message = nullptr; Ip6::MessageInfo messageInfo; VerifyOrExit((message = Get().NewMessage(0)) != nullptr, error = kErrorNoBufs); @@ -4415,7 +4415,7 @@ void Mle::DelayedResponseMetadata::RemoveFrom(Message &aMessage) const Mle::TxMessage *Mle::NewMleMessage(Command aCommand) { Error error = kErrorNone; - TxMessage * message; + TxMessage *message; Message::Settings settings(Message::kNoLinkSecurity, Message::kPriorityNet); Message::SubType subType; uint8_t securitySuite; diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index b84cfed75..0d206650e 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -136,13 +136,19 @@ public: * @retval kErrorInvalidState IPv6 interface is down or device is in raw-link mode. * */ - Error Start(void) { return Start(kNormalAttach); } + Error Start(void) + { + return Start(kNormalAttach); + } /** * This method stops the MLE protocol operation. * */ - void Stop(void) { Stop(kUpdateNetworkDatasets); } + void Stop(void) + { + Stop(kUpdateNetworkDatasets); + } /** * This method restores network information from non-volatile memory (if any). @@ -165,7 +171,10 @@ public: * @param[in] aChannel The channel to use when transmitting. * */ - void SendAnnounce(uint8_t aChannel) { SendAnnounce(aChannel, kNormalAnnounce); } + void SendAnnounce(uint8_t aChannel) + { + SendAnnounce(aChannel, kNormalAnnounce); + } /** * This method causes the Thread interface to detach from the Thread network. @@ -220,7 +229,10 @@ public: * @retval FALSE Device is not in middle of attach process. * */ - bool IsAttaching(void) const { return (mAttachState != kAttachStateIdle); } + bool IsAttaching(void) const + { + return (mAttachState != kAttachStateIdle); + } /** * This method returns the current Thread device role. @@ -228,7 +240,10 @@ public: * @returns The current Thread device role. * */ - DeviceRole GetRole(void) const { return mRole; } + DeviceRole GetRole(void) const + { + return mRole; + } /** * This method indicates whether device role is disabled. @@ -237,7 +252,10 @@ public: * @retval FALSE Device role is not disabled. * */ - bool IsDisabled(void) const { return (mRole == kRoleDisabled); } + bool IsDisabled(void) const + { + return (mRole == kRoleDisabled); + } /** * This method indicates whether device role is detached. @@ -246,7 +264,10 @@ public: * @retval FALSE Device role is not detached. * */ - bool IsDetached(void) const { return (mRole == kRoleDetached); } + bool IsDetached(void) const + { + return (mRole == kRoleDetached); + } /** * This method indicates whether device role is child. @@ -255,7 +276,10 @@ public: * @retval FALSE Device role is not child. * */ - bool IsChild(void) const { return (mRole == kRoleChild); } + bool IsChild(void) const + { + return (mRole == kRoleChild); + } /** * This method indicates whether device role is router. @@ -264,7 +288,10 @@ public: * @retval FALSE Device role is not router. * */ - bool IsRouter(void) const { return (mRole == kRoleRouter); } + bool IsRouter(void) const + { + return (mRole == kRoleRouter); + } /** * This method indicates whether device role is leader. @@ -273,7 +300,10 @@ public: * @retval FALSE Device role is not leader. * */ - bool IsLeader(void) const { return (mRole == kRoleLeader); } + bool IsLeader(void) const + { + return (mRole == kRoleLeader); + } /** * This method indicates whether device role is either router or leader. @@ -290,7 +320,10 @@ public: * @returns The Device Mode as reported in the Mode TLV. * */ - DeviceMode GetDeviceMode(void) const { return mDeviceMode; } + DeviceMode GetDeviceMode(void) const + { + return mDeviceMode; + } /** * This method sets the Device Mode as reported in the Mode TLV. @@ -309,7 +342,10 @@ public: * @returns TRUE if rx-on-when-idle, FALSE otherwise. * */ - bool IsRxOnWhenIdle(void) const { return mDeviceMode.IsRxOnWhenIdle(); } + bool IsRxOnWhenIdle(void) const + { + return mDeviceMode.IsRxOnWhenIdle(); + } /** * This method indicates whether or not the device is a Full Thread Device. @@ -317,7 +353,10 @@ public: * @returns TRUE if a Full Thread Device, FALSE otherwise. * */ - bool IsFullThreadDevice(void) const { return mDeviceMode.IsFullThreadDevice(); } + bool IsFullThreadDevice(void) const + { + return mDeviceMode.IsFullThreadDevice(); + } /** * This method indicates whether or not the device is a Minimal End Device. @@ -325,7 +364,10 @@ public: * @returns TRUE if the device is a Minimal End Device, FALSE otherwise. * */ - bool IsMinimalEndDevice(void) const { return mDeviceMode.IsMinimalEndDevice(); } + bool IsMinimalEndDevice(void) const + { + return mDeviceMode.IsMinimalEndDevice(); + } /** * This method gets the Network Data type (full set or stable subset) that this device requests. @@ -333,7 +375,10 @@ public: * @returns The Network Data type requested by this device. * */ - NetworkData::Type GetNetworkDataType(void) const { return mDeviceMode.GetNetworkDataType(); } + NetworkData::Type GetNetworkDataType(void) const + { + return mDeviceMode.GetNetworkDataType(); + } /** * This method returns a pointer to the Mesh Local Prefix. @@ -341,7 +386,10 @@ public: * @returns A reference to the Mesh Local Prefix. * */ - const Ip6::NetworkPrefix &GetMeshLocalPrefix(void) const { return mMeshLocal16.GetAddress().GetPrefix(); } + const Ip6::NetworkPrefix &GetMeshLocalPrefix(void) const + { + return mMeshLocal16.GetAddress().GetPrefix(); + } /** * This method sets the Mesh Local Prefix. @@ -380,7 +428,10 @@ public: * @returns A reference to the Thread link local address. * */ - const Ip6::Address &GetLinkLocalAddress(void) const { return mLinkLocal64.GetAddress(); } + const Ip6::Address &GetLinkLocalAddress(void) const + { + return mLinkLocal64.GetAddress(); + } /** * This method updates the link local address. @@ -396,7 +447,10 @@ public: * @returns A reference to the link-local all Thread nodes multicast address. * */ - const Ip6::Address &GetLinkLocalAllThreadNodesAddress(void) const { return mLinkLocalAllThreadNodes.GetAddress(); } + const Ip6::Address &GetLinkLocalAllThreadNodesAddress(void) const + { + return mLinkLocalAllThreadNodes.GetAddress(); + } /** * This method returns a reference to the realm-local all Thread nodes multicast address. @@ -415,7 +469,10 @@ public: * @returns A reference to the parent. * */ - Parent &GetParent(void) { return mParent; } + Parent &GetParent(void) + { + return mParent; + } /** * The method retrieves information about the parent. @@ -434,7 +491,10 @@ public: * The parent candidate is valid when attempting to attach to a new parent. * */ - Parent &GetParentCandidate(void) { return mParentCandidate; } + Parent &GetParentCandidate(void) + { + return mParentCandidate; + } /** * This method starts the process for child to search for a better parent while staying attached to its current @@ -479,7 +539,10 @@ public: * @returns The MLE Timeout value in seconds. * */ - uint32_t GetTimeout(void) const { return mTimeout; } + uint32_t GetTimeout(void) const + { + return mTimeout; + } /** * This method sets the MLE Timeout value. @@ -503,7 +566,10 @@ public: * @returns A reference to the RLOC assigned to the Thread interface. * */ - const Ip6::Address &GetMeshLocal16(void) const { return mMeshLocal16.GetAddress(); } + const Ip6::Address &GetMeshLocal16(void) const + { + return mMeshLocal16.GetAddress(); + } /** * This method returns a reference to the ML-EID assigned to the Thread interface. @@ -511,7 +577,10 @@ public: * @returns A reference to the ML-EID assigned to the Thread interface. * */ - const Ip6::Address &GetMeshLocal64(void) const { return mMeshLocal64.GetAddress(); } + const Ip6::Address &GetMeshLocal64(void) const + { + return mMeshLocal64.GetAddress(); + } /** * This method returns the Router ID of the Leader. @@ -519,7 +588,10 @@ public: * @returns The Router ID of the Leader. * */ - uint8_t GetLeaderId(void) const { return mLeaderData.GetLeaderRouterId(); } + uint8_t GetLeaderId(void) const + { + return mLeaderData.GetLeaderRouterId(); + } /** * This method retrieves the Leader's RLOC. @@ -541,7 +613,10 @@ public: * @retval kErrorDetached The Thread interface is not currently attached to a Thread Partition. * */ - Error GetLeaderAloc(Ip6::Address &aAddress) const { return GetLocatorAddress(aAddress, kAloc16Leader); } + Error GetLeaderAloc(Ip6::Address &aAddress) const + { + return GetLocatorAddress(aAddress, kAloc16Leader); + } /** * This method computes the Commissioner's ALOC. @@ -584,7 +659,10 @@ public: * @returns A reference to the send queue. * */ - const MessageQueue &GetMessageQueue(void) const { return mDelayedResponses; } + const MessageQueue &GetMessageQueue(void) const + { + return mDelayedResponses; + } /** * This method frees multicast MLE Data Response from Delayed Message Queue if any. @@ -610,7 +688,10 @@ public: * This method resets the MLE counters. * */ - void ResetCounters(void) { memset(&mCounters, 0, sizeof(mCounters)); } + void ResetCounters(void) + { + memset(&mCounters, 0, sizeof(mCounters)); + } /** * This function registers the client callback that is called when processing an MLE Parent Response message. @@ -657,7 +738,10 @@ public: * @retval false No valid network information was found. * */ - bool HasRestored(void) const { return mHasRestored; } + bool HasRestored(void) const + { + return mHasRestored; + } #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE /** @@ -666,7 +750,10 @@ public: * @returns CSL timeout * */ - uint32_t GetCslTimeout(void) const { return mCslTimeout; } + uint32_t GetCslTimeout(void) const + { + return mCslTimeout; + } /** * This method sets the CSL timeout. @@ -1383,11 +1470,11 @@ protected: { } - RxMessage & mMessage; ///< The MLE message. + RxMessage &mMessage; ///< The MLE message. const Ip6::MessageInfo &mMessageInfo; ///< The `MessageInfo` associated with the message. uint32_t mFrameCounter; ///< The frame counter from aux security header. uint32_t mKeySequence; ///< The key sequence from aux security header. - Neighbor * mNeighbor; ///< Neighbor from which message was received (can be `nullptr`). + Neighbor *mNeighbor; ///< Neighbor from which message was received (can be `nullptr`). Class mClass; ///< The message class (authoritative, peer, or unknown). }; @@ -1429,7 +1516,10 @@ protected: * This method clears the parent candidate. * */ - void ClearParentCandidate(void) { mParentCandidate.Clear(); } + void ClearParentCandidate(void) + { + mParentCandidate.Clear(); + } /** * This method checks if the destination is reachable. @@ -1467,8 +1557,8 @@ protected: * @retval kErrorNoBufs Insufficient buffers to generate the MLE Data Request message. * */ - Error SendDataRequest(const Ip6::Address & aDestination, - const uint8_t * aTlvs, + Error SendDataRequest(const Ip6::Address &aDestination, + const uint8_t *aTlvs, uint8_t aTlvsLength, uint16_t aDelay, const LinkMetrics::LinkMetrics::QueryInfo &aQueryInfo) @@ -1571,8 +1661,12 @@ protected: */ static void Log(MessageAction aAction, MessageType aType, const Ip6::Address &aAddress, uint16_t aRloc); #else - static void Log(MessageAction, MessageType, const Ip6::Address &) {} - static void Log(MessageAction, MessageType, const Ip6::Address &, uint16_t) {} + static void Log(MessageAction, MessageType, const Ip6::Address &) + { + } + static void Log(MessageAction, MessageType, const Ip6::Address &, uint16_t) + { + } #endif // #if OT_SHOULD_LOG_AT( OT_LOG_LEVEL_INFO) #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_WARN) @@ -1600,8 +1694,12 @@ protected: */ static void LogSendError(MessageType aType, Error aError); #else - static void LogProcessError(MessageType, Error) {} - static void LogSendError(MessageType, Error) {} + static void LogProcessError(MessageType, Error) + { + } + static void LogSendError(MessageType, Error) + { + } #endif // #if OT_SHOULD_LOG_AT( OT_LOG_LEVEL_WARN) /** @@ -1620,7 +1718,10 @@ protected: * @retval true if attaching/attached on the announced parameters, false otherwise. * */ - bool IsAnnounceAttach(void) const { return mAlternatePanId != Mac::kPanIdBroadcast; } + bool IsAnnounceAttach(void) const + { + return mAlternatePanId != Mac::kPanIdBroadcast; + } #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_NOTE) /** @@ -1854,7 +1955,10 @@ private: #endif #if OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE - void HandleParentSearchTimer(void) { mParentSearch.HandleTimer(); } + void HandleParentSearchTimer(void) + { + mParentSearch.HandleTimer(); + } class ParentSearch : public InstanceLocator { @@ -1901,12 +2005,15 @@ private: void ReestablishLinkWithNeighbor(Neighbor &aNeighbor); static void HandleDetachGracefullyTimer(Timer &aTimer); void HandleDetachGracefullyTimer(void); - bool IsDetachingGracefully(void) { return mDetachGracefullyTimer.IsRunning(); } - Error SendChildUpdateRequest(bool aAppendChallenge, uint32_t aTimeout); + bool IsDetachingGracefully(void) + { + return mDetachGracefullyTimer.IsRunning(); + } + Error SendChildUpdateRequest(bool aAppendChallenge, uint32_t aTimeout); #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE - Error SendDataRequest(const Ip6::Address & aDestination, - const uint8_t * aTlvs, + Error SendDataRequest(const Ip6::Address &aDestination, + const uint8_t *aTlvs, uint8_t aTlvsLength, uint16_t aDelay, const LinkMetrics::LinkMetrics::QueryInfo *aQueryInfo = nullptr); @@ -1915,8 +2022,8 @@ private: #endif #if OPENTHREAD_FTD - static void HandleDetachGracefullyAddressReleaseResponse(void * aContext, - otMessage * aMessage, + static void HandleDetachGracefullyAddressReleaseResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleDetachGracefullyAddressReleaseResponse(void); @@ -1962,16 +2069,16 @@ private: bool IsBetterParent(uint16_t aRloc16, LinkQuality aLinkQuality, uint8_t aLinkMargin, - const ConnectivityTlv & aConnectivityTlv, + const ConnectivityTlv &aConnectivityTlv, uint16_t aVersion, const Mac::CslAccuracy &aCslAccuracy); bool IsNetworkDataNewer(const LeaderData &aLeaderData); Error ProcessMessageSecurity(Crypto::AesCcm::Mode aMode, - Message & aMessage, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo, uint16_t aCmdOffset, - const SecurityHeader & aHeader); + const SecurityHeader &aHeader); #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceAloc *FindInServiceAlocs(uint16_t aAloc16); @@ -2047,10 +2154,10 @@ private: DetachGracefullyTimer mDetachGracefullyTimer; otDetachGracefullyCallback mDetachGracefullyCallback; - void * mDetachGracefullyContext; + void *mDetachGracefullyContext; otThreadParentResponseCallback mParentResponseCb; - void * mParentResponseCbContext; + void *mParentResponseCbContext; }; } // namespace Mle diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index a9e0170e0..e2e74eaa1 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -221,7 +221,7 @@ exit: Error MleRouter::BecomeLeader(void) { Error error = kErrorNone; - Router * router; + Router *router; uint32_t partitionId; uint8_t leaderId; #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE @@ -254,7 +254,7 @@ Error MleRouter::BecomeLeader(void) } #else leaderId = IsRouterIdValid(mPreviousRouterId) ? mPreviousRouterId - : Random::NonCrypto::GetUint8InRange(0, kMaxRouterId + 1); + : Random::NonCrypto::GetUint8InRange(0, kMaxRouterId + 1); #endif SetLeaderData(partitionId, mLeaderWeight, leaderId); @@ -480,7 +480,7 @@ void MleRouter::SendAdvertisement(void) { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message = nullptr; + TxMessage *message = nullptr; // Suppress MLE Advertisements when trying to attach to a better partition. // @@ -536,7 +536,7 @@ Error MleRouter::SendLinkRequest(Neighbor *aNeighbor) static const uint8_t kValidNeighborTlvs[] = {Tlv::kLinkMargin, Tlv::kRoute}; Error error = kErrorNone; - TxMessage * message = nullptr; + TxMessage *message = nullptr; Ip6::Address destination; VerifyOrExit(mLinkRequestDelay == 0 && mChallengeTimeout == 0); @@ -619,7 +619,7 @@ exit: void MleRouter::HandleLinkRequest(RxInfo &aRxInfo) { Error error = kErrorNone; - Neighbor * neighbor = nullptr; + Neighbor *neighbor = nullptr; Challenge challenge; uint16_t version; LeaderData leaderData; @@ -727,9 +727,9 @@ exit: } Error MleRouter::SendLinkAccept(const Ip6::MessageInfo &aMessageInfo, - Neighbor * aNeighbor, - const TlvList & aRequestedTlvList, - const Challenge & aChallenge) + Neighbor *aNeighbor, + const TlvList &aRequestedTlvList, + const Challenge &aChallenge) { static const uint8_t kRouterTlvs[] = {Tlv::kLinkMargin}; @@ -835,7 +835,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest) static const uint8_t kDataRequestTlvs[] = {Tlv::kNetworkData}; Error error = kErrorNone; - Router * router; + Router *router; Neighbor::State neighborState; Mac::ExtAddress extAddr; uint16_t version; @@ -1217,7 +1217,7 @@ Error MleRouter::HandleAdvertisement(RxInfo &aRxInfo) LeaderData leaderData; RouteTlv routeTlv; uint32_t partitionId; - Router * router; + Router *router; uint8_t routerId; uint8_t routerCount; @@ -1603,7 +1603,7 @@ bool MleRouter::UpdateLinkQualityOut(const RouteTlv &aRouteTlv, Router &aNeighbo uint8_t myRouterId; uint8_t myRouteCount; uint8_t oldLinkCost; - Router * nextHop; + Router *nextHop; myRouterId = RouterIdFromRloc16(GetRloc16()); VerifyOrExit(aRouteTlv.IsRouterIdSet(myRouterId)); @@ -1640,8 +1640,8 @@ void MleRouter::HandleParentRequest(RxInfo &aRxInfo) uint16_t version; uint8_t scanMask; Challenge challenge; - Router * leader; - Child * child; + Router *leader; + Child *child; uint8_t modeBitmask; DeviceMode mode; @@ -2019,7 +2019,7 @@ void MleRouter::SendParentResponse(Child *aChild, const Challenge &aChallenge, b { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message; + TxMessage *message; uint16_t delay; VerifyOrExit((message = NewMleMessage(kCommandParentResponse)) != nullptr, error = kErrorNoBufs); @@ -2302,8 +2302,8 @@ void MleRouter::HandleChildIdRequest(RxInfo &aRxInfo) MeshCoP::Timestamp timestamp; bool needsActiveDatasetTlv; bool needsPendingDatasetTlv; - Child * child; - Router * router; + Child *child; + Router *router; uint8_t numTlvs; Log(kMessageReceive, kTypeChildIdRequest, aRxInfo.mMessageInfo.GetPeerAddr()); @@ -2478,7 +2478,7 @@ void MleRouter::HandleChildUpdateRequest(RxInfo &aRxInfo) Challenge challenge; LeaderData leaderData; uint32_t timeout; - Child * child; + Child *child; DeviceMode oldMode; TlvList requestedTlvList; TlvList tlvList; @@ -2685,7 +2685,7 @@ void MleRouter::HandleChildUpdateResponse(RxInfo &aRxInfo) uint32_t linkFrameCounter; uint32_t mleFrameCounter; LeaderData leaderData; - Child * child; + Child *child; uint16_t addrOffset; uint16_t addrLength; @@ -3023,7 +3023,7 @@ exit: Error MleRouter::SendDiscoveryResponse(const Ip6::Address &aDestination, const Message &aDiscoverRequestMessage) { Error error = kErrorNone; - TxMessage * message; + TxMessage *message; uint16_t startOffset; Tlv tlv; MeshCoP::DiscoveryResponseTlv discoveryResponseTlv; @@ -3121,7 +3121,7 @@ Error MleRouter::SendChildIdResponse(Child &aChild) { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message; + TxMessage *message; VerifyOrExit((message = NewMleMessage(kCommandChildIdResponse)) != nullptr, error = kErrorNoBufs); SuccessOrExit(error = message->AppendSourceAddressTlv()); @@ -3213,7 +3213,7 @@ Error MleRouter::SendChildUpdateRequest(Child &aChild) Error error = kErrorNone; Ip6::Address destination; - TxMessage * message = nullptr; + TxMessage *message = nullptr; if (!aChild.IsRxOnWhenIdle()) { @@ -3267,10 +3267,10 @@ exit: return error; } -void MleRouter::SendChildUpdateResponse(Child * aChild, +void MleRouter::SendChildUpdateResponse(Child *aChild, const Ip6::MessageInfo &aMessageInfo, - const TlvList & aTlvList, - const Challenge & aChallenge) + const TlvList &aTlvList, + const Challenge &aChallenge) { Error error = kErrorNone; TxMessage *message; @@ -3362,15 +3362,15 @@ exit: } void MleRouter::SendDataResponse(const Ip6::Address &aDestination, - const TlvList & aTlvList, + const TlvList &aTlvList, uint16_t aDelay, - const Message * aRequestMessage) + const Message *aRequestMessage) { OT_UNUSED_VARIABLE(aRequestMessage); Error error = kErrorNone; TxMessage *message = nullptr; - Neighbor * neighbor; + Neighbor *neighbor; if (mRetrieveNewNetworkData) { @@ -3689,7 +3689,7 @@ Error MleRouter::SendAddressSolicit(ThreadStatusTlv::Status aStatus) { Error error = kErrorNone; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; VerifyOrExit(!mAddressSolicitPending); @@ -3725,7 +3725,7 @@ void MleRouter::SendAddressRelease(void) { Error error = kErrorNone; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message; + Coap::Message *message; message = Get().NewPriorityConfirmablePostMessage(kUriAddressRelease); VerifyOrExit(message != nullptr, error = kErrorNoBufs); @@ -3744,8 +3744,8 @@ exit: LogSendError(kTypeAddressRelease, error); } -void MleRouter::HandleAddressSolicitResponse(void * aContext, - otMessage * aMessage, +void MleRouter::HandleAddressSolicitResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -3753,7 +3753,7 @@ void MleRouter::HandleAddressSolicitResponse(void * aContext, AsCoreTypePtr(aMessageInfo), aResult); } -void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage, +void MleRouter::HandleAddressSolicitResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -3761,8 +3761,8 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage, uint16_t rloc16; ThreadRouterMaskTlv routerMaskTlv; uint8_t routerId; - Router * router; - Router * leader; + Router *router; + Router *leader; bool isRouterIdAllocated; mAddressSolicitPending = false; @@ -3867,7 +3867,7 @@ template <> void MleRouter::HandleTmf(Coap::Message &aMessag { Error error = kErrorNone; ThreadStatusTlv::Status responseStatus = ThreadStatusTlv::kNoAddressAvailable; - Router * router = nullptr; + Router *router = nullptr; Mac::ExtAddress extAddress; uint16_t rloc16; uint8_t status; @@ -3962,9 +3962,9 @@ exit: } } -void MleRouter::SendAddressSolicitResponse(const Coap::Message & aRequest, +void MleRouter::SendAddressSolicitResponse(const Coap::Message &aRequest, ThreadStatusTlv::Status aResponseStatus, - const Router * aRouter, + const Router *aRouter, const Ip6::MessageInfo &aMessageInfo) { Coap::Message *message = Get().NewPriorityResponseMessage(aRequest); @@ -4000,7 +4000,7 @@ template <> void MleRouter::HandleTmf(Coap::Message &aMessag uint16_t rloc16; Mac::ExtAddress extAddress; uint8_t routerId; - Router * router; + Router *router; VerifyOrExit(mRole == kRoleLeader); @@ -4321,7 +4321,7 @@ Error MleRouter::SendTimeSync(void) { Error error = kErrorNone; Ip6::Address destination; - TxMessage * message = nullptr; + TxMessage *message = nullptr; VerifyOrExit((message = NewMleMessage(kCommandTimeSync)) != nullptr, error = kErrorNoBufs); diff --git a/src/core/thread/mle_router.hpp b/src/core/thread/mle_router.hpp index e5960f977..a2c16ec67 100644 --- a/src/core/thread/mle_router.hpp +++ b/src/core/thread/mle_router.hpp @@ -166,7 +166,10 @@ public: * @returns The preferred Partition Id value. * */ - uint32_t GetPreferredLeaderPartitionId(void) const { return mPreferredLeaderPartitionId; } + uint32_t GetPreferredLeaderPartitionId(void) const + { + return mPreferredLeaderPartitionId; + } /** * This method sets the preferred Partition Id when operating in the Leader role for certification testing. @@ -174,7 +177,10 @@ public: * @param[in] aPartitionId The preferred Leader Partition Id. * */ - void SetPreferredLeaderPartitionId(uint32_t aPartitionId) { mPreferredLeaderPartitionId = aPartitionId; } + void SetPreferredLeaderPartitionId(uint32_t aPartitionId) + { + mPreferredLeaderPartitionId = aPartitionId; + } #endif /** @@ -195,7 +201,10 @@ public: * This method gets the Partition Id which the device joined successfully once. * */ - uint32_t GetPreviousPartitionId(void) const { return mPreviousPartitionId; } + uint32_t GetPreviousPartitionId(void) const + { + return mPreviousPartitionId; + } /** * This method sets the Partition Id which the device joins successfully. @@ -203,7 +212,10 @@ public: * @param[in] aPartitionId The Partition Id. * */ - void SetPreviousPartitionId(uint32_t aPartitionId) { mPreviousPartitionId = aPartitionId; } + void SetPreviousPartitionId(uint32_t aPartitionId) + { + mPreviousPartitionId = aPartitionId; + } /** * This method sets the Router Id. @@ -229,7 +241,10 @@ public: * @returns The NETWORK_ID_TIMEOUT value. * */ - uint8_t GetNetworkIdTimeout(void) const { return mNetworkIdTimeout; } + uint8_t GetNetworkIdTimeout(void) const + { + return mNetworkIdTimeout; + } /** * This method sets the NETWORK_ID_TIMEOUT value. @@ -237,7 +252,10 @@ public: * @param[in] aTimeout The NETWORK_ID_TIMEOUT value. * */ - void SetNetworkIdTimeout(uint8_t aTimeout) { mNetworkIdTimeout = aTimeout; } + void SetNetworkIdTimeout(uint8_t aTimeout) + { + mNetworkIdTimeout = aTimeout; + } /** * This method returns the route cost to a RLOC16. @@ -275,7 +293,10 @@ public: * @returns The ROUTER_SELECTION_JITTER value. * */ - uint8_t GetRouterSelectionJitter(void) const { return mRouterSelectionJitter; } + uint8_t GetRouterSelectionJitter(void) const + { + return mRouterSelectionJitter; + } /** * This method sets the ROUTER_SELECTION_JITTER value. @@ -291,7 +312,10 @@ public: * @returns The current router selection jitter timeout value. * */ - uint8_t GetRouterSelectionJitterTimeout(void) const { return mRouterSelectionJitterTimeout; } + uint8_t GetRouterSelectionJitterTimeout(void) const + { + return mRouterSelectionJitterTimeout; + } /** * This method returns the ROUTER_UPGRADE_THRESHOLD value. @@ -299,7 +323,10 @@ public: * @returns The ROUTER_UPGRADE_THRESHOLD value. * */ - uint8_t GetRouterUpgradeThreshold(void) const { return mRouterUpgradeThreshold; } + uint8_t GetRouterUpgradeThreshold(void) const + { + return mRouterUpgradeThreshold; + } /** * This method sets the ROUTER_UPGRADE_THRESHOLD value. @@ -307,7 +334,10 @@ public: * @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value. * */ - void SetRouterUpgradeThreshold(uint8_t aThreshold) { mRouterUpgradeThreshold = aThreshold; } + void SetRouterUpgradeThreshold(uint8_t aThreshold) + { + mRouterUpgradeThreshold = aThreshold; + } /** * This method returns the ROUTER_DOWNGRADE_THRESHOLD value. @@ -315,7 +345,10 @@ public: * @returns The ROUTER_DOWNGRADE_THRESHOLD value. * */ - uint8_t GetRouterDowngradeThreshold(void) const { return mRouterDowngradeThreshold; } + uint8_t GetRouterDowngradeThreshold(void) const + { + return mRouterDowngradeThreshold; + } /** * This method sets the ROUTER_DOWNGRADE_THRESHOLD value. @@ -323,7 +356,10 @@ public: * @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value. * */ - void SetRouterDowngradeThreshold(uint8_t aThreshold) { mRouterDowngradeThreshold = aThreshold; } + void SetRouterDowngradeThreshold(uint8_t aThreshold) + { + mRouterDowngradeThreshold = aThreshold; + } /** * This method returns if the REED is expected to become Router soon. @@ -409,7 +445,10 @@ public: * @retval FALSE If @p aRouterId is not a valid Router ID. * */ - static bool IsRouterIdValid(uint8_t aRouterId) { return aRouterId <= kMaxRouterId; } + static bool IsRouterIdValid(uint8_t aRouterId) + { + return aRouterId <= kMaxRouterId; + } /** * This method fills an ConnectivityTlv. @@ -426,7 +465,10 @@ public: * @retval kErrorNoBufs Insufficient buffers to generate the MLE Child Update Request message. * */ - Error SendChildUpdateRequest(void) { return Mle::SendChildUpdateRequest(); } + Error SendChildUpdateRequest(void) + { + return Mle::SendChildUpdateRequest(); + } Error SendLinkRequest(Neighbor *aNeighbor); @@ -449,7 +491,10 @@ public: * @returns The assigned parent priority value, -2 means not assigned. * */ - int8_t GetAssignParentPriority(void) const { return mParentPriority; } + int8_t GetAssignParentPriority(void) const + { + return mParentPriority; + } /** * This method sets the parent priority. @@ -521,7 +566,10 @@ public: * @param[in] aDelay The delay before registering Backbone Router service. * */ - void SetBackboneRouterRegistrationDelay(uint8_t aDelay) { mBackboneRouterRegistrationDelay = aDelay; } + void SetBackboneRouterRegistrationDelay(uint8_t aDelay) + { + mBackboneRouterRegistrationDelay = aDelay; + } #endif /** @@ -552,7 +600,10 @@ public: * @param[in] aEnabled TRUE if the device was commissioned using CCM, FALSE otherwise. * */ - void SetCcmEnabled(bool aEnabled) { mCcmEnabled = aEnabled; } + void SetCcmEnabled(bool aEnabled) + { + mCcmEnabled = aEnabled; + } /** * This function sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled. @@ -560,7 +611,10 @@ public: * @param[in] aEnabled TRUE to enable Security Policy TLV version-threshold for routing, FALSE otherwise. * */ - void SetThreadVersionCheckEnabled(bool aEnabled) { mThreadVersionCheckEnabled = aEnabled; } + void SetThreadVersionCheckEnabled(bool aEnabled) + { + mThreadVersionCheckEnabled = aEnabled; + } #endif private: @@ -595,27 +649,27 @@ private: Error ProcessRouteTlv(RxInfo &aRxInfo, RouteTlv &aRouteTlv); void StopAdvertiseTrickleTimer(void); Error SendAddressSolicit(ThreadStatusTlv::Status aStatus); - void SendAddressSolicitResponse(const Coap::Message & aRequest, + void SendAddressSolicitResponse(const Coap::Message &aRequest, ThreadStatusTlv::Status aResponseStatus, - const Router * aRouter, + const Router *aRouter, const Ip6::MessageInfo &aMessageInfo); void SendAddressRelease(void); void SendAdvertisement(void); Error SendLinkAccept(const Ip6::MessageInfo &aMessageInfo, - Neighbor * aNeighbor, - const TlvList & aRequestedTlvList, - const Challenge & aChallenge); + Neighbor *aNeighbor, + const TlvList &aRequestedTlvList, + const Challenge &aChallenge); void SendParentResponse(Child *aChild, const Challenge &aChallenge, bool aRoutersOnlyRequest); Error SendChildIdResponse(Child &aChild); Error SendChildUpdateRequest(Child &aChild); - void SendChildUpdateResponse(Child * aChild, + void SendChildUpdateResponse(Child *aChild, const Ip6::MessageInfo &aMessageInfo, - const TlvList & aTlvList, - const Challenge & aChallenge); + const TlvList &aTlvList, + const Challenge &aChallenge); void SendDataResponse(const Ip6::Address &aDestination, - const TlvList & aTlvList, + const TlvList &aTlvList, uint16_t aDelay, - const Message * aRequestMessage = nullptr); + const Message *aRequestMessage = nullptr); Error SendDiscoveryResponse(const Ip6::Address &aDestination, const Message &aDiscoverRequestMessage); void SetStateRouter(uint16_t aRloc16); void SetStateLeader(uint16_t aRloc16, LeaderStartMode aStartMode); @@ -626,8 +680,8 @@ private: bool UpdateLinkQualityOut(const RouteTlv &aRouteTlv, Router &aNeighbor, bool &aResetAdvInterval); bool HasNeighborWithGoodLinkQuality(void) const; - static void HandleAddressSolicitResponse(void * aContext, - otMessage * aMessage, + static void HandleAddressSolicitResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleAddressSolicitResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); @@ -697,7 +751,7 @@ private: #endif otThreadDiscoveryRequestCallback mDiscoveryRequestCallback; - void * mDiscoveryRequestCallbackContext; + void *mDiscoveryRequestCallbackContext; }; DeclareTmfHandler(MleRouter, kUriAddressSolicit); diff --git a/src/core/thread/mlr_manager.cpp b/src/core/thread/mlr_manager.cpp index 298091e30..13ec8324e 100644 --- a/src/core/thread/mlr_manager.cpp +++ b/src/core/thread/mlr_manager.cpp @@ -150,7 +150,7 @@ exit: return ret; } -void MlrManager::UpdateProxiedSubscriptions(Child & aChild, +void MlrManager::UpdateProxiedSubscriptions(Child &aChild, const Ip6::Address *aOldMlrRegisteredAddresses, uint16_t aOldMlrRegisteredAddressNum) { @@ -317,11 +317,11 @@ exit: } #if (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE) && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE -Error MlrManager::RegisterMulticastListeners(const otIp6Address * aAddresses, +Error MlrManager::RegisterMulticastListeners(const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, otIp6RegisterMulticastListenersCallback aCallback, - void * aContext) + void *aContext) { Error error; @@ -351,8 +351,8 @@ exit: return error; } -void MlrManager::HandleRegisterMulticastListenersResponse(void * aContext, - otMessage * aMessage, +void MlrManager::HandleRegisterMulticastListenersResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -360,7 +360,7 @@ void MlrManager::HandleRegisterMulticastListenersResponse(void * a AsCoreTypePtr(aMessageInfo), aResult); } -void MlrManager::HandleRegisterMulticastListenersResponse(otMessage * aMessage, +void MlrManager::HandleRegisterMulticastListenersResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -371,7 +371,7 @@ void MlrManager::HandleRegisterMulticastListenersResponse(otMessage * a Ip6::Address failedAddresses[Ip6AddressesTlv::kMaxAddresses]; uint8_t failedAddressNum = 0; otIp6RegisterMulticastListenersCallback callback = mRegisterMulticastListenersCallback; - void * context = mRegisterMulticastListenersContext; + void *context = mRegisterMulticastListenersContext; mRegisterMulticastListenersPending = false; mRegisterMulticastListenersCallback = nullptr; @@ -388,17 +388,17 @@ void MlrManager::HandleRegisterMulticastListenersResponse(otMessage * a #endif // (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE) && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE -Error MlrManager::SendMulticastListenerRegistrationMessage(const otIp6Address * aAddresses, +Error MlrManager::SendMulticastListenerRegistrationMessage(const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, Coap::ResponseHandler aResponseHandler, - void * aResponseContext) + void *aResponseContext) { OT_UNUSED_VARIABLE(aTimeout); Error error = kErrorNone; - Mle::MleRouter & mle = Get(); - Coap::Message * message = nullptr; + Mle::MleRouter &mle = Get(); + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); Ip6AddressesTlv addressesTlv; @@ -452,8 +452,8 @@ exit: return error; } -void MlrManager::HandleMulticastListenerRegistrationResponse(void * aContext, - otMessage * aMessage, +void MlrManager::HandleMulticastListenerRegistrationResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -461,7 +461,7 @@ void MlrManager::HandleMulticastListenerRegistrationResponse(void * AsCoapMessagePtr(aMessage), AsCoreTypePtr(aMessageInfo), aResult); } -void MlrManager::HandleMulticastListenerRegistrationResponse(Coap::Message * aMessage, +void MlrManager::HandleMulticastListenerRegistrationResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -502,9 +502,9 @@ void MlrManager::HandleMulticastListenerRegistrationResponse(Coap::Message * Error MlrManager::ParseMulticastListenerRegistrationResponse(Error aResult, Coap::Message *aMessage, - uint8_t & aStatus, - Ip6::Address * aFailedAddresses, - uint8_t & aFailedAddressNum) + uint8_t &aStatus, + Ip6::Address *aFailedAddresses, + uint8_t &aFailedAddressNum) { Error error; uint16_t addressesOffset, addressesLength; @@ -702,7 +702,7 @@ void MlrManager::LogMulticastAddresses(void) } void MlrManager::AppendToUniqueAddressList(Ip6::Address (&aAddresses)[Ip6AddressesTlv::kMaxAddresses], - uint8_t & aAddressNum, + uint8_t &aAddressNum, const Ip6::Address &aAddress) { #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE diff --git a/src/core/thread/mlr_manager.hpp b/src/core/thread/mlr_manager.hpp index 6eda998ed..31b192b7e 100644 --- a/src/core/thread/mlr_manager.hpp +++ b/src/core/thread/mlr_manager.hpp @@ -106,7 +106,7 @@ public: * @param[in] aOldMlrRegisteredAddressNum The number of previously registered IPv6 addresses. * */ - void UpdateProxiedSubscriptions(Child & aChild, + void UpdateProxiedSubscriptions(Child &aChild, const Ip6::Address *aOldMlrRegisteredAddresses, uint16_t aOldMlrRegisteredAddressNum); #endif @@ -134,42 +134,42 @@ public: * @retval kErrorNoBufs If insufficient message buffers available. * */ - Error RegisterMulticastListeners(const otIp6Address * aAddresses, + Error RegisterMulticastListeners(const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, otIp6RegisterMulticastListenersCallback aCallback, - void * aContext); + void *aContext); #endif private: void HandleNotifierEvents(Events aEvents); void SendMulticastListenerRegistration(void); - Error SendMulticastListenerRegistrationMessage(const otIp6Address * aAddresses, + Error SendMulticastListenerRegistrationMessage(const otIp6Address *aAddresses, uint8_t aAddressNum, - const uint32_t * aTimeout, + const uint32_t *aTimeout, Coap::ResponseHandler aResponseHandler, - void * aResponseContext); + void *aResponseContext); - static void HandleMulticastListenerRegistrationResponse(void * aContext, - otMessage * aMessage, + static void HandleMulticastListenerRegistrationResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); - void HandleMulticastListenerRegistrationResponse(Coap::Message * aMessage, + void HandleMulticastListenerRegistrationResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); static Error ParseMulticastListenerRegistrationResponse(Error aResult, Coap::Message *aMessage, - uint8_t & aStatus, - Ip6::Address * aFailedAddresses, - uint8_t & aFailedAddressNum); + uint8_t &aStatus, + Ip6::Address *aFailedAddresses, + uint8_t &aFailedAddressNum); #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE - static void HandleRegisterMulticastListenersResponse(void * aContext, - otMessage * aMessage, + static void HandleRegisterMulticastListenersResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); - void HandleRegisterMulticastListenersResponse(otMessage * aMessage, + void HandleRegisterMulticastListenersResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); #endif @@ -193,7 +193,7 @@ private: uint8_t aFailedAddressNum); void AppendToUniqueAddressList(Ip6::Address (&aAddresses)[Ip6AddressesTlv::kMaxAddresses], - uint8_t & aAddressNum, + uint8_t &aAddressNum, const Ip6::Address &aAddress); static bool AddressListContains(const Ip6::Address *aAddressList, uint8_t aAddressListSize, @@ -215,7 +215,7 @@ private: #if (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE) && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE otIp6RegisterMulticastListenersCallback mRegisterMulticastListenersCallback; - void * mRegisterMulticastListenersContext; + void *mRegisterMulticastListenersContext; #endif uint32_t mReregistrationDelay; diff --git a/src/core/thread/neighbor_table.cpp b/src/core/thread/neighbor_table.cpp index 4d74c18a1..9355473bb 100644 --- a/src/core/thread/neighbor_table.cpp +++ b/src/core/thread/neighbor_table.cpp @@ -136,7 +136,7 @@ Neighbor *NeighborTable::FindChildOrRouter(const Neighbor::AddressMatcher &aMatc Neighbor *NeighborTable::FindNeighbor(const Ip6::Address &aIp6Address, Neighbor::StateFilter aFilter) { - Neighbor * neighbor = nullptr; + Neighbor *neighbor = nullptr; Mac::Address macAddress; if (aIp6Address.IsLinkLocal()) diff --git a/src/core/thread/neighbor_table.hpp b/src/core/thread/neighbor_table.hpp index abe2df67f..e23bbd078 100644 --- a/src/core/thread/neighbor_table.hpp +++ b/src/core/thread/neighbor_table.hpp @@ -124,7 +124,7 @@ public: * @returns A pointer to the `Neighbor` corresponding to @p aMacAddress, `nullptr` otherwise. * */ - Neighbor *FindParent(const Mac::Address & aMacAddress, + Neighbor *FindParent(const Mac::Address &aMacAddress, Neighbor::StateFilter aFilter = Neighbor::kInStateValidOrRestoring); /** @@ -160,7 +160,7 @@ public: * @returns A pointer to the `Neighbor` corresponding to @p aMacAddress, `nullptr` otherwise. * */ - Neighbor *FindNeighbor(const Mac::Address & aMacAddress, + Neighbor *FindNeighbor(const Mac::Address &aMacAddress, Neighbor::StateFilter aFilter = Neighbor::kInStateValidOrRestoring); #if OPENTHREAD_FTD @@ -174,7 +174,7 @@ public: * @returns A pointer to the `Neighbor` corresponding to @p aIp6Address, `nullptr` otherwise. * */ - Neighbor *FindNeighbor(const Ip6::Address & aIp6Address, + Neighbor *FindNeighbor(const Ip6::Address &aIp6Address, Neighbor::StateFilter aFilter = Neighbor::kInStateValidOrRestoring); /** @@ -213,7 +213,10 @@ public: * @param[in] aCallback A pointer to callback handler function. * */ - void RegisterCallback(Callback aCallback) { mCallback = aCallback; } + void RegisterCallback(Callback aCallback) + { + mCallback = aCallback; + } /** * This method signals a "neighbor table changed" event. diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 38b537cac..04993b17b 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -425,7 +425,7 @@ void MutableNetworkData::RemoveTemporaryDataIn(PrefixTlv &aPrefix) case NetworkDataTlv::kTypeBorderRouter: { BorderRouterTlv *borderRouter = As(cur); - ContextTlv * context = aPrefix.FindSubTlv(); + ContextTlv *context = aPrefix.FindSubTlv(); // Replace p_border_router_16 for (BorderRouterEntry *entry = borderRouter->GetFirstEntry(); entry <= borderRouter->GetLastEntry(); @@ -540,7 +540,7 @@ const ServiceTlv *NetworkData::FindService(uint32_t aEnterpriseNumber, return serviceTlv; } -const ServiceTlv *NetworkData::FindNextService(const ServiceTlv * aPrevServiceTlv, +const ServiceTlv *NetworkData::FindNextService(const ServiceTlv *aPrevServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const @@ -562,14 +562,14 @@ const ServiceTlv *NetworkData::FindNextService(const ServiceTlv * aPrevServiceTl return NetworkData(GetInstance(), tlvs, length).FindService(aEnterpriseNumber, aServiceData, aServiceMatchMode); } -const ServiceTlv *NetworkData::FindNextThreadService(const ServiceTlv * aPrevServiceTlv, +const ServiceTlv *NetworkData::FindNextThreadService(const ServiceTlv *aPrevServiceTlv, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const { return FindNextService(aPrevServiceTlv, ServiceTlv::kThreadEnterpriseNumber, aServiceData, aServiceMatchMode); } -bool NetworkData::MatchService(const ServiceTlv & aServiceTlv, +bool NetworkData::MatchService(const ServiceTlv &aServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) @@ -728,7 +728,7 @@ Error NetworkData::FindBorderRouters(RoleFilter aRoleFilter, uint16_t aRlocs[], private: RoleFilter mRoleFilter; - uint16_t * mRlocs; + uint16_t *mRlocs; uint8_t mLength; uint8_t mMaxLength; }; diff --git a/src/core/thread/network_data.hpp b/src/core/thread/network_data.hpp index 340cac8ff..ff1825746 100644 --- a/src/core/thread/network_data.hpp +++ b/src/core/thread/network_data.hpp @@ -465,7 +465,7 @@ protected: * @returns A pointer to the next matching Service TLV if one is found or `nullptr` if it cannot be found. * */ - const ServiceTlv *FindNextService(const ServiceTlv * aPrevServiceTlv, + const ServiceTlv *FindNextService(const ServiceTlv *aPrevServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const; @@ -484,7 +484,7 @@ protected: * @returns A pointer to the next matching Thread Service TLV if one is found or `nullptr` if it cannot be found. * */ - const ServiceTlv *FindNextThreadService(const ServiceTlv * aPrevServiceTlv, + const ServiceTlv *FindNextThreadService(const ServiceTlv *aPrevServiceTlv, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const; @@ -554,14 +554,14 @@ private: struct Config { - OnMeshPrefixConfig * mOnMeshPrefix; + OnMeshPrefixConfig *mOnMeshPrefix; ExternalRouteConfig *mExternalRoute; - ServiceConfig * mService; + ServiceConfig *mService; }; Error Iterate(Iterator &aIterator, uint16_t aRloc16, Config &aConfig) const; - static bool MatchService(const ServiceTlv & aServiceTlv, + static bool MatchService(const ServiceTlv &aServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode); diff --git a/src/core/thread/network_data_leader.cpp b/src/core/thread/network_data_leader.cpp index 91a7408b5..1fda49a93 100644 --- a/src/core/thread/network_data_leader.cpp +++ b/src/core/thread/network_data_leader.cpp @@ -66,7 +66,7 @@ void LeaderBase::Reset(void) Error LeaderBase::GetServiceId(uint32_t aEnterpriseNumber, const ServiceData &aServiceData, bool aServerStable, - uint8_t & aServiceId) const + uint8_t &aServiceId) const { Error error = kErrorNotFound; Iterator iterator = kIteratorInit; @@ -131,7 +131,7 @@ const PrefixTlv *LeaderBase::FindNextMatchingPrefix(const Ip6::Address &aAddress Error LeaderBase::GetContext(const Ip6::Address &aAddress, Lowpan::Context &aContext) const { - const PrefixTlv * prefix = nullptr; + const PrefixTlv *prefix = nullptr; const ContextTlv *contextTlv; aContext.mPrefix.SetLength(0); @@ -304,7 +304,7 @@ Error LeaderBase::ExternalRouteLookup(uint8_t aDomainId, const Ip6::Address &aDe { Error error = kErrorNoRoute; TlvIterator tlvIterator(GetTlvsStart(), GetTlvsEnd()); - const PrefixTlv * prefixTlv; + const PrefixTlv *prefixTlv; const HasRouteEntry *bestRouteEntry = nullptr; uint8_t bestMatchLength = 0; @@ -356,7 +356,7 @@ Error LeaderBase::DefaultRouteLookup(const PrefixTlv &aPrefix, uint16_t &aRloc16 { Error error = kErrorNoRoute; TlvIterator subTlvIterator(aPrefix); - const BorderRouterTlv * borderRouter; + const BorderRouterTlv *borderRouter; const BorderRouterEntry *route = nullptr; while ((borderRouter = subTlvIterator.Iterate()) != nullptr) @@ -453,7 +453,7 @@ const CommissioningDataTlv *LeaderBase::GetCommissioningData(void) const const MeshCoP::Tlv *LeaderBase::GetCommissioningDataSubTlv(MeshCoP::Tlv::Type aType) const { - const MeshCoP::Tlv * rval = nullptr; + const MeshCoP::Tlv *rval = nullptr; const NetworkDataTlv *commissioningDataTlv; commissioningDataTlv = GetCommissioningData(); @@ -501,7 +501,7 @@ exit: Error LeaderBase::SteeringDataCheck(const FilterIndexes &aFilterIndexes) const { Error error = kErrorNone; - const MeshCoP::Tlv * steeringDataTlv; + const MeshCoP::Tlv *steeringDataTlv; MeshCoP::SteeringData steeringData; steeringDataTlv = GetCommissioningDataSubTlv(MeshCoP::Tlv::kSteeringData); diff --git a/src/core/thread/network_data_leader.hpp b/src/core/thread/network_data_leader.hpp index 663e5e160..fab7ddd4e 100644 --- a/src/core/thread/network_data_leader.hpp +++ b/src/core/thread/network_data_leader.hpp @@ -263,7 +263,7 @@ public: Error GetServiceId(uint32_t aEnterpriseNumber, const ServiceData &aServiceData, bool aServerStable, - uint8_t & aServiceId) const; + uint8_t &aServiceId) const; /** * This methods gets the preferred NAT64 prefix from network data. diff --git a/src/core/thread/network_data_leader_ftd.cpp b/src/core/thread/network_data_leader_ftd.cpp index aa5fb0c52..7858c860a 100644 --- a/src/core/thread/network_data_leader_ftd.cpp +++ b/src/core/thread/network_data_leader_ftd.cpp @@ -178,7 +178,7 @@ template <> void Leader::HandleTmf(Coap::Message &aMessage, bool hasSessionId = false; bool hasValidTlv = false; uint16_t sessionId = 0; - CommissioningDataTlv * commDataTlv; + CommissioningDataTlv *commDataTlv; MeshCoP::Tlv *cur; MeshCoP::Tlv *end; @@ -284,14 +284,14 @@ exit: } } -void Leader::SendCommissioningGetResponse(const Coap::Message & aRequest, +void Leader::SendCommissioningGetResponse(const Coap::Message &aRequest, uint16_t aLength, const Ip6::MessageInfo &aMessageInfo) { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; CommissioningDataTlv *commDataTlv; - uint8_t * data = nullptr; + uint8_t *data = nullptr; uint8_t length = 0; message = Get().NewPriorityResponseMessage(aRequest); @@ -339,8 +339,8 @@ exit: FreeMessageOnError(message, error); } -void Leader::SendCommissioningSetResponse(const Coap::Message & aRequest, - const Ip6::MessageInfo & aMessageInfo, +void Leader::SendCommissioningSetResponse(const Coap::Message &aRequest, + const Ip6::MessageInfo &aMessageInfo, MeshCoP::StateTlv::State aState) { Error error = kErrorNone; @@ -771,7 +771,7 @@ exit: Error Leader::AddService(const ServiceTlv &aService, ChangedFlags &aChangedFlags) { Error error = kErrorNone; - ServiceTlv * dstService; + ServiceTlv *dstService; ServiceData serviceData; const ServerTlv *server; @@ -814,7 +814,7 @@ exit: Error Leader::AddHasRoute(const HasRouteTlv &aHasRoute, PrefixTlv &aDstPrefix, ChangedFlags &aChangedFlags) { Error error = kErrorNone; - HasRouteTlv * dstHasRoute = aDstPrefix.FindSubTlv(aHasRoute.IsStable()); + HasRouteTlv *dstHasRoute = aDstPrefix.FindSubTlv(aHasRoute.IsStable()); const HasRouteEntry *entry = aHasRoute.GetFirstEntry(); if (dstHasRoute == nullptr) @@ -851,8 +851,8 @@ exit: Error Leader::AddBorderRouter(const BorderRouterTlv &aBorderRouter, PrefixTlv &aDstPrefix, ChangedFlags &aChangedFlags) { Error error = kErrorNone; - BorderRouterTlv * dstBorderRouter = aDstPrefix.FindSubTlv(aBorderRouter.IsStable()); - ContextTlv * dstContext = aDstPrefix.FindSubTlv(); + BorderRouterTlv *dstBorderRouter = aDstPrefix.FindSubTlv(aBorderRouter.IsStable()); + ContextTlv *dstContext = aDstPrefix.FindSubTlv(); uint8_t contextId = 0; const BorderRouterEntry *entry = aBorderRouter.GetFirstEntry(); @@ -1034,7 +1034,7 @@ void Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode, ChangedFlags &aC void Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode, const NetworkData &aExcludeNetworkData, - ChangedFlags & aChangedFlags) + ChangedFlags &aChangedFlags) { // Remove entries from Network Data matching `aRloc16` (using // `aMatchMode` to determine the match) but exclude any entries @@ -1050,7 +1050,7 @@ void Leader::RemoveRloc(uint16_t aRloc16, { case NetworkDataTlv::kTypePrefix: { - PrefixTlv * prefix = As(cur); + PrefixTlv *prefix = As(cur); const PrefixTlv *excludePrefix = aExcludeNetworkData.FindPrefix(prefix->GetPrefix(), prefix->GetPrefixLength()); @@ -1067,7 +1067,7 @@ void Leader::RemoveRloc(uint16_t aRloc16, case NetworkDataTlv::kTypeService: { - ServiceTlv * service = As(cur); + ServiceTlv *service = As(cur); ServiceData serviceData; const ServiceTlv *excludeService; @@ -1095,17 +1095,17 @@ void Leader::RemoveRloc(uint16_t aRloc16, } } -void Leader::RemoveRlocInPrefix(PrefixTlv & aPrefix, +void Leader::RemoveRlocInPrefix(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags) + ChangedFlags &aChangedFlags) { // Remove entries in `aPrefix` TLV matching the given `aRloc16` // excluding any entries that are present in `aExcludePrefix`. NetworkDataTlv *cur = aPrefix.GetSubTlvs(); - ContextTlv * context; + ContextTlv *context; while (cur < aPrefix.GetNext()) { @@ -1158,17 +1158,17 @@ void Leader::RemoveRlocInPrefix(PrefixTlv & aPrefix, } } -void Leader::RemoveRlocInService(ServiceTlv & aService, +void Leader::RemoveRlocInService(ServiceTlv &aService, uint16_t aRloc16, MatchMode aMatchMode, const ServiceTlv *aExcludeService, - ChangedFlags & aChangedFlags) + ChangedFlags &aChangedFlags) { // Remove entries in `aService` TLV matching the given `aRloc16` // excluding any entries that are present in `aExcludeService`. NetworkDataTlv *start = aService.GetSubTlvs(); - ServerTlv * server; + ServerTlv *server; while ((server = NetworkDataTlv::Find(start, aService.GetNext())) != nullptr) { @@ -1186,12 +1186,12 @@ void Leader::RemoveRlocInService(ServiceTlv & aService, } } -void Leader::RemoveRlocInHasRoute(PrefixTlv & aPrefix, - HasRouteTlv & aHasRoute, +void Leader::RemoveRlocInHasRoute(PrefixTlv &aPrefix, + HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags) + ChangedFlags &aChangedFlags) { // Remove entries in `aHasRoute` (a sub-TLV of `aPrefix` TLV) // matching the given `aRloc16` excluding entries that are present @@ -1215,12 +1215,12 @@ void Leader::RemoveRlocInHasRoute(PrefixTlv & aPrefix, } } -void Leader::RemoveRlocInBorderRouter(PrefixTlv & aPrefix, +void Leader::RemoveRlocInBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags) + ChangedFlags &aChangedFlags) { // Remove entries in `aBorderRouter` (a sub-TLV of `aPrefix` TLV) // matching the given `aRloc16` excluding entries that are present @@ -1247,7 +1247,7 @@ void Leader::RemoveRlocInBorderRouter(PrefixTlv & aPrefix, void Leader::RemoveContext(uint8_t aContextId) { NetworkDataTlv *start = GetTlvsStart(); - PrefixTlv * prefix; + PrefixTlv *prefix; while ((prefix = NetworkDataTlv::Find(start, GetTlvsEnd())) != nullptr) { @@ -1266,7 +1266,7 @@ void Leader::RemoveContext(uint8_t aContextId) void Leader::RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId) { NetworkDataTlv *start = aPrefix.GetSubTlvs(); - ContextTlv * context; + ContextTlv *context; while ((context = NetworkDataTlv::Find(start, aPrefix.GetNext())) != nullptr) { diff --git a/src/core/thread/network_data_leader_ftd.hpp b/src/core/thread/network_data_leader_ftd.hpp index 1b7827005..ce1a08195 100644 --- a/src/core/thread/network_data_leader_ftd.hpp +++ b/src/core/thread/network_data_leader_ftd.hpp @@ -234,29 +234,29 @@ private: void RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode, const NetworkData &aExcludeNetworkData, - ChangedFlags & aChangedFlags); - void RemoveRlocInPrefix(PrefixTlv & aPrefix, + ChangedFlags &aChangedFlags); + void RemoveRlocInPrefix(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags); - void RemoveRlocInService(ServiceTlv & aService, + ChangedFlags &aChangedFlags); + void RemoveRlocInService(ServiceTlv &aService, uint16_t aRloc16, MatchMode aMatchMode, const ServiceTlv *aExcludeService, - ChangedFlags & aChangedFlags); - void RemoveRlocInHasRoute(PrefixTlv & aPrefix, - HasRouteTlv & aHasRoute, + ChangedFlags &aChangedFlags); + void RemoveRlocInHasRoute(PrefixTlv &aPrefix, + HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags); - void RemoveRlocInBorderRouter(PrefixTlv & aPrefix, + ChangedFlags &aChangedFlags); + void RemoveRlocInBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode, const PrefixTlv *aExcludePrefix, - ChangedFlags & aChangedFlags); + ChangedFlags &aChangedFlags); static bool RlocMatch(uint16_t aFirstRloc16, uint16_t aSecondRloc16, MatchMode aMatchMode); @@ -274,11 +274,11 @@ private: UpdateStatus UpdateService(ServiceTlv &aService); UpdateStatus UpdateTlv(NetworkDataTlv &aTlv, const NetworkDataTlv *aSubTlvs); - void SendCommissioningGetResponse(const Coap::Message & aRequest, + void SendCommissioningGetResponse(const Coap::Message &aRequest, uint16_t aLength, const Ip6::MessageInfo &aMessageInfo); - void SendCommissioningSetResponse(const Coap::Message & aRequest, - const Ip6::MessageInfo & aMessageInfo, + void SendCommissioningSetResponse(const Coap::Message &aRequest, + const Ip6::MessageInfo &aMessageInfo, MeshCoP::StateTlv::State aState); void IncrementVersions(bool aIncludeStable); void IncrementVersions(const ChangedFlags &aFlags); diff --git a/src/core/thread/network_data_local.cpp b/src/core/thread/network_data_local.cpp index 10d63be37..a7eb9d9fd 100644 --- a/src/core/thread/network_data_local.cpp +++ b/src/core/thread/network_data_local.cpp @@ -178,11 +178,11 @@ void Local::UpdateRloc(PrefixTlv &aPrefixTlv) Error Local::AddService(uint32_t aEnterpriseNumber, const ServiceData &aServiceData, bool aServerStable, - const ServerData & aServerData) + const ServerData &aServerData) { Error error = kErrorNone; ServiceTlv *serviceTlv; - ServerTlv * serverTlv; + ServerTlv *serverTlv; uint16_t serviceTlvSize = ServiceTlv::CalculateSize(aEnterpriseNumber, aServiceData.GetLength()) + sizeof(ServerTlv) + aServerData.GetLength(); diff --git a/src/core/thread/network_data_local.hpp b/src/core/thread/network_data_local.hpp index 7d2dbbb68..b6eb48c03 100644 --- a/src/core/thread/network_data_local.hpp +++ b/src/core/thread/network_data_local.hpp @@ -98,7 +98,10 @@ public: * @retval kErrorNotFound Could not find the Border Router entry. * */ - Error RemoveOnMeshPrefix(const Ip6::Prefix &aPrefix) { return RemovePrefix(aPrefix); } + Error RemoveOnMeshPrefix(const Ip6::Prefix &aPrefix) + { + return RemovePrefix(aPrefix); + } /** * This method indicates whether or not the Thread Network Data contains a given on mesh prefix. @@ -132,7 +135,10 @@ public: * @retval kErrorNotFound Could not find the Border Router entry. * */ - Error RemoveHasRoutePrefix(const Ip6::Prefix &aPrefix) { return RemovePrefix(aPrefix); } + Error RemoveHasRoutePrefix(const Ip6::Prefix &aPrefix) + { + return RemovePrefix(aPrefix); + } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE @@ -151,7 +157,7 @@ public: Error AddService(uint32_t aEnterpriseNumber, const ServiceData &aServiceData, bool aServerStable, - const ServerData & aServerData); + const ServerData &aServerData); /** * This method removes a Service entry from the Thread Network local data. diff --git a/src/core/thread/network_data_notifier.cpp b/src/core/thread/network_data_notifier.cpp index 7755864e7..08a60d1be 100644 --- a/src/core/thread/network_data_notifier.cpp +++ b/src/core/thread/network_data_notifier.cpp @@ -187,7 +187,7 @@ exit: Error Notifier::SendServerDataNotification(uint16_t aOldRloc16, const NetworkData *aNetworkData) { Error error = kErrorNone; - Coap::Message * message; + Coap::Message *message; Tmf::MessageInfo messageInfo(GetInstance()); message = Get().NewPriorityConfirmablePostMessage(kUriServerData); diff --git a/src/core/thread/network_data_notifier.hpp b/src/core/thread/network_data_notifier.hpp index 82bd3c04c..65426cda0 100644 --- a/src/core/thread/network_data_notifier.hpp +++ b/src/core/thread/network_data_notifier.hpp @@ -117,8 +117,8 @@ private: void HandleNotifierEvents(Events aEvents); void HandleTimer(void); - static void HandleCoapResponse(void * aContext, - otMessage * aMessage, + static void HandleCoapResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleCoapResponse(Error aResult); diff --git a/src/core/thread/network_data_publisher.cpp b/src/core/thread/network_data_publisher.cpp index c040d2801..d46b077cb 100644 --- a/src/core/thread/network_data_publisher.cpp +++ b/src/core/thread/network_data_publisher.cpp @@ -699,7 +699,7 @@ void Publisher::DnsSrpServiceEntry::CountAnycastEntries(uint8_t &aNumEntries, ui // smaller RLCO16. Service::DnsSrpAnycast::ServiceData serviceData(mInfo.GetSequenceNumber()); - const ServiceTlv * serviceTlv = nullptr; + const ServiceTlv *serviceTlv = nullptr; ServiceData data; data.Init(&serviceData, serviceData.GetLength()); @@ -986,7 +986,7 @@ exit: void Publisher::PrefixEntry::CountOnMeshPrefixEntries(uint8_t &aNumEntries, uint8_t &aNumPreferredEntries) const { - const PrefixTlv * prefixTlv; + const PrefixTlv *prefixTlv; const BorderRouterTlv *brSubTlv; int8_t preference = BorderRouterEntry::PreferenceFromFlags(mFlags); uint16_t flagsWithoutPreference = BorderRouterEntry::FlagsWithoutPreference(mFlags); @@ -1033,7 +1033,7 @@ exit: void Publisher::PrefixEntry::CountExternalRouteEntries(uint8_t &aNumEntries, uint8_t &aNumPreferredEntries) const { - const PrefixTlv * prefixTlv; + const PrefixTlv *prefixTlv; const HasRouteTlv *hrSubTlv; int8_t preference = HasRouteEntry::PreferenceFromFlags(static_cast(mFlags)); uint8_t flagsWithoutPreference = HasRouteEntry::FlagsWithoutPreference(static_cast(mFlags)); diff --git a/src/core/thread/network_data_publisher.hpp b/src/core/thread/network_data_publisher.hpp index 2fb35c2ea..43f631465 100644 --- a/src/core/thread/network_data_publisher.hpp +++ b/src/core/thread/network_data_publisher.hpp @@ -137,7 +137,10 @@ public: * @param[in] aSequenceNumber The sequence number of DNS/SRP Anycast Service. * */ - void PublishDnsSrpServiceAnycast(uint8_t aSequenceNumber) { mDnsSrpServiceEntry.PublishAnycast(aSequenceNumber); } + void PublishDnsSrpServiceAnycast(uint8_t aSequenceNumber) + { + mDnsSrpServiceEntry.PublishAnycast(aSequenceNumber); + } /** * This method requests "DNS/SRP Service Unicast Address" to be published in the Thread Network Data. @@ -170,7 +173,10 @@ public: * @param[in] aPort The SRP server port number to publish. * */ - void PublishDnsSrpServiceUnicast(uint16_t aPort) { mDnsSrpServiceEntry.PublishUnicast(aPort); } + void PublishDnsSrpServiceUnicast(uint16_t aPort) + { + mDnsSrpServiceEntry.PublishUnicast(aPort); + } /** * This method indicates whether or not currently the "DNS/SRP Service" entry is added to the Thread Network Data. @@ -179,14 +185,20 @@ public: * @retval FALSE The entry is not added to Thread Network Data or there is no entry to publish. * */ - bool IsDnsSrpServiceAdded(void) const { return mDnsSrpServiceEntry.IsAdded(); } + bool IsDnsSrpServiceAdded(void) const + { + return mDnsSrpServiceEntry.IsAdded(); + } /** * This method unpublishes any previously added "DNS/SRP (Anycast or Unicast) Service" entry from the Thread * Network Data. * */ - void UnpublishDnsSrpService(void) { mDnsSrpServiceEntry.Unpublish(); } + void UnpublishDnsSrpService(void) + { + mDnsSrpServiceEntry.Unpublish(); + } #endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE @@ -403,7 +415,7 @@ private: Info mInfo; DnsSrpServiceCallback mCallback; - void * mCallbackContext; + void *mCallbackContext; }; #endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE @@ -463,20 +475,26 @@ private: #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE - bool IsADnsSrpServiceEntry(const Entry &aEntry) const { return (&aEntry == &mDnsSrpServiceEntry); } + bool IsADnsSrpServiceEntry(const Entry &aEntry) const + { + return (&aEntry == &mDnsSrpServiceEntry); + } #endif #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE - PrefixEntry * FindOrAllocatePrefixEntry(const Ip6::Prefix &aPrefix, Requester aRequester); - PrefixEntry * FindMatchingPrefixEntry(const Ip6::Prefix &aPrefix); + PrefixEntry *FindOrAllocatePrefixEntry(const Ip6::Prefix &aPrefix, Requester aRequester); + PrefixEntry *FindMatchingPrefixEntry(const Ip6::Prefix &aPrefix); const PrefixEntry *FindMatchingPrefixEntry(const Ip6::Prefix &aPrefix) const; bool IsAPrefixEntry(const Entry &aEntry) const; void NotifyPrefixEntryChange(Event aEvent, const Ip6::Prefix &aPrefix) const; #endif - TimerMilli &GetTimer(void) { return mTimer; } - void HandleNotifierEvents(Events aEvents); - void HandleTimer(void); + TimerMilli &GetTimer(void) + { + return mTimer; + } + void HandleNotifierEvents(Events aEvents); + void HandleTimer(void); using PublisherTimer = TimerMilliIn; @@ -487,7 +505,7 @@ private: #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE PrefixEntry mPrefixEntries[kMaxUserPrefixEntries + kMaxRoutingManagerPrefixEntries]; PrefixCallback mPrefixCallback; - void * mPrefixCallbackContext; + void *mPrefixCallbackContext; #endif PublisherTimer mTimer; diff --git a/src/core/thread/network_data_service.cpp b/src/core/thread/network_data_service.cpp index 7ed771452..f52cfe1d5 100644 --- a/src/core/thread/network_data_service.cpp +++ b/src/core/thread/network_data_service.cpp @@ -83,7 +83,7 @@ Error Manager::RemoveService(const void *aServiceData, uint8_t aServiceDataLengt Error Manager::GetServiceId(const void *aServiceData, uint8_t aServiceDataLength, bool aServerStable, - uint8_t & aServiceId) const + uint8_t &aServiceId) const { ServiceData serviceData; @@ -96,9 +96,9 @@ Error Manager::GetServiceId(const void *aServiceData, void Manager::GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConfig &aConfig) const { - const ServerTlv * rvalServerTlv = nullptr; + const ServerTlv *rvalServerTlv = nullptr; const BackboneRouter::ServerData *rvalServerData = nullptr; - const ServiceTlv * serviceTlv = nullptr; + const ServiceTlv *serviceTlv = nullptr; ServiceData serviceData; serviceData.Init(&BackboneRouter::kServiceData, BackboneRouter::kServiceDataMinSize); @@ -146,9 +146,9 @@ exit: return; } -bool Manager::IsBackboneRouterPreferredTo(const ServerTlv & aServerTlv, +bool Manager::IsBackboneRouterPreferredTo(const ServerTlv &aServerTlv, const BackboneRouter::ServerData &aServerData, - const ServerTlv & aOtherServerTlv, + const ServerTlv &aOtherServerTlv, const BackboneRouter::ServerData &aOtherServerData) const { bool isPreferred; diff --git a/src/core/thread/network_data_service.hpp b/src/core/thread/network_data_service.hpp index ed8903994..251eb071c 100644 --- a/src/core/thread/network_data_service.hpp +++ b/src/core/thread/network_data_service.hpp @@ -405,7 +405,7 @@ public: private: const ServiceTlv *mServiceTlv; - const ServerTlv * mServerSubTlv; + const ServerTlv *mServerSubTlv; }; /** @@ -605,13 +605,13 @@ private: Error GetServiceId(const void *aServiceData, uint8_t aServiceDataLength, bool aServerStable, - uint8_t & aServiceId) const; + uint8_t &aServiceId) const; Error IterateToNextServer(Iterator &aIterator) const; #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) - bool IsBackboneRouterPreferredTo(const ServerTlv & aServerTlv, + bool IsBackboneRouterPreferredTo(const ServerTlv &aServerTlv, const BackboneRouter::ServerData &aServerData, - const ServerTlv & aOtherServerTlv, + const ServerTlv &aOtherServerTlv, const BackboneRouter::ServerData &aOtherServerData) const; #endif }; diff --git a/src/core/thread/network_data_tlvs.hpp b/src/core/thread/network_data_tlvs.hpp index 48568c7d7..2ddad9820 100644 --- a/src/core/thread/network_data_tlvs.hpp +++ b/src/core/thread/network_data_tlvs.hpp @@ -1561,7 +1561,7 @@ public: private: const uint8_t *GetServerData(void) const { return reinterpret_cast(this) + sizeof(*this); } - uint8_t * GetServerData(void) { return AsNonConst(AsConst(this)->GetServerData()); } + uint8_t *GetServerData(void) { return AsNonConst(AsConst(this)->GetServerData()); } uint16_t mServer16; } OT_TOOL_PACKED_END; diff --git a/src/core/thread/network_data_types.cpp b/src/core/thread/network_data_types.cpp index 628f780a7..b0cd1ac8b 100644 --- a/src/core/thread/network_data_types.cpp +++ b/src/core/thread/network_data_types.cpp @@ -131,8 +131,8 @@ uint16_t OnMeshPrefixConfig::ConvertToTlvFlags(void) const #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -void OnMeshPrefixConfig::SetFrom(const PrefixTlv & aPrefixTlv, - const BorderRouterTlv & aBorderRouterTlv, +void OnMeshPrefixConfig::SetFrom(const PrefixTlv &aPrefixTlv, + const BorderRouterTlv &aBorderRouterTlv, const BorderRouterEntry &aBorderRouterEntry) { Clear(); @@ -191,9 +191,9 @@ uint8_t ExternalRouteConfig::ConvertToTlvFlags(void) const #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -void ExternalRouteConfig::SetFrom(Instance & aInstance, - const PrefixTlv & aPrefixTlv, - const HasRouteTlv & aHasRouteTlv, +void ExternalRouteConfig::SetFrom(Instance &aInstance, + const PrefixTlv &aPrefixTlv, + const HasRouteTlv &aHasRouteTlv, const HasRouteEntry &aHasRouteEntry) { Clear(); diff --git a/src/core/thread/network_data_types.hpp b/src/core/thread/network_data_types.hpp index 821534394..354efaebd 100644 --- a/src/core/thread/network_data_types.hpp +++ b/src/core/thread/network_data_types.hpp @@ -215,8 +215,8 @@ private: #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE uint16_t ConvertToTlvFlags(void) const; #endif - void SetFrom(const PrefixTlv & aPrefixTlv, - const BorderRouterTlv & aBorderRouterTlv, + void SetFrom(const PrefixTlv &aPrefixTlv, + const BorderRouterTlv &aBorderRouterTlv, const BorderRouterEntry &aBorderRouterEntry); void SetFromTlvFlags(uint16_t aFlags); }; @@ -275,9 +275,9 @@ private: #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE uint8_t ConvertToTlvFlags(void) const; #endif - void SetFrom(Instance & aInstance, - const PrefixTlv & aPrefixTlv, - const HasRouteTlv & aHasRouteTlv, + void SetFrom(Instance &aInstance, + const PrefixTlv &aPrefixTlv, + const HasRouteTlv &aHasRouteTlv, const HasRouteEntry &aHasRouteEntry); void SetFromTlvFlags(uint8_t aFlags); }; diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index d598be8e7..232dde0d3 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -64,11 +64,11 @@ NetworkDiagnostic::NetworkDiagnostic(Instance &aInstance) { } -Error NetworkDiagnostic::SendDiagnosticGet(const Ip6::Address & aDestination, +Error NetworkDiagnostic::SendDiagnosticGet(const Ip6::Address &aDestination, const uint8_t aTlvTypes[], uint8_t aCount, otReceiveDiagnosticGetCallback aCallback, - void * aCallbackContext) + void *aCallbackContext) { Error error; @@ -89,7 +89,7 @@ Error NetworkDiagnostic::SendDiagnosticCommand(CommandType aCommandType, uint8_t aCount) { Error error; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; Tmf::MessageInfo messageInfo(GetInstance()); Coap::ResponseHandler handler = nullptr; @@ -138,8 +138,8 @@ exit: return error; } -void NetworkDiagnostic::HandleDiagnosticGetResponse(void * aContext, - otMessage * aMessage, +void NetworkDiagnostic::HandleDiagnosticGetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult) { @@ -147,7 +147,7 @@ void NetworkDiagnostic::HandleDiagnosticGetResponse(void * aContex AsCoreTypePtr(aMessageInfo), aResult); } -void NetworkDiagnostic::HandleDiagnosticGetResponse(Coap::Message * aMessage, +void NetworkDiagnostic::HandleDiagnosticGetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult) { @@ -166,7 +166,7 @@ exit: } template <> -void NetworkDiagnostic::HandleTmf(Coap::Message & aMessage, +void NetworkDiagnostic::HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { VerifyOrExit(aMessage.IsConfirmablePostRequest()); @@ -291,8 +291,8 @@ void NetworkDiagnostic::FillMacCountersTlv(MacCountersTlv &aMacCountersTlv) aMacCountersTlv.SetIfOutDiscards(macCounters.mTxErrBusyChannel); } -Error NetworkDiagnostic::FillRequestedTlvs(const Message & aRequest, - Message & aResponse, +Error NetworkDiagnostic::FillRequestedTlvs(const Message &aRequest, + Message &aResponse, NetworkDiagnosticTlv &aNetworkDiagnosticTlv) { Error error = kErrorNone; @@ -460,7 +460,7 @@ template <> void NetworkDiagnostic::HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; NetworkDiagnosticTlv networkDiagnosticTlv; Tmf::MessageInfo messageInfo(GetInstance()); @@ -506,11 +506,11 @@ exit: } template <> -void NetworkDiagnostic::HandleTmf(Coap::Message & aMessage, +void NetworkDiagnostic::HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { Error error = kErrorNone; - Coap::Message * message = nullptr; + Coap::Message *message = nullptr; NetworkDiagnosticTlv networkDiagnosticTlv; Ip6::MessageInfo messageInfo(aMessageInfo); @@ -726,7 +726,7 @@ Error NetworkDiagnostic::GetNextDiagTlv(const Coap::Message &aMessage, Iterator { uint16_t addrListLength = GetArrayLength(aTlvInfo.mData.mIp6AddrList.mList); Ip6::Address *addrEntry = AsCoreTypePtr(&aTlvInfo.mData.mIp6AddrList.mList[0]); - uint8_t & addrCount = aTlvInfo.mData.mIp6AddrList.mCount; + uint8_t &addrCount = aTlvInfo.mData.mIp6AddrList.mCount; VerifyOrExit((tlvLength % Ip6::Address::kSize) == 0, error = kErrorParse); @@ -770,7 +770,7 @@ Error NetworkDiagnostic::GetNextDiagTlv(const Coap::Message &aMessage, Iterator { uint16_t childInfoLength = GetArrayLength(aTlvInfo.mData.mChildTable.mTable); ChildInfo *childInfo = &aTlvInfo.mData.mChildTable.mTable[0]; - uint8_t & childCount = aTlvInfo.mData.mChildTable.mCount; + uint8_t &childCount = aTlvInfo.mData.mChildTable.mCount; VerifyOrExit((tlvLength % sizeof(ChildTableEntry)) == 0, error = kErrorParse); diff --git a/src/core/thread/network_diagnostic.hpp b/src/core/thread/network_diagnostic.hpp index ef8399700..ea0fec7d8 100644 --- a/src/core/thread/network_diagnostic.hpp +++ b/src/core/thread/network_diagnostic.hpp @@ -106,11 +106,11 @@ public: * @param[in] aCallbackContext A pointer to application-specific context. * */ - Error SendDiagnosticGet(const Ip6::Address & aDestination, + Error SendDiagnosticGet(const Ip6::Address &aDestination, const uint8_t aTlvTypes[], uint8_t aCount, otReceiveDiagnosticGetCallback aCallback, - void * aCallbackContext); + void *aCallbackContext); /** * This method sends Diagnostic Reset request. @@ -155,8 +155,8 @@ private: void FillMacCountersTlv(MacCountersTlv &aMacCountersTlv); Error FillRequestedTlvs(const Message &aRequest, Message &aResponse, NetworkDiagnosticTlv &aNetworkDiagnosticTlv); - static void HandleDiagnosticGetResponse(void * aContext, - otMessage * aMessage, + static void HandleDiagnosticGetResponse(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, Error aResult); void HandleDiagnosticGetResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult); @@ -164,7 +164,7 @@ private: template void HandleTmf(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo); otReceiveDiagnosticGetCallback mReceiveDiagnosticGetCallback; - void * mReceiveDiagnosticGetCallbackContext; + void *mReceiveDiagnosticGetCallbackContext; }; DeclareTmfHandler(NetworkDiagnostic, kUriDiagnosticGetRequest); diff --git a/src/core/thread/panid_query_server.cpp b/src/core/thread/panid_query_server.cpp index b58d430e8..ae56cf64b 100644 --- a/src/core/thread/panid_query_server.cpp +++ b/src/core/thread/panid_query_server.cpp @@ -109,7 +109,7 @@ void PanIdQueryServer::SendConflict(void) Error error = kErrorNone; MeshCoP::ChannelMaskTlv channelMask; Tmf::MessageInfo messageInfo(GetInstance()); - Coap::Message * message; + Coap::Message *message; message = Get().NewPriorityConfirmablePostMessage(kUriPanIdConflict); VerifyOrExit(message != nullptr, error = kErrorNoBufs); diff --git a/src/core/thread/radio_selector.cpp b/src/core/thread/radio_selector.cpp index cb619a3f1..814343c93 100644 --- a/src/core/thread/radio_selector.cpp +++ b/src/core/thread/radio_selector.cpp @@ -134,7 +134,7 @@ void RadioSelector::UpdateOnSendDone(Mac::TxFrame &aFrame, Error aTxError) LogLevel logLevel = kLogLevelInfo; Mac::RadioType radioType = aFrame.GetRadioType(); Mac::Address macDest; - Neighbor * neighbor; + Neighbor *neighbor; #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE if (radioType == Mac::kRadioTypeTrel) @@ -257,7 +257,7 @@ Mac::RadioType RadioSelector::Select(Mac::RadioTypes aRadioOptions, const Neighb Mac::TxFrame &RadioSelector::SelectRadio(Message &aMessage, const Mac::Address &aMacDest, Mac::TxFrames &aTxFrames) { - Neighbor * neighbor; + Neighbor *neighbor; Mac::RadioType selectedRadio; Mac::RadioTypes selections; @@ -358,7 +358,7 @@ Mac::RadioType RadioSelector::SelectPollFrameRadio(const Neighbor &aParent) #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) void RadioSelector::Log(LogLevel aLogLevel, - const char * aActionText, + const char *aActionText, Mac::RadioType aRadioType, const Neighbor &aNeighbor) { diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index 87dfcce93..887da29cd 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -270,7 +270,7 @@ Error RouterTable::Release(uint8_t aRouterId) { Error error = kErrorNone; uint16_t rloc16 = Mle::Rloc16FromRouterId(aRouterId); - Router * router; + Router *router; OT_ASSERT(aRouterId <= Mle::kMaxRouterId); diff --git a/src/core/thread/router_table.hpp b/src/core/thread/router_table.hpp index 801a7ec0c..d6695ffb5 100644 --- a/src/core/thread/router_table.hpp +++ b/src/core/thread/router_table.hpp @@ -371,7 +371,9 @@ public: */ void LogRouteTable(void); #else - void LogRouteTable(void) {} + void LogRouteTable(void) + { + } #endif private: @@ -390,14 +392,20 @@ private: void UpdateAllocation(void); const Router *GetFirstEntry(void) const; const Router *GetNextEntry(const Router *aRouter) const; - Router * GetFirstEntry(void) { return AsNonConst(AsConst(this)->GetFirstEntry()); } - Router * GetNextEntry(Router *aRouter) { return AsNonConst(AsConst(this)->GetNextEntry(aRouter)); } + Router *GetFirstEntry(void) + { + return AsNonConst(AsConst(this)->GetFirstEntry()); + } + Router *GetNextEntry(Router *aRouter) + { + return AsNonConst(AsConst(this)->GetNextEntry(aRouter)); + } - Router * FindNeighbor(uint16_t aRloc16); - Router * FindNeighbor(const Mac::ExtAddress &aExtAddress); - Router * FindNeighbor(const Mac::Address &aMacAddress); + Router *FindNeighbor(uint16_t aRloc16); + Router *FindNeighbor(const Mac::ExtAddress &aExtAddress); + Router *FindNeighbor(const Mac::Address &aMacAddress); const Router *FindRouter(const Router::AddressMatcher &aMatcher) const; - Router * FindRouter(const Router::AddressMatcher &aMatcher) + Router *FindRouter(const Router::AddressMatcher &aMatcher) { return AsNonConst(AsConst(this)->FindRouter(aMatcher)); } diff --git a/src/core/thread/time_sync_service.hpp b/src/core/thread/time_sync_service.hpp index f788eca0f..f3b4255dc 100644 --- a/src/core/thread/time_sync_service.hpp +++ b/src/core/thread/time_sync_service.hpp @@ -100,7 +100,10 @@ public: * @returns The time synchronization sequence. * */ - uint8_t GetTimeSyncSeq(void) const { return mTimeSyncSeq; } + uint8_t GetTimeSyncSeq(void) const + { + return mTimeSyncSeq; + } /** * This method gets the time offset to the Thread network time. @@ -108,7 +111,10 @@ public: * @returns The time offset to the Thread network time, in microseconds. * */ - int64_t GetNetworkTimeOffset(void) const { return mNetworkTimeOffset; } + int64_t GetNetworkTimeOffset(void) const + { + return mNetworkTimeOffset; + } /** * Set the time synchronization period. @@ -116,7 +122,10 @@ public: * @param[in] aTimeSyncPeriod The time synchronization period, in seconds. * */ - void SetTimeSyncPeriod(uint16_t aTimeSyncPeriod) { mTimeSyncPeriod = aTimeSyncPeriod; } + void SetTimeSyncPeriod(uint16_t aTimeSyncPeriod) + { + mTimeSyncPeriod = aTimeSyncPeriod; + } /** * Get the time synchronization period. @@ -124,7 +133,10 @@ public: * @returns The time synchronization period, in seconds. * */ - uint16_t GetTimeSyncPeriod(void) const { return mTimeSyncPeriod; } + uint16_t GetTimeSyncPeriod(void) const + { + return mTimeSyncPeriod; + } /** * Set the time synchronization XTAL accuracy threshold for Router. @@ -132,7 +144,10 @@ public: * @param[in] aXtalThreshold The XTAL accuracy threshold for Router, in PPM. * */ - void SetXtalThreshold(uint16_t aXtalThreshold) { mXtalThreshold = aXtalThreshold; } + void SetXtalThreshold(uint16_t aXtalThreshold) + { + mXtalThreshold = aXtalThreshold; + } /** * Get the time synchronization XTAL accuracy threshold for Router. @@ -140,7 +155,10 @@ public: * @returns The XTAL accuracy threshold for Router, in PPM. * */ - uint16_t GetXtalThreshold(void) const { return mXtalThreshold; } + uint16_t GetXtalThreshold(void) const + { + return mXtalThreshold; + } /** * Set the time sync callback to be notified of a network time update. @@ -204,7 +222,7 @@ private: int64_t mNetworkTimeOffset; ///< The time offset to the Thread Network time otNetworkTimeSyncCallbackFn mTimeSyncCallback; ///< The callback to be called when time sync is handled or status updated. - void * mTimeSyncCallbackContext; ///< The context to be passed to callback. + void *mTimeSyncCallbackContext; ///< The context to be passed to callback. SyncTimer mTimer; ///< Timer for checking if a resync is required. otNetworkTimeStatus mCurrentStatus; ///< Current network time status. }; diff --git a/src/core/thread/tmf.cpp b/src/core/thread/tmf.cpp index 630b42f61..019e98a5c 100644 --- a/src/core/thread/tmf.cpp +++ b/src/core/thread/tmf.cpp @@ -105,9 +105,9 @@ template <> void Agent::HandleTmf(Message &aMessage, const Ip6::Mes #endif } -bool Agent::HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - Message & aMessage, +bool Agent::HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { return static_cast(aCoapBase).HandleResource(aUriPath, aMessage, aMessageInfo); @@ -236,9 +236,9 @@ SecureAgent::SecureAgent(Instance &aInstance) SetResourceHandler(&HandleResource); } -bool SecureAgent::HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - Message & aMessage, +bool SecureAgent::HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { return static_cast(aCoapBase).HandleResource(aUriPath, aMessage, aMessageInfo); diff --git a/src/core/thread/tmf.hpp b/src/core/thread/tmf.hpp index 2c0ccaf57..ecb389479 100644 --- a/src/core/thread/tmf.hpp +++ b/src/core/thread/tmf.hpp @@ -185,9 +185,9 @@ public: private: template void HandleTmf(Message &aMessage, const Ip6::MessageInfo &aMessageInfo); - static bool HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - Message & aMessage, + static bool HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo); bool HandleResource(const char *aUriPath, Message &aMessage, const Ip6::MessageInfo &aMessageInfo); @@ -212,9 +212,9 @@ public: explicit SecureAgent(Instance &aInstance); private: - static bool HandleResource(CoapBase & aCoapBase, - const char * aUriPath, - Message & aMessage, + static bool HandleResource(CoapBase &aCoapBase, + const char *aUriPath, + Message &aMessage, const Ip6::MessageInfo &aMessageInfo); bool HandleResource(const char *aUriPath, Message &aMessage, const Ip6::MessageInfo &aMessageInfo); }; diff --git a/src/core/thread/topology.hpp b/src/core/thread/topology.hpp index a5dc6f9c8..b1233bf05 100644 --- a/src/core/thread/topology.hpp +++ b/src/core/thread/topology.hpp @@ -440,7 +440,10 @@ public: * @returns The link ACK frame counter value. * */ - uint32_t GetLinkAckFrameCounter(void) const { return mValidPending.mValid.mLinkAckFrameCounter; } + uint32_t GetLinkAckFrameCounter(void) const + { + return mValidPending.mValid.mLinkAckFrameCounter; + } #endif /** @@ -464,7 +467,10 @@ public: * @returns The MLE frame counter value. * */ - uint32_t GetMleFrameCounter(void) const { return mValidPending.mValid.mMleFrameCounter; } + uint32_t GetMleFrameCounter(void) const + { + return mValidPending.mValid.mMleFrameCounter; + } /** * This method sets the MLE frame counter value. @@ -472,7 +478,10 @@ public: * @param[in] aFrameCounter The MLE frame counter value. * */ - void SetMleFrameCounter(uint32_t aFrameCounter) { mValidPending.mValid.mMleFrameCounter = aFrameCounter; } + void SetMleFrameCounter(uint32_t aFrameCounter) + { + mValidPending.mValid.mMleFrameCounter = aFrameCounter; + } /** * This method gets the RLOC16 value. @@ -480,7 +489,10 @@ public: * @returns The RLOC16 value. * */ - uint16_t GetRloc16(void) const { return mRloc16; } + uint16_t GetRloc16(void) const + { + return mRloc16; + } /** * This method gets the Router ID value. @@ -488,7 +500,10 @@ public: * @returns The Router ID value. * */ - uint8_t GetRouterId(void) const { return mRloc16 >> Mle::kRouterIdOffset; } + uint8_t GetRouterId(void) const + { + return mRloc16 >> Mle::kRouterIdOffset; + } /** * This method sets the RLOC16 value. @@ -496,7 +511,10 @@ public: * @param[in] aRloc16 The RLOC16 value. * */ - void SetRloc16(uint16_t aRloc16) { mRloc16 = aRloc16; } + void SetRloc16(uint16_t aRloc16) + { + mRloc16 = aRloc16; + } #if OPENTHREAD_CONFIG_MULTI_RADIO /** @@ -506,7 +524,10 @@ public: * multi-radio feature is enabled. * */ - void ClearLastRxFragmentTag(void) { mLastRxFragmentTag = 0; } + void ClearLastRxFragmentTag(void) + { + mLastRxFragmentTag = 0; + } /** * This method gets the last received fragment tag. @@ -516,7 +537,10 @@ public: * @returns The last received fragment tag. * */ - uint16_t GetLastRxFragmentTag(void) const { return mLastRxFragmentTag; } + uint16_t GetLastRxFragmentTag(void) const + { + return mLastRxFragmentTag; + } /** * This method set the last received fragment tag. @@ -548,7 +572,10 @@ public: * before @p aTag. * */ - bool IsLastRxFragmentTagAfter(uint16_t aTag) const { return SerialNumber::IsGreater(mLastRxFragmentTag, aTag); } + bool IsLastRxFragmentTagAfter(uint16_t aTag) const + { + return SerialNumber::IsGreater(mLastRxFragmentTag, aTag); + } #endif // OPENTHREAD_CONFIG_MULTI_RADIO @@ -558,7 +585,10 @@ public: * @returns TRUE if neighbors is Thread 1.1, FALSE otherwise. * */ - bool IsThreadVersion1p1(void) const { return mState != kStateInvalid && mVersion == kThreadVersion1p1; } + bool IsThreadVersion1p1(void) const + { + return mState != kStateInvalid && mVersion == kThreadVersion1p1; + } /** * This method indicates whether or not neighbor is Thread 1.2 or higher.. @@ -566,7 +596,10 @@ public: * @returns TRUE if neighbor is Thread 1.2 or higher, FALSE otherwise. * */ - bool IsThreadVersion1p2OrHigher(void) const { return mState != kStateInvalid && mVersion >= kThreadVersion1p2; } + bool IsThreadVersion1p2OrHigher(void) const + { + return mState != kStateInvalid && mVersion >= kThreadVersion1p2; + } /** * This method indicates whether Thread version supports CSL. @@ -574,7 +607,10 @@ public: * @returns TRUE if CSL is supported, FALSE otherwise. * */ - bool IsThreadVersionCslCapable(void) const { return IsThreadVersion1p2OrHigher() && !IsRxOnWhenIdle(); } + bool IsThreadVersionCslCapable(void) const + { + return IsThreadVersion1p2OrHigher() && !IsRxOnWhenIdle(); + } /** * This method indicates whether Enhanced Keep-Alive is supported or not. @@ -591,7 +627,10 @@ public: * This method gets the device MLE version. * */ - uint16_t GetVersion(void) const { return mVersion; } + uint16_t GetVersion(void) const + { + return mVersion; + } /** * This method sets the device MLE version. @@ -599,7 +638,10 @@ public: * @param[in] aVersion The device MLE version. * */ - void SetVersion(uint16_t aVersion) { mVersion = aVersion; } + void SetVersion(uint16_t aVersion) + { + mVersion = aVersion; + } /** * This method gets the number of consecutive link failures. @@ -607,19 +649,28 @@ public: * @returns The number of consecutive link failures. * */ - uint8_t GetLinkFailures(void) const { return mLinkFailures; } + uint8_t GetLinkFailures(void) const + { + return mLinkFailures; + } /** * This method increments the number of consecutive link failures. * */ - void IncrementLinkFailures(void) { mLinkFailures++; } + void IncrementLinkFailures(void) + { + mLinkFailures++; + } /** * This method resets the number of consecutive link failures to zero. * */ - void ResetLinkFailures(void) { mLinkFailures = 0; } + void ResetLinkFailures(void) + { + mLinkFailures = 0; + } /** * This method returns the LinkQualityInfo object. @@ -627,7 +678,10 @@ public: * @returns The LinkQualityInfo object. * */ - LinkQualityInfo &GetLinkInfo(void) { return mLinkInfo; } + LinkQualityInfo &GetLinkInfo(void) + { + return mLinkInfo; + } /** * This method returns the LinkQualityInfo object. @@ -635,7 +689,10 @@ public: * @returns The LinkQualityInfo object. * */ - const LinkQualityInfo &GetLinkInfo(void) const { return mLinkInfo; } + const LinkQualityInfo &GetLinkInfo(void) const + { + return mLinkInfo; + } /** * This method gets the link quality in value. @@ -643,7 +700,10 @@ public: * @returns The link quality in value. * */ - LinkQuality GetLinkQualityIn(void) const { return GetLinkInfo().GetLinkQuality(); } + LinkQuality GetLinkQualityIn(void) const + { + return GetLinkInfo().GetLinkQuality(); + } /** * This method generates a new challenge value for MLE Link Request/Response exchanges. @@ -657,7 +717,10 @@ public: * @returns The current challenge value. * */ - const uint8_t *GetChallenge(void) const { return mValidPending.mPending.mChallenge; } + const uint8_t *GetChallenge(void) const + { + return mValidPending.mPending.mChallenge; + } /** * This method returns the size (bytes) of the challenge value for MLE Link Request/Response exchanges. @@ -665,7 +728,10 @@ public: * @returns The size (bytes) of the challenge value for MLE Link Request/Response exchanges. * */ - uint8_t GetChallengeSize(void) const { return sizeof(mValidPending.mPending.mChallenge); } + uint8_t GetChallengeSize(void) const + { + return sizeof(mValidPending.mPending.mChallenge); + } #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE /** @@ -674,7 +740,10 @@ public: * @returns TRUE if time sync feature is enabled, FALSE otherwise. * */ - bool IsTimeSyncEnabled(void) const { return mTimeSyncEnabled; } + bool IsTimeSyncEnabled(void) const + { + return mTimeSyncEnabled; + } /** * This method sets whether or not time sync feature is enabled. @@ -682,7 +751,10 @@ public: * @param[in] aEnable TRUE if time sync feature is enabled, FALSE otherwise. * */ - void SetTimeSyncEnabled(bool aEnabled) { mTimeSyncEnabled = aEnabled; } + void SetTimeSyncEnabled(bool aEnabled) + { + mTimeSyncEnabled = aEnabled; + } #endif #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE @@ -740,7 +812,10 @@ public: * @returns Enh-ACK Probing metrics configured. * */ - const LinkMetrics::Metrics &GetEnhAckProbingMetrics(void) const { return mEnhAckProbingMetrics; } + const LinkMetrics::Metrics &GetEnhAckProbingMetrics(void) const + { + return mEnhAckProbingMetrics; + } /** * This method sets the Enh-ACK Probing metrics (this `Neighbor` object is the Probing Subject). @@ -979,7 +1054,7 @@ public: * @returns A reference to the `Ip6::Address` entry currently pointed by the iterator. * */ - const Ip6::Address &operator*(void)const { return *GetAddress(); } + const Ip6::Address &operator*(void) const { return *GetAddress(); } /** * This method overloads operator `==` to evaluate whether or not two `Iterator` instances are equal. @@ -1010,7 +1085,7 @@ public: void Update(void); - const Child & mChild; + const Child &mChild; Ip6::Address::TypeFilter mFilter; Index mIndex; Ip6::Address mMeshLocalAddress; @@ -1137,7 +1212,10 @@ public: * @returns The child timeout. * */ - uint32_t GetTimeout(void) const { return mTimeout; } + uint32_t GetTimeout(void) const + { + return mTimeout; + } /** * This method sets the child timeout. @@ -1145,7 +1223,10 @@ public: * @param[in] aTimeout The child timeout. * */ - void SetTimeout(uint32_t aTimeout) { mTimeout = aTimeout; } + void SetTimeout(uint32_t aTimeout) + { + mTimeout = aTimeout; + } /** * This method gets the network data version. @@ -1153,7 +1234,10 @@ public: * @returns The network data version. * */ - uint8_t GetNetworkDataVersion(void) const { return mNetworkDataVersion; } + uint8_t GetNetworkDataVersion(void) const + { + return mNetworkDataVersion; + } /** * This method sets the network data version. @@ -1161,7 +1245,10 @@ public: * @param[in] aVersion The network data version. * */ - void SetNetworkDataVersion(uint8_t aVersion) { mNetworkDataVersion = aVersion; } + void SetNetworkDataVersion(uint8_t aVersion) + { + mNetworkDataVersion = aVersion; + } /** * This method generates a new challenge value to use during a child attach. @@ -1175,7 +1262,10 @@ public: * @returns The current challenge value. * */ - const uint8_t *GetChallenge(void) const { return mAttachChallenge; } + const uint8_t *GetChallenge(void) const + { + return mAttachChallenge; + } /** * This method gets the challenge size (bytes) used during attach. @@ -1183,13 +1273,19 @@ public: * @returns The challenge size (bytes). * */ - uint8_t GetChallengeSize(void) const { return sizeof(mAttachChallenge); } + uint8_t GetChallengeSize(void) const + { + return sizeof(mAttachChallenge); + } /** * This method clears the requested TLV list. * */ - void ClearRequestTlvs(void) { memset(mRequestTlvs, Mle::Tlv::kInvalid, sizeof(mRequestTlvs)); } + void ClearRequestTlvs(void) + { + memset(mRequestTlvs, Mle::Tlv::kInvalid, sizeof(mRequestTlvs)); + } /** * This method returns the requested TLV at index @p aIndex. @@ -1199,7 +1295,10 @@ public: * @returns The requested TLV at index @p aIndex. * */ - uint8_t GetRequestTlv(uint8_t aIndex) const { return mRequestTlvs[aIndex]; } + uint8_t GetRequestTlv(uint8_t aIndex) const + { + return mRequestTlvs[aIndex]; + } /** * This method sets the requested TLV at index @p aIndex. @@ -1208,7 +1307,10 @@ public: * @param[in] aType The TLV type. * */ - void SetRequestTlv(uint8_t aIndex, uint8_t aType) { mRequestTlvs[aIndex] = aType; } + void SetRequestTlv(uint8_t aIndex, uint8_t aType) + { + mRequestTlvs[aIndex] = aType; + } #if OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE @@ -1216,7 +1318,10 @@ public: * This method increments the number of seconds since last supervision of the child. * */ - void IncrementSecondsSinceLastSupervision(void) { mSecondsSinceSupervision++; } + void IncrementSecondsSinceLastSupervision(void) + { + mSecondsSinceSupervision++; + } /** * This method returns the number of seconds since last supervision of the child (last message to the child) @@ -1224,13 +1329,19 @@ public: * @returns Number of seconds since last supervision of the child. * */ - uint16_t GetSecondsSinceLastSupervision(void) const { return mSecondsSinceSupervision; } + uint16_t GetSecondsSinceLastSupervision(void) const + { + return mSecondsSinceSupervision; + } /** * This method resets the number of seconds since last supervision of the child to zero. * */ - void ResetSecondsSinceLastSupervision(void) { mSecondsSinceSupervision = 0; } + void ResetSecondsSinceLastSupervision(void) + { + mSecondsSinceSupervision = 0; + } #endif // #if OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE @@ -1276,7 +1387,10 @@ public: * @retval false If the Child does not have any IPv6 address of MLR state `kMlrStateRegistered`. * */ - bool HasAnyMlrRegisteredAddress(void) const { return mMlrRegisteredMask.HasAny(); } + bool HasAnyMlrRegisteredAddress(void) const + { + return mMlrRegisteredMask.HasAny(); + } /** * This method returns if the Child has any IPv6 address of MLR state `kMlrStateToRegister`. @@ -1285,7 +1399,10 @@ public: * @retval false If the Child does not have any IPv6 address of MLR state `kMlrStateToRegister`. * */ - bool HasAnyMlrToRegisterAddress(void) const { return mMlrToRegisterMask.HasAny(); } + bool HasAnyMlrToRegisterAddress(void) const + { + return mMlrToRegisterMask.HasAny(); + } #endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE private: @@ -1310,7 +1427,7 @@ private: AddressIterator end(void) { return AddressIterator(mChild, AddressIterator::kEndIterator); } private: - const Child & mChild; + const Child &mChild; Ip6::Address::TypeFilter mFilter; }; @@ -1493,7 +1610,10 @@ public: * @returns The route cost from parent to leader * */ - uint8_t GetLeaderCost(void) const { return mLeaderCost; } + uint8_t GetLeaderCost(void) const + { + return mLeaderCost; + } /** * This method sets route cost from parent to leader. @@ -1501,7 +1621,10 @@ public: * @param[in] aLaderConst The route cost. * */ - void SetLeaderCost(uint8_t aLeaderCost) { mLeaderCost = aLeaderCost; } + void SetLeaderCost(uint8_t aLeaderCost) + { + mLeaderCost = aLeaderCost; + } #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE /** @@ -1510,7 +1633,10 @@ public: * @returns The CSL accuracy. * */ - const Mac::CslAccuracy &GetCslAccuracy(void) const { return mCslAccuracy; } + const Mac::CslAccuracy &GetCslAccuracy(void) const + { + return mCslAccuracy; + } /** * This method sets CSL accuracy. @@ -1518,7 +1644,10 @@ public: * @param[in] aCslAccuracy The CSL accuracy. * */ - void SetCslAccuracy(const Mac::CslAccuracy &aCslAccuracy) { mCslAccuracy = aCslAccuracy; } + void SetCslAccuracy(const Mac::CslAccuracy &aCslAccuracy) + { + mCslAccuracy = aCslAccuracy; + } #endif private: diff --git a/src/core/utils/child_supervision.cpp b/src/core/utils/child_supervision.cpp index 3fc2e5fc4..38c80a40e 100644 --- a/src/core/utils/child_supervision.cpp +++ b/src/core/utils/child_supervision.cpp @@ -63,7 +63,7 @@ void ChildSupervisor::SetSupervisionInterval(uint16_t aInterval) Child *ChildSupervisor::GetDestination(const Message &aMessage) const { - Child * child = nullptr; + Child *child = nullptr; uint16_t childIndex; VerifyOrExit(aMessage.GetType() == Message::kTypeSupervision); diff --git a/src/core/utils/heap.cpp b/src/core/utils/heap.cpp index 0f8432d1b..02309f372 100644 --- a/src/core/utils/heap.cpp +++ b/src/core/utils/heap.cpp @@ -63,9 +63,9 @@ Heap::Heap(void) void *Heap::CAlloc(size_t aCount, size_t aSize) { - void * ret = nullptr; - Block * prev = nullptr; - Block * curr = nullptr; + void *ret = nullptr; + Block *prev = nullptr; + Block *curr = nullptr; uint16_t size = static_cast(aCount * aSize); VerifyOrExit(size); diff --git a/src/core/utils/heap.hpp b/src/core/utils/heap.hpp index 02b9a5e83..671514875 100644 --- a/src/core/utils/heap.hpp +++ b/src/core/utils/heap.hpp @@ -209,7 +209,7 @@ public: */ bool IsClean(void) const { - Heap & self = *AsNonConst(this); + Heap &self = *AsNonConst(this); const Block &super = self.BlockSuper(); const Block &first = self.BlockRight(super); return super.GetNext() == self.BlockOffset(first) && first.GetSize() == kFirstBlockSize; @@ -250,7 +250,10 @@ private: * @returns A reference to the block. * */ - Block &BlockAt(uint16_t aOffset) { return *reinterpret_cast(&mMemory.m16[aOffset / 2]); } + Block &BlockAt(uint16_t aOffset) + { + return *reinterpret_cast(&mMemory.m16[aOffset / 2]); + } /** * This method returns the block of @p aPointer. @@ -273,7 +276,10 @@ private: * @returns Reference to the super block. * */ - Block &BlockSuper(void) { return BlockAt(kSuperBlockOffset); } + Block &BlockSuper(void) + { + return BlockAt(kSuperBlockOffset); + } /** * This method returns the free block after @p aBlock in the free block list. @@ -283,7 +289,10 @@ private: * @returns Reference to the free block after this block. * */ - Block &BlockNext(const Block &aBlock) { return BlockAt(aBlock.GetNext()); } + Block &BlockNext(const Block &aBlock) + { + return BlockAt(aBlock.GetNext()); + } /** * This method returns the block on the right side of @p aBlock. @@ -293,7 +302,10 @@ private: * @returns Reference to the block on the right side. * */ - Block &BlockRight(const Block &aBlock) { return BlockAt(BlockOffset(aBlock) + sizeof(Block) + aBlock.GetSize()); } + Block &BlockRight(const Block &aBlock) + { + return BlockAt(BlockOffset(aBlock) + sizeof(Block) + aBlock.GetSize()); + } /** * This method returns the free block before @p aBlock in the free block list. @@ -309,7 +321,10 @@ private: * @param[in] aBlock A reference to the block. * */ - bool IsLeftFree(const Block &aBlock) { return (BlockOffset(aBlock) != kFirstBlockOffset && aBlock.IsLeftFree()); } + bool IsLeftFree(const Block &aBlock) + { + return (BlockOffset(aBlock) != kFirstBlockOffset && aBlock.IsLeftFree()); + } /** * This method returns the offset of @p aBlock. diff --git a/src/core/utils/history_tracker.cpp b/src/core/utils/history_tracker.cpp index 04b498816..9fa465d35 100644 --- a/src/core/utils/history_tracker.cpp +++ b/src/core/utils/history_tracker.cpp @@ -63,7 +63,7 @@ HistoryTracker::HistoryTracker(Instance &aInstance) void HistoryTracker::RecordNetworkInfo(void) { - NetworkInfo * entry = mNetInfoHistory.AddNewEntry(); + NetworkInfo *entry = mNetInfoHistory.AddNewEntry(); Mle::DeviceMode mode; VerifyOrExit(entry != nullptr); @@ -469,9 +469,9 @@ uint16_t HistoryTracker::List::Add(uint16_t aMaxSize, Timestamp aTimestamps[]) Error HistoryTracker::List::Iterate(uint16_t aMaxSize, const Timestamp aTimestamps[], - Iterator & aIterator, - uint16_t & aListIndex, - uint32_t & aEntryAge) const + Iterator &aIterator, + uint16_t &aListIndex, + uint32_t &aEntryAge) const { Error error = kErrorNone; diff --git a/src/core/utils/history_tracker.hpp b/src/core/utils/history_tracker.hpp index 7c89cb564..f92d8c49d 100644 --- a/src/core/utils/history_tracker.hpp +++ b/src/core/utils/history_tracker.hpp @@ -315,9 +315,9 @@ private: uint16_t MapEntryNumberToListIndex(uint16_t aEntryNumber, uint16_t aMaxSize) const; Error Iterate(uint16_t aMaxSize, const Timestamp aTimestamps[], - Iterator & aIterator, - uint16_t & aListIndex, - uint32_t & aEntryAge) const; + Iterator &aIterator, + uint16_t &aListIndex, + uint32_t &aEntryAge) const; private: uint16_t mStartIndex; @@ -356,7 +356,7 @@ private: public: void Clear(void) {} uint16_t GetSize(void) const { return 0; } - Entry * AddNewEntry(void) { return nullptr; } + Entry *AddNewEntry(void) { return nullptr; } void AddNewEntry(const Entry &) {} const Entry *Iterate(Iterator &, uint32_t &) const { return nullptr; } void RemoveAgedEntries(void) {} diff --git a/src/core/utils/jam_detector.hpp b/src/core/utils/jam_detector.hpp index a85aa463b..5aa3ba51b 100644 --- a/src/core/utils/jam_detector.hpp +++ b/src/core/utils/jam_detector.hpp @@ -195,7 +195,7 @@ private: using SampleTimer = TimerMilliIn; Handler mHandler; // Handler/callback to inform about jamming state - void * mContext; // Context for handler/callback + void *mContext; // Context for handler/callback SampleTimer mTimer; // RSSI sample timer uint64_t mHistoryBitmap; // History bitmap, each bit correspond to 1 sec interval TimeMilli mCurSecondStartTime; // Start time for current 1 sec interval diff --git a/src/core/utils/parse_cmdline.cpp b/src/core/utils/parse_cmdline.cpp index 2829e6d01..82e346b72 100644 --- a/src/core/utils/parse_cmdline.cpp +++ b/src/core/utils/parse_cmdline.cpp @@ -89,7 +89,7 @@ Error ParseCmd(char *aCommandString, Arg aArgs[], uint8_t aArgsMaxLength) { Error error = kErrorNone; uint8_t index = 0; - char * cmd; + char *cmd; for (cmd = aCommandString; *cmd; cmd++) { diff --git a/src/core/utils/parse_cmdline.hpp b/src/core/utils/parse_cmdline.hpp index 7703ac214..f0c9abeec 100644 --- a/src/core/utils/parse_cmdline.hpp +++ b/src/core/utils/parse_cmdline.hpp @@ -524,7 +524,10 @@ public: * @retval kErrorInvalidArgs The argument is empty or does not contain a valid IPv6 prefix. * */ - otError ParseAsIp6Prefix(otIp6Prefix &aPrefix) const { return CmdLineParser::ParseAsIp6Prefix(mString, aPrefix); } + otError ParseAsIp6Prefix(otIp6Prefix &aPrefix) const + { + return CmdLineParser::ParseAsIp6Prefix(mString, aPrefix); + } #endif // OPENTHREAD_FTD || OPENTHREAD_MTD diff --git a/src/core/utils/ping_sender.cpp b/src/core/utils/ping_sender.cpp index dcdf29270..158a75447 100644 --- a/src/core/utils/ping_sender.cpp +++ b/src/core/utils/ping_sender.cpp @@ -127,7 +127,7 @@ void PingSender::Stop(void) void PingSender::SendPing(void) { TimeMilli now = TimerMilli::GetNow(); - Message * message = nullptr; + Message *message = nullptr; Ip6::MessageInfo messageInfo; messageInfo.SetSockAddr(mConfig.GetSource()); @@ -181,8 +181,8 @@ void PingSender::HandleTimer(void) } } -void PingSender::HandleIcmpReceive(void * aContext, - otMessage * aMessage, +void PingSender::HandleIcmpReceive(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, const otIcmp6Header *aIcmpHeader) { @@ -190,8 +190,8 @@ void PingSender::HandleIcmpReceive(void * aContext, AsCoreType(aIcmpHeader)); } -void PingSender::HandleIcmpReceive(const Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, +void PingSender::HandleIcmpReceive(const Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const Ip6::Icmp::Header &aIcmpHeader) { Reply reply; diff --git a/src/core/utils/ping_sender.hpp b/src/core/utils/ping_sender.hpp index 03fab3f70..81d52880a 100644 --- a/src/core/utils/ping_sender.hpp +++ b/src/core/utils/ping_sender.hpp @@ -167,12 +167,12 @@ public: private: void SendPing(void); void HandleTimer(void); - static void HandleIcmpReceive(void * aContext, - otMessage * aMessage, + static void HandleIcmpReceive(void *aContext, + otMessage *aMessage, const otMessageInfo *aMessageInfo, const otIcmp6Header *aIcmpHeader); - void HandleIcmpReceive(const Message & aMessage, - const Ip6::MessageInfo & aMessageInfo, + void HandleIcmpReceive(const Message &aMessage, + const Ip6::MessageInfo &aMessageInfo, const Ip6::Icmp::Header &aIcmpHeader); using PingTimer = TimerMilliIn; diff --git a/src/core/utils/slaac_address.cpp b/src/core/utils/slaac_address.cpp index af5aa021c..825130a17 100644 --- a/src/core/utils/slaac_address.cpp +++ b/src/core/utils/slaac_address.cpp @@ -136,7 +136,7 @@ exit: } bool Slaac::DoesConfigMatchNetifAddr(const NetworkData::OnMeshPrefixConfig &aConfig, - const Ip6::Netif::UnicastAddress & aAddr) + const Ip6::Netif::UnicastAddress &aAddr) { return (((aConfig.mOnMesh && (aAddr.mPrefixLength == aConfig.mPrefix.mLength)) || (!aConfig.mOnMesh && (aAddr.mPrefixLength == 128))) && @@ -256,9 +256,9 @@ void Slaac::Update(UpdateMode aMode) } Error Slaac::GenerateIid(Ip6::Netif::UnicastAddress &aAddress, - uint8_t * aNetworkId, + uint8_t *aNetworkId, uint8_t aNetworkIdLength, - uint8_t * aDadCounter) const + uint8_t *aDadCounter) const { /* * This method generates a semantically opaque IID per RFC 7217. diff --git a/src/core/utils/slaac_address.hpp b/src/core/utils/slaac_address.hpp index db7913b36..d9aecced1 100644 --- a/src/core/utils/slaac_address.hpp +++ b/src/core/utils/slaac_address.hpp @@ -139,9 +139,9 @@ public: * */ Error GenerateIid(Ip6::Netif::UnicastAddress &aAddress, - uint8_t * aNetworkId = nullptr, + uint8_t *aNetworkId = nullptr, uint8_t aNetworkIdLength = 0, - uint8_t * aDadCounter = nullptr) const; + uint8_t *aDadCounter = nullptr) const; private: static constexpr uint16_t kMaxIidCreationAttempts = 256; // Maximum number of attempts when generating IID. @@ -163,7 +163,7 @@ private: void GetIidSecretKey(IidSecretKey &aKey) const; void HandleNotifierEvents(Events aEvents); static bool DoesConfigMatchNetifAddr(const NetworkData::OnMeshPrefixConfig &aConfig, - const Ip6::Netif::UnicastAddress & aAddr); + const Ip6::Netif::UnicastAddress &aAddr); bool mEnabled; otIp6SlaacPrefixFilter mFilter; diff --git a/src/core/utils/srp_client_buffers.hpp b/src/core/utils/srp_client_buffers.hpp index 7746de88d..a60be7b73 100644 --- a/src/core/utils/srp_client_buffers.hpp +++ b/src/core/utils/srp_client_buffers.hpp @@ -171,7 +171,7 @@ public: } private: - ServiceEntry * GetNext(void) { return reinterpret_cast(mService.mNext); } + ServiceEntry *GetNext(void) { return reinterpret_cast(mService.mNext); } const ServiceEntry *GetNext(void) const { return reinterpret_cast(mService.mNext); } void SetNext(ServiceEntry *aEntry) { mService.mNext = reinterpret_cast(aEntry); } diff --git a/src/lib/hdlc/hdlc.hpp b/src/lib/hdlc/hdlc.hpp index 84581d1ee..eb80f6f2c 100644 --- a/src/lib/hdlc/hdlc.hpp +++ b/src/lib/hdlc/hdlc.hpp @@ -584,7 +584,7 @@ private: State mState; FrameWritePointer &mWritePointer; FrameHandler mFrameHandler; - void * mContext; + void *mContext; uint16_t mFcs; uint16_t mDecodedLength; }; diff --git a/src/lib/spinel/radio_spinel.hpp b/src/lib/spinel/radio_spinel.hpp index 2f15d0378..8b90973b0 100644 --- a/src/lib/spinel/radio_spinel.hpp +++ b/src/lib/spinel/radio_spinel.hpp @@ -365,7 +365,10 @@ public: * @returns A reference to the transmit buffer. * */ - otRadioFrame &GetTransmitFrame(void) { return mTxRadioFrame; } + otRadioFrame &GetTransmitFrame(void) + { + return mTxRadioFrame; + } /** * This method enables or disables source address match feature. @@ -528,7 +531,10 @@ public: * @returns TRUE if the radio is enabled, FALSE otherwise. * */ - bool IsEnabled(void) const { return mState != kStateDisabled; } + bool IsEnabled(void) const + { + return mState != kStateDisabled; + } /** * This method indicates whether there is a pending transmission. @@ -537,7 +543,10 @@ public: * @retval FALSE There is no pending transmission. * */ - bool IsTransmitting(void) const { return mState == kStateTransmitting; } + bool IsTransmitting(void) const + { + return mState == kStateTransmitting; + } /** * This method indicates whether a transmit has just finished. @@ -546,7 +555,10 @@ public: * @retval FALSE The transmission is not done. * */ - bool IsTransmitDone(void) const { return mState == kStateTransmitDone; } + bool IsTransmitDone(void) const + { + return mState == kStateTransmitDone; + } /** * This method returns the timeout timepoint for the pending transmission. @@ -554,7 +566,10 @@ public: * @returns The timeout timepoint for the pending transmission. * */ - uint64_t GetTxRadioEndUs(void) const { return mTxRadioEndUs; } + uint64_t GetTxRadioEndUs(void) const + { + return mTxRadioEndUs; + } /** * This method processes any pending the I/O data. @@ -570,7 +585,10 @@ public: * @returns The underlying spinel interface. * */ - InterfaceType &GetSpinelInterface(void) { return mSpinelInterface; } + InterfaceType &GetSpinelInterface(void) + { + return mSpinelInterface; + } #if OPENTHREAD_CONFIG_DIAG_ENABLE /** @@ -579,7 +597,10 @@ public: * @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise. * */ - void SetDiagEnabled(bool aMode) { mDiagMode = aMode; } + void SetDiagEnabled(bool aMode) + { + mDiagMode = aMode; + } /** * This method indicates whether or not factory diagnostics mode is enabled. @@ -587,7 +608,10 @@ public: * @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise. * */ - bool IsDiagEnabled(void) const { return mDiagMode; } + bool IsDiagEnabled(void) const + { + return mDiagMode; + } /** * This method processes platform diagnostics commands. @@ -699,7 +723,7 @@ public: */ otError ConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, const otShortAddress aShortAddress, - const otExtAddress & aExtAddress); + const otExtAddress &aExtAddress); #endif #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE @@ -742,7 +766,10 @@ public: * @returns Whether there is pending frame in the buffer. * */ - bool HasPendingFrame(void) const { return mRxFrameBuffer.HasSavedFrame(); } + bool HasPendingFrame(void) const + { + return mRxFrameBuffer.HasSavedFrame(); + } /** * This method gets dataset from NCP radio and saves it. @@ -761,7 +788,10 @@ public: * @returns The timepoint to start the recalculation of RCP time offset. * */ - uint64_t GetNextRadioTimeRecalcStart(void) const { return mRadioTimeRecalcStart; } + uint64_t GetNextRadioTimeRecalcStart(void) const + { + return mRadioTimeRecalcStart; + } /** * This method gets the current estimated time on RCP. @@ -820,9 +850,9 @@ public: * */ otError GetWithParam(spinel_prop_key_t aKey, - const uint8_t * aParam, + const uint8_t *aParam, spinel_size_t aParamSize, - const char * aFormat, + const char *aFormat, ...); /** @@ -884,7 +914,10 @@ public: * @returns The radio Spinel metrics. * */ - const otRadioSpinelMetrics *GetRadioSpinelMetrics(void) const { return &mRadioSpinelMetrics; } + const otRadioSpinelMetrics *GetRadioSpinelMetrics(void) const + { + return &mRadioSpinelMetrics; + } private: enum @@ -926,30 +959,33 @@ private: void ProcessFrameQueue(void); spinel_tid_t GetNextTid(void); - void FreeTid(spinel_tid_t tid) { mCmdTidsInUse &= ~(1 << tid); } + void FreeTid(spinel_tid_t tid) + { + mCmdTidsInUse &= ~(1 << tid); + } otError RequestV(uint32_t aCommand, spinel_prop_key_t aKey, const char *aFormat, va_list aArgs); otError Request(uint32_t aCommand, spinel_prop_key_t aKey, const char *aFormat, ...); - otError RequestWithPropertyFormat(const char * aPropertyFormat, + otError RequestWithPropertyFormat(const char *aPropertyFormat, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, ...); - otError RequestWithPropertyFormatV(const char * aPropertyFormat, + otError RequestWithPropertyFormatV(const char *aPropertyFormat, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, va_list aArgs); otError RequestWithExpectedCommandV(uint32_t aExpectedCommand, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, va_list aArgs); otError WaitResponse(void); otError SendCommand(uint32_t aCommand, spinel_prop_key_t aKey, spinel_tid_t aTid, - const char * aFormat, + const char *aFormat, va_list aArgs); otError ParseRadioFrame(otRadioFrame &aFrame, const uint8_t *aBuffer, uint16_t aLength, spinel_ssize_t &aUnpacked); otError ThreadDatasetHandler(const uint8_t *aBuffer, uint16_t aLength); @@ -1010,7 +1046,7 @@ private: spinel_tid_t mTxRadioTid; ///< The transaction id used to send a radio frame. spinel_tid_t mWaitingTid; ///< The transaction id of current transaction. spinel_prop_key_t mWaitingKey; ///< The property key of current transaction. - const char * mPropertyFormat; ///< The spinel property format of current transaction. + const char *mPropertyFormat; ///< The spinel property format of current transaction. va_list mPropertyArgs; ///< The arguments pack or unpack spinel property of current transaction. uint32_t mExpectedCommand; ///< Expected response command of current transaction. otError mError; ///< The result of current transaction. @@ -1073,7 +1109,7 @@ private: #if OPENTHREAD_CONFIG_DIAG_ENABLE bool mDiagMode; - char * mDiagOutput; + char *mDiagOutput; size_t mDiagOutputMaxLen; #endif diff --git a/src/lib/spinel/radio_spinel_impl.hpp b/src/lib/spinel/radio_spinel_impl.hpp index 4b51c7e81..ec6cc98d4 100644 --- a/src/lib/spinel/radio_spinel_impl.hpp +++ b/src/lib/spinel/radio_spinel_impl.hpp @@ -495,7 +495,7 @@ void RadioSpinel::HandleNotification(SpinelIn spinel_prop_key_t key; spinel_size_t len = 0; spinel_ssize_t unpacked; - uint8_t * data = nullptr; + uint8_t *data = nullptr; uint32_t cmd; uint8_t header; otError error = OT_ERROR_NONE; @@ -550,7 +550,7 @@ void RadioSpinel::HandleNotification(const ui spinel_prop_key_t key; spinel_size_t len = 0; spinel_ssize_t unpacked; - uint8_t * data = nullptr; + uint8_t *data = nullptr; uint32_t cmd; uint8_t header; otError error = OT_ERROR_NONE; @@ -570,7 +570,7 @@ template void RadioSpinel::HandleResponse(const uint8_t *aBuffer, uint16_t aLength) { spinel_prop_key_t key; - uint8_t * data = nullptr; + uint8_t *data = nullptr; spinel_size_t len = 0; uint8_t header = 0; uint32_t cmd = 0; @@ -776,7 +776,7 @@ exit: template void RadioSpinel::HandleWaitingResponse(uint32_t aCommand, spinel_prop_key_t aKey, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aLength) { if (aKey == SPINEL_PROP_LAST_STATUS) @@ -844,7 +844,7 @@ exit: template void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aLength) { otError error = OT_ERROR_NONE; @@ -951,8 +951,8 @@ exit: } template -otError RadioSpinel::ParseRadioFrame(otRadioFrame & aFrame, - const uint8_t * aBuffer, +otError RadioSpinel::ParseRadioFrame(otRadioFrame &aFrame, + const uint8_t *aBuffer, uint16_t aLength, spinel_ssize_t &aUnpacked) { @@ -1579,9 +1579,9 @@ otError RadioSpinel::Get(spinel_prop_key_t aK // This is not a normal use case for VALUE_GET command and should be only used to get RCP timestamp with dummy payload template otError RadioSpinel::GetWithParam(spinel_prop_key_t aKey, - const uint8_t * aParam, + const uint8_t *aParam, spinel_size_t aParamSize, - const char * aFormat, + const char *aFormat, ...) { otError error; @@ -1750,7 +1750,7 @@ template otError RadioSpinel::SendCommand(uint32_t aCommand, spinel_prop_key_t aKey, spinel_tid_t tid, - const char * aFormat, + const char *aFormat, va_list args) { otError error = OT_ERROR_NONE; @@ -1785,7 +1785,7 @@ exit: template otError RadioSpinel::RequestV(uint32_t command, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, va_list aArgs) { otError error = OT_ERROR_NONE; @@ -1817,7 +1817,7 @@ exit: template otError RadioSpinel::Request(uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, ...) { va_list args; @@ -1828,10 +1828,10 @@ otError RadioSpinel::Request(uint32_t } template -otError RadioSpinel::RequestWithPropertyFormat(const char * aPropertyFormat, +otError RadioSpinel::RequestWithPropertyFormat(const char *aPropertyFormat, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, ...) { otError error; @@ -1845,10 +1845,10 @@ otError RadioSpinel::RequestWithPropertyForma } template -otError RadioSpinel::RequestWithPropertyFormatV(const char * aPropertyFormat, +otError RadioSpinel::RequestWithPropertyFormatV(const char *aPropertyFormat, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, va_list aArgs) { otError error; @@ -1864,7 +1864,7 @@ template otError RadioSpinel::RequestWithExpectedCommandV(uint32_t aExpectedCommand, uint32_t aCommand, spinel_prop_key_t aKey, - const char * aFormat, + const char *aFormat, va_list aArgs) { otError error; @@ -1879,7 +1879,7 @@ otError RadioSpinel::RequestWithExpectedComma template void RadioSpinel::HandleTransmitDone(uint32_t aCommand, spinel_prop_key_t aKey, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aLength) { otError error = OT_ERROR_NONE; @@ -2086,7 +2086,7 @@ exit: #if OPENTHREAD_CONFIG_DIAG_ENABLE template otError RadioSpinel::PlatDiagProcess(const char *aString, - char * aOutput, + char *aOutput, size_t aOutputMaxLen) { otError error; @@ -2457,7 +2457,7 @@ exit: template otError RadioSpinel::ConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, const otShortAddress aShortAddress, - const otExtAddress & aExtAddress) + const otExtAddress &aExtAddress) { otError error = OT_ERROR_NONE; uint8_t flags = 0; @@ -2536,11 +2536,11 @@ void RadioSpinel::LogSpinelFrame(const uint8_ uint8_t header; uint32_t cmd; spinel_prop_key_t key; - uint8_t * data; + uint8_t *data; spinel_size_t len; - const char * prefix = nullptr; - char * start = buf; - char * end = buf + sizeof(buf); + const char *prefix = nullptr; + char *start = buf; + char *end = buf + sizeof(buf); VerifyOrExit(otLoggingGetLevel() >= OT_LOG_LEVEL_DEBG); @@ -2725,7 +2725,7 @@ void RadioSpinel::LogSpinelFrame(const uint8_ case SPINEL_PROP_RADIO_CAPS: case SPINEL_PROP_RCP_API_VERSION: { - const char * name; + const char *name; unsigned int value; unpacked = spinel_datatype_unpack(data, len, SPINEL_DATATYPE_UINT_PACKED_S, &value); diff --git a/src/lib/spinel/spinel.c b/src/lib/spinel/spinel.c index 3e580182a..dc4eb5eaf 100644 --- a/src/lib/spinel/spinel.c +++ b/src/lib/spinel/spinel.c @@ -340,8 +340,8 @@ const char *spinel_next_packed_datatype(const char *pack_format) static spinel_ssize_t spinel_datatype_vunpack_(bool in_place, const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, - va_list_obj * args) + const char *pack_format, + va_list_obj *args) { spinel_ssize_t ret = 0; @@ -528,7 +528,7 @@ static spinel_ssize_t spinel_datatype_vunpack_(bool in_place, case SPINEL_DATATYPE_UINT_PACKED_C: { - unsigned int * arg_ptr = va_arg(args->obj, unsigned int *); + unsigned int *arg_ptr = va_arg(args->obj, unsigned int *); spinel_ssize_t pui_len = spinel_packed_uint_decode(data_in, data_len, arg_ptr); // Range check @@ -564,7 +564,7 @@ static spinel_ssize_t spinel_datatype_vunpack_(bool in_place, if (in_place) { - char * arg = va_arg(args->obj, char *); + char *arg = va_arg(args->obj, char *); size_t len_arg = va_arg(args->obj, size_t); if (arg) { @@ -593,8 +593,8 @@ static spinel_ssize_t spinel_datatype_vunpack_(bool in_place, spinel_ssize_t pui_len = 0; uint16_t block_len = 0; const uint8_t *block_ptr = data_in; - void * arg_ptr = va_arg(args->obj, void *); - unsigned int * block_len_ptr = va_arg(args->obj, unsigned int *); + void *arg_ptr = va_arg(args->obj, void *); + unsigned int *block_len_ptr = va_arg(args->obj, unsigned int *); char nextformat = *spinel_next_packed_datatype(pack_format); if ((pack_format[0] == SPINEL_DATATYPE_DATA_WLEN_C) || ((nextformat != 0) && (nextformat != ')'))) @@ -704,7 +704,7 @@ bail: spinel_ssize_t spinel_datatype_unpack_in_place(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, ...) { spinel_ssize_t ret; @@ -731,7 +731,7 @@ spinel_ssize_t spinel_datatype_unpack(const uint8_t *data_in, spinel_size_t data spinel_ssize_t spinel_datatype_vunpack_in_place(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, va_list args) { spinel_ssize_t ret; @@ -746,7 +746,7 @@ spinel_ssize_t spinel_datatype_vunpack_in_place(const uint8_t *data_in, spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, va_list args) { spinel_ssize_t ret; @@ -759,10 +759,10 @@ spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in, return ret; } -static spinel_ssize_t spinel_datatype_vpack_(uint8_t * data_out, +static spinel_ssize_t spinel_datatype_vpack_(uint8_t *data_out, spinel_size_t data_len_max, - const char * pack_format, - va_list_obj * args) + const char *pack_format, + va_list_obj *args) { spinel_ssize_t ret = 0; @@ -1128,9 +1128,9 @@ spinel_ssize_t spinel_datatype_pack(uint8_t *data_out, spinel_size_t data_len_ma return ret; } -spinel_ssize_t spinel_datatype_vpack(uint8_t * data_out, +spinel_ssize_t spinel_datatype_vpack(uint8_t *data_out, spinel_size_t data_len_max, - const char * pack_format, + const char *pack_format, va_list args) { int ret; @@ -1688,7 +1688,7 @@ int main(void) unsigned int i1 = 0; unsigned int i2 = 0; uint32_t l = 0; - const char * str = NULL; + const char *str = NULL; const spinel_eui64_t *eui64 = NULL; len = spinel_datatype_unpack(buffer, (spinel_size_t)len, "CiiLUE", &c, &i1, &i2, &l, &str, &eui64); @@ -1808,7 +1808,7 @@ int main(void) unsigned int i1 = 0; unsigned int i2 = 0; uint32_t l = 0; - const char * str = NULL; + const char *str = NULL; spinel_eui64_t *eui64 = NULL; len = spinel_datatype_unpack(buffer, (spinel_size_t)len, "Cit(iL)UE", &c, &i1, &i2, &l, &str, &eui64); @@ -1932,8 +1932,8 @@ int main(void) const uint8_t str6[] = {0xE5, 0xA2, 0x82, 0xE0, 0xA0, 0x80, 0xC2, 0x83, 0xC2, 0x80, 0xF4, 0x8F, 0xBF, 0xBF, 0xF4, 0x8F, 0xBF, 0xBF, 0xDF, 0xBF, 0x21, 0x00}; - const uint8_t * good_strings[] = {single1, single2, single3, single4, single5, single6, single7, single8, - str1, str2, str3, str4, str5, str6, NULL}; + const uint8_t *good_strings[] = {single1, single2, single3, single4, single5, single6, single7, single8, + str1, str2, str3, str4, str5, str6, NULL}; const uint8_t **str_ptr; for (str_ptr = &good_strings[0]; *str_ptr != NULL; str_ptr++) @@ -1963,7 +1963,7 @@ int main(void) const uint8_t bad5[] = {0x21, 0xA0, 0x00}; const uint8_t bad6[] = {0xCE, 0xBA, 0xE1, 0xBD, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0x00}; - const uint8_t * bad_strings[] = {single1, single2, single3, single4, bad1, bad2, bad3, bad4, bad5, bad6, NULL}; + const uint8_t *bad_strings[] = {single1, single2, single3, single4, bad1, bad2, bad3, bad4, bad5, bad6, NULL}; const uint8_t **str_ptr; for (str_ptr = &bad_strings[0]; *str_ptr != NULL; str_ptr++) diff --git a/src/lib/spinel/spinel.h b/src/lib/spinel/spinel.h index 2df6c157b..2e70e7da8 100644 --- a/src/lib/spinel/spinel.h +++ b/src/lib/spinel/spinel.h @@ -4961,17 +4961,17 @@ typedef char spinel_datatype_t; #define SPINEL_MAX_UINT_PACKED 2097151 -SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_pack(uint8_t * data_out, +SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_pack(uint8_t *data_out, spinel_size_t data_len_max, - const char * pack_format, + const char *pack_format, ...); -SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vpack(uint8_t * data_out, +SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vpack(uint8_t *data_out, spinel_size_t data_len_max, - const char * pack_format, + const char *pack_format, va_list args); SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, ...); /** * This function parses spinel data similar to sscanf(). @@ -4999,11 +4999,11 @@ SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack(const uint8_t *data_in, */ SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack_in_place(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, ...); SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, va_list args); /** * This function parses spinel data similar to vsscanf(). @@ -5029,12 +5029,12 @@ SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in, */ SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack_in_place(const uint8_t *data_in, spinel_size_t data_len, - const char * pack_format, + const char *pack_format, va_list args); SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_decode(const uint8_t *bytes, spinel_size_t len, - unsigned int * value_ptr); + unsigned int *value_ptr); SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_encode(uint8_t *bytes, spinel_size_t len, unsigned int value); SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_size(unsigned int value); diff --git a/src/lib/spinel/spinel_buffer.hpp b/src/lib/spinel/spinel_buffer.hpp index 6377a1f82..fecdb645c 100644 --- a/src/lib/spinel/spinel_buffer.hpp +++ b/src/lib/spinel/spinel_buffer.hpp @@ -625,14 +625,14 @@ private: const uint16_t mBufferLength; // Length of the buffer. BufferCallback mFrameAddedCallback; // Callback to signal when a new frame is added - void * mFrameAddedContext; // Context passed to `mFrameAddedCallback`. + void *mFrameAddedContext; // Context passed to `mFrameAddedCallback`. BufferCallback mFrameRemovedCallback; // Callback to signal when a frame is removed. - void * mFrameRemovedContext; // Context passed to `mFrameRemovedCallback`. + void *mFrameRemovedContext; // Context passed to `mFrameRemovedCallback`. Direction mWriteDirection; // Direction (priority) for current frame being read. - uint8_t * mWriteFrameStart[kNumPrios]; // Pointer to start of current frame being written. - uint8_t * mWriteSegmentHead; // Pointer to start of current segment in the frame being written. - uint8_t * mWriteSegmentTail; // Pointer to end of current segment in the frame being written. + uint8_t *mWriteFrameStart[kNumPrios]; // Pointer to start of current frame being written. + uint8_t *mWriteSegmentHead; // Pointer to start of current segment in the frame being written. + uint8_t *mWriteSegmentTail; // Pointer to end of current segment in the frame being written. FrameTag mWriteFrameTag; // Tag associated with last successfully written frame. Direction mReadDirection; // Direction (priority) for current frame being read. @@ -647,10 +647,10 @@ private: #if OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE otMessageQueue mWriteFrameMessageQueue; // Message queue for the current frame being written. otMessageQueue mMessageQueue[kNumPrios]; // Main message queues. - otMessage * mReadMessage; // Current Message in the frame being read. + otMessage *mReadMessage; // Current Message in the frame being read. uint16_t mReadMessageOffset; // Offset within current message being read. uint8_t mMessageBuffer[kMessageReadBufferSize]; // Buffer to hold part of current message being read. - uint8_t * mReadMessageTail; // Pointer to end of current part in mMessageBuffer. + uint8_t *mReadMessageTail; // Pointer to end of current part in mMessageBuffer. #endif }; diff --git a/src/lib/spinel/spinel_encoder.hpp b/src/lib/spinel/spinel_encoder.hpp index 079005433..eb9b43789 100644 --- a/src/lib/spinel/spinel_encoder.hpp +++ b/src/lib/spinel/spinel_encoder.hpp @@ -563,7 +563,10 @@ public: * @retval OT_ERROR_INVALID_ARGS If @p aMessage is nullptr. * */ - otError WriteMessage(otMessage *aMessage) { return mNcpBuffer.InFrameFeedMessage(aMessage); } + otError WriteMessage(otMessage *aMessage) + { + return mNcpBuffer.InFrameFeedMessage(aMessage); + } #endif /** @@ -683,7 +686,7 @@ private: kMaxNestedStructs = 4, ///< Maximum number of nested structs. }; - Spinel::Buffer & mNcpBuffer; + Spinel::Buffer &mNcpBuffer; Spinel::Buffer::WritePosition mStructPosition[kMaxNestedStructs]; uint8_t mNumOpenStructs; diff --git a/src/lib/url/url.cpp b/src/lib/url/url.cpp index 7d4312cd0..ed576d257 100644 --- a/src/lib/url/url.cpp +++ b/src/lib/url/url.cpp @@ -40,7 +40,7 @@ namespace Url { otError Url::Init(char *aUrl) { otError error = OT_ERROR_NONE; - char * url = aUrl; + char *url = aUrl; mEnd = aUrl + strlen(aUrl); mProtocol = aUrl; @@ -73,9 +73,9 @@ exit: const char *Url::GetValue(const char *aName, const char *aLastValue) const { - const char * rval = nullptr; + const char *rval = nullptr; const size_t len = strlen(aName); - const char * start; + const char *start; if (aLastValue == nullptr) { @@ -158,7 +158,7 @@ void TestEmptyValue(void) { char url[] = "spinel:///dev/ttyUSB0?rtscts&baudrate=115200&verbose&verbose&verbose"; ot::Url::Url args; - const char * arg = nullptr; + const char *arg = nullptr; assert(!args.Init(url)); assert(!strcmp(args.GetPath(), "/dev/ttyUSB0")); @@ -188,7 +188,7 @@ void TestMultipleProtocolsAndDuplicateParameters(void) { char url[] = "spinel+exec:///path/to/ot-rcp?arg=1&arg=arg2&arg=3"; ot::Url::Url args; - const char * arg = nullptr; + const char *arg = nullptr; assert(!args.Init(url)); assert(!strcmp(args.GetPath(), "/path/to/ot-rcp")); diff --git a/src/ncp/example_vendor_hook.cpp b/src/ncp/example_vendor_hook.cpp index 4c0b72db1..62c0b6aaa 100644 --- a/src/ncp/example_vendor_hook.cpp +++ b/src/ncp/example_vendor_hook.cpp @@ -150,7 +150,7 @@ static OT_DEFINE_ALIGNED_VAR(sNcpVendorRaw, sizeof(NcpVendorUart), uint64_t); extern "C" void otAppNcpInit(otInstance *aInstance) { NcpVendorUart *ncpVendor = nullptr; - ot::Instance * instance = static_cast(aInstance); + ot::Instance *instance = static_cast(aInstance); ncpVendor = new (&sNcpVendorRaw) NcpVendorUart(instance); diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 83df7c202..06535cf81 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -402,10 +402,10 @@ exit: mDisableStreamWrite = false; } -void NcpBase::HandleFrameRemovedFromNcpBuffer(void * aContext, +void NcpBase::HandleFrameRemovedFromNcpBuffer(void *aContext, Spinel::Buffer::FrameTag aFrameTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aNcpBuffer) + Spinel::Buffer *aNcpBuffer) { OT_UNUSED_VARIABLE(aNcpBuffer); OT_UNUSED_VARIABLE(aPriority); @@ -1058,7 +1058,7 @@ otError NcpBase::HandleCommandPropertyInsertRemove(uint8_t aHeader, spinel_prop_ otError error = OT_ERROR_NONE; PropertyHandler handler = nullptr; unsigned int responseCommand = 0; - const uint8_t * valuePtr; + const uint8_t *valuePtr; uint16_t valueLen; switch (aCommand) @@ -1181,7 +1181,7 @@ exit: otError NcpBase::WritePropertyValueInsertedRemovedFrame(uint8_t aHeader, unsigned int aResponseCommand, spinel_prop_key_t aPropKey, - const uint8_t * aValuePtr, + const uint8_t *aValuePtr, uint16_t aValueLen) { otError error = OT_ERROR_NONE; diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index f4e9f644a..c5ab7e03d 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -237,11 +237,14 @@ protected: otError WritePropertyValueInsertedRemovedFrame(uint8_t aHeader, unsigned int aResponseCommand, spinel_prop_key_t aPropKey, - const uint8_t * aValuePtr, + const uint8_t *aValuePtr, uint16_t aValueLen); otError SendQueuedResponses(void); - bool IsResponseQueueEmpty(void) const { return (mResponseQueueHead == mResponseQueueTail); } + bool IsResponseQueueEmpty(void) const + { + return (mResponseQueueHead == mResponseQueueTail); + } otError EnqueueResponse(uint8_t aHeader, ResponseType aType, unsigned int aPropKeyOrStatus); otError PrepareGetResponse(uint8_t aHeader, spinel_prop_key_t aPropKey) @@ -262,10 +265,10 @@ protected: static void UpdateChangedProps(Tasklet &aTasklet); void UpdateChangedProps(void); - static void HandleFrameRemovedFromNcpBuffer(void * aContext, + static void HandleFrameRemovedFromNcpBuffer(void *aContext, Spinel::Buffer::FrameTag aFrameTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aNcpBuffer); + Spinel::Buffer *aNcpBuffer); void HandleFrameRemovedFromNcpBuffer(Spinel::Buffer::FrameTag aFrameTag); otError EncodeChannelMask(uint32_t aChannelMask); @@ -277,7 +280,7 @@ protected: static void LinkRawReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); void LinkRawReceiveDone(otRadioFrame *aFrame, otError aError); - static void LinkRawTransmitDone(otInstance * aInstance, + static void LinkRawTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); @@ -325,7 +328,7 @@ protected: static void HandleCommissionerEnergyReport_Jump(uint32_t aChannelMask, const uint8_t *aEnergyData, uint8_t aLength, - void * aContext); + void *aContext); void HandleCommissionerEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyData, uint8_t aLength); static void HandleCommissionerPanIdConflict_Jump(uint16_t aPanId, uint32_t aChannelMask, void *aContext); @@ -338,12 +341,12 @@ protected: #endif #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE - static void HandleLinkMetricsReport_Jump(const otIp6Address * aSource, + static void HandleLinkMetricsReport_Jump(const otIp6Address *aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, - void * aContext); + void *aContext); - void HandleLinkMetricsReport(const otIp6Address * aSource, + void HandleLinkMetricsReport(const otIp6Address *aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus); @@ -352,16 +355,16 @@ protected: void HandleLinkMetricsMgmtResponse(const otIp6Address *aSource, uint8_t aStatus); static void HandleLinkMetricsEnhAckProbingIeReport_Jump(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues, - void * aContext); + void *aContext); void HandleLinkMetricsEnhAckProbingIeReport(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues); #endif - static void HandleMlrRegResult_Jump(void * aContext, + static void HandleMlrRegResult_Jump(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, @@ -374,9 +377,9 @@ protected: otError EncodeOperationalDataset(const otOperationalDataset &aDataset); otError DecodeOperationalDataset(otOperationalDataset &aDataset, - const uint8_t ** aTlvs = nullptr, - uint8_t * aTlvsLength = nullptr, - const otIp6Address ** aDestIpAddress = nullptr, + const uint8_t **aTlvs = nullptr, + uint8_t *aTlvsLength = nullptr, + const otIp6Address **aDestIpAddress = nullptr, bool aAllowEmptyValues = false); otError EncodeNeighborInfo(const otNeighborInfo &aNeighborInfo); @@ -393,11 +396,11 @@ protected: #endif #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE - static void HandleUdpForwardStream(otMessage * aMessage, + static void HandleUdpForwardStream(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, - void * aContext); + void *aContext); void HandleUdpForwardStream(otMessage *aMessage, uint16_t aPeerPort, otIp6Address &aPeerAddr, uint16_t aPort); #endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE #endif // OPENTHREAD_MTD || OPENTHREAD_FTD @@ -489,8 +492,12 @@ protected: void StartLegacy(void); void StopLegacy(void); #else - void StartLegacy(void) {} - void StopLegacy(void) {} + void StartLegacy(void) + { + } + void StopLegacy(void) + { + } #endif static uint8_t ConvertLogLevel(otLogLevel aLogLevel); @@ -563,10 +570,10 @@ protected: #endif // OPENTHREAD_ENABLE_NCP_VENDOR_HOOK protected: - static NcpBase * sNcpInstance; + static NcpBase *sNcpInstance; static spinel_status_t ThreadErrorToSpinelStatus(otError aError); static uint8_t LinkFlagsToFlagByte(bool aRxOnWhenIdle, bool aDeviceType, bool aNetworkData); - Instance * mInstance; + Instance *mInstance; Spinel::Buffer mTxFrameBuffer; Spinel::Encoder mEncoder; Spinel::Decoder mDecoder; @@ -651,13 +658,13 @@ protected: static void HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext); + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext); void HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices); + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices); bool mSrpClientCallbackEnabled; #endif // OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE diff --git a/src/ncp/ncp_base_ftd.cpp b/src/ncp/ncp_base_ftd.cpp index c244f5757..b3fb5ec00 100644 --- a/src/ncp/ncp_base_ftd.cpp +++ b/src/ncp/ncp_base_ftd.cpp @@ -763,7 +763,7 @@ template <> otError NcpBase::HandlePropertyInsert(aContext)->HandleCommissionerEnergyReport(aChannelMask, aEnergyData, aLength); } @@ -997,7 +997,7 @@ exit: template <> otError NcpBase::HandlePropertySet(void) { otError error = OT_ERROR_NONE; - const uint8_t * tlvs; + const uint8_t *tlvs; uint16_t length; otCommissioningDataset dataset; @@ -1014,8 +1014,8 @@ exit: otError NcpBase::HandlePropertySet_SPINEL_PROP_MESHCOP_COMMISSIONER_GENERATE_PSKC(uint8_t aHeader) { otError error = OT_ERROR_NONE; - const char * passPhrase; - const char * networkName; + const char *passPhrase; + const char *networkName; const uint8_t *extPanIdData; uint16_t length; otPskc pskc; @@ -1072,7 +1072,7 @@ template <> otError NcpBase::HandlePropertyInsert(vo { otError error = OT_ERROR_NONE; const otExtAddress *eui64 = nullptr; - const char * pskd = nullptr; + const char *pskd = nullptr; uint32_t joinerTimeout = 0; SuccessOrExit(error = mDecoder.ReadUtf8(pskd)); diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index aa717ee57..79a5aa848 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -365,7 +365,7 @@ exit: return error; } -void NcpBase::HandleMlrRegResult_Jump(void * aContext, +void NcpBase::HandleMlrRegResult_Jump(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, @@ -1099,7 +1099,7 @@ template <> otError NcpBase::HandlePropertyInsert(v otError error = OT_ERROR_NONE; otServiceConfig cfg; bool stable; - const uint8_t * data; + const uint8_t *data; uint16_t dataLen; VerifyOrExit(mAllowLocalServerDataChange, error = OT_ERROR_INVALID_STATE); @@ -1372,9 +1372,9 @@ template <> otError NcpBase::HandlePropertyGet otError NcpBase::HandlePropertySet otError NcpBase::HandlePropertySet otError NcpBase::HandlePropertySet otError NcpBase::HandlePropertySet otError NcpBase::HandlePropertySet(void) uint16_t frameLen = 0; const uint8_t *metaPtr = nullptr; uint16_t metaLen = 0; - otMessage * message = nullptr; + otMessage *message = nullptr; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadDataWithLen(framePtr, frameLen)); @@ -3291,11 +3291,11 @@ template <> otError NcpBase::HandlePropertySet otError NcpBase::HandlePropertySet(void) { - const uint8_t * framePtr = nullptr; + const uint8_t *framePtr = nullptr; uint16_t frameLen = 0; - const uint8_t * metaPtr = nullptr; + const uint8_t *metaPtr = nullptr; uint16_t metaLen = 0; - otMessage * message = nullptr; + otMessage *message = nullptr; otError error = OT_ERROR_NONE; otMessageSettings msgSettings = {false, OT_MESSAGE_PRIORITY_NORMAL}; @@ -3739,7 +3739,7 @@ template <> otError NcpBase::HandlePropertySet otError error; const char *name; uint16_t size; - char * hostNameBuffer; + char *hostNameBuffer; SuccessOrExit(error = mDecoder.ReadUtf8(name)); @@ -3840,9 +3840,9 @@ template <> otError NcpBase::HandlePropertyInsert otError NcpBase::HandlePropertyRemove(void) { otError error = OT_ERROR_NONE; - const char * serviceName; - const char * instanceName; + const char *serviceName; + const char *instanceName; bool toClear = false; const otSrpClientService *service; @@ -3981,17 +3981,17 @@ static spinel_srp_client_error_t SrpClientErrorToSpinelError(otError aError) void NcpBase::HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext) + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext) { static_cast(aContext)->HandleSrpClientCallback(aError, aHostInfo, aServices, aRemovedServices); } void NcpBase::HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices) + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices) { otError error = OT_ERROR_NONE; const otSrpClientService *service; @@ -4348,15 +4348,15 @@ void NcpBase::HandleJoinerCallback(otError aError) #endif #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE -void NcpBase::HandleLinkMetricsReport_Jump(const otIp6Address * aSource, +void NcpBase::HandleLinkMetricsReport_Jump(const otIp6Address *aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, - void * aContext) + void *aContext) { static_cast(aContext)->HandleLinkMetricsReport(aSource, aMetricsValues, aStatus); } -void NcpBase::HandleLinkMetricsReport(const otIp6Address * aSource, +void NcpBase::HandleLinkMetricsReport(const otIp6Address *aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus) { @@ -4393,16 +4393,16 @@ exit: } void NcpBase::HandleLinkMetricsEnhAckProbingIeReport_Jump(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues, - void * aContext) + void *aContext) { static_cast(aContext)->HandleLinkMetricsEnhAckProbingIeReport(aShortAddress, aExtAddress, aMetricsValues); } void NcpBase::HandleLinkMetricsEnhAckProbingIeReport(otShortAddress aShortAddress, - const otExtAddress * aExtAddress, + const otExtAddress *aExtAddress, const otLinkMetricsValues *aMetricsValues) { SuccessOrExit(mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, @@ -4513,12 +4513,12 @@ exit: #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE template <> otError NcpBase::HandlePropertySet(void) { - const uint8_t * framePtr = nullptr; + const uint8_t *framePtr = nullptr; uint16_t frameLen = 0; const otIp6Address *peerAddr; uint16_t peerPort; uint16_t sockPort; - otMessage * message; + otMessage *message; otError error = OT_ERROR_NONE; otMessageSettings msgSettings = {false, OT_MESSAGE_PRIORITY_NORMAL}; @@ -4548,11 +4548,11 @@ exit: return error; } -void NcpBase::HandleUdpForwardStream(otMessage * aMessage, +void NcpBase::HandleUdpForwardStream(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, - void * aContext) + void *aContext) { static_cast(aContext)->HandleUdpForwardStream(aMessage, aPeerPort, *aPeerAddr, aSockPort); } diff --git a/src/ncp/ncp_hdlc.cpp b/src/ncp/ncp_hdlc.cpp index b1a56c344..571e9c076 100644 --- a/src/ncp/ncp_hdlc.cpp +++ b/src/ncp/ncp_hdlc.cpp @@ -66,7 +66,7 @@ static OT_DEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpHdlc), uint64_t); extern "C" void otNcpHdlcInit(otInstance *aInstance, otNcpHdlcSendCallback aSendCallback) { - NcpHdlc * ncpHdlc = nullptr; + NcpHdlc *ncpHdlc = nullptr; Instance *instance = static_cast(aInstance); ncpHdlc = new (&sNcpRaw) NcpHdlc(instance, aSendCallback); @@ -95,10 +95,10 @@ NcpHdlc::NcpHdlc(Instance *aInstance, otNcpHdlcSendCallback aSendCallback) mTxFrameBuffer.SetFrameAddedCallback(HandleFrameAddedToNcpBuffer, this); } -void NcpHdlc::HandleFrameAddedToNcpBuffer(void * aContext, +void NcpHdlc::HandleFrameAddedToNcpBuffer(void *aContext, Spinel::Buffer::FrameTag aTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aBuffer) + Spinel::Buffer *aBuffer) { OT_UNUSED_VARIABLE(aBuffer); OT_UNUSED_VARIABLE(aTag); diff --git a/src/ncp/ncp_hdlc.hpp b/src/ncp/ncp_hdlc.hpp index 15786b814..d0516c001 100644 --- a/src/ncp/ncp_hdlc.hpp +++ b/src/ncp/ncp_hdlc.hpp @@ -122,10 +122,10 @@ private: static void EncodeAndSend(Tasklet &aTasklet); static void HandleFrame(void *aContext, otError aError); - static void HandleFrameAddedToNcpBuffer(void * aContext, + static void HandleFrameAddedToNcpBuffer(void *aContext, Spinel::Buffer::FrameTag aTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aBuffer); + Spinel::Buffer *aBuffer); otNcpHdlcSendCallback mSendCallback; Hdlc::FrameBuffer mHdlcBuffer; diff --git a/src/ncp/ncp_spi.cpp b/src/ncp/ncp_spi.cpp index 618769bc3..aa5aee27c 100644 --- a/src/ncp/ncp_spi.cpp +++ b/src/ncp/ncp_spi.cpp @@ -64,7 +64,7 @@ static OT_DEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpSpi), uint64_t); extern "C" void otNcpSpiInit(otInstance *aInstance) { - NcpSpi * ncpSpi = nullptr; + NcpSpi *ncpSpi = nullptr; Instance *instance = static_cast(aInstance); ncpSpi = new (&sNcpRaw) NcpSpi(instance); @@ -114,7 +114,7 @@ NcpSpi::NcpSpi(Instance *aInstance) /* aRequestTransactionFlag */ true)); } -bool NcpSpi::SpiTransactionComplete(void * aContext, +bool NcpSpi::SpiTransactionComplete(void *aContext, uint8_t *aOutputBuf, uint16_t aOutputLen, uint8_t *aInputBuf, @@ -242,10 +242,10 @@ void NcpSpi::SpiTransactionProcess(void) } } -void NcpSpi::HandleFrameAddedToTxBuffer(void * aContext, +void NcpSpi::HandleFrameAddedToTxBuffer(void *aContext, Spinel::Buffer::FrameTag aTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aBuffer) + Spinel::Buffer *aBuffer) { OT_UNUSED_VARIABLE(aBuffer); OT_UNUSED_VARIABLE(aTag); diff --git a/src/ncp/ncp_spi.hpp b/src/ncp/ncp_spi.hpp index d4a87dd17..43c80dbcb 100644 --- a/src/ncp/ncp_spi.hpp +++ b/src/ncp/ncp_spi.hpp @@ -278,7 +278,7 @@ private: typedef uint8_t LargeFrameBuffer[kSpiBufferSize]; typedef uint8_t EmptyFrameBuffer[kSpiHeaderSize]; - static bool SpiTransactionComplete(void * aContext, + static bool SpiTransactionComplete(void *aContext, uint8_t *aOutputBuf, uint16_t aOutputLen, uint8_t *aInputBuf, @@ -293,10 +293,10 @@ private: static void SpiTransactionProcess(void *aContext); void SpiTransactionProcess(void); - static void HandleFrameAddedToTxBuffer(void * aContext, + static void HandleFrameAddedToTxBuffer(void *aContext, Spinel::Buffer::FrameTag aFrameTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aBuffer); + Spinel::Buffer *aBuffer); static void PrepareTxFrame(Tasklet &aTasklet); void PrepareTxFrame(void); diff --git a/src/posix/client.cpp b/src/posix/client.cpp index e9128b67f..e57516e66 100644 --- a/src/posix/client.cpp +++ b/src/posix/client.cpp @@ -391,7 +391,7 @@ int main(int argc, char *argv[]) lineBuffer[lineBufferWritePos++] = c; if (c == '\n' || lineBufferWritePos >= sizeof(lineBuffer) - 1) { - char * line = lineBuffer; + char *line = lineBuffer; size_t len = lineBufferWritePos; // read one line successfully or line buffer is full diff --git a/src/posix/platform/backtrace.cpp b/src/posix/platform/backtrace.cpp index 02cb07d62..f2c8758e6 100644 --- a/src/posix/platform/backtrace.cpp +++ b/src/posix/platform/backtrace.cpp @@ -74,8 +74,8 @@ static void demangleSymbol(int aIndex, const char *aSymbol) int status; char program[kMaxNameSize + 1]; char mangledName[kMaxNameSize + 1]; - char * demangledName = nullptr; - char * functionName = nullptr; + char *demangledName = nullptr; + char *functionName = nullptr; unsigned int offset = 0; unsigned int address = 0; @@ -113,8 +113,8 @@ exit: static void dumpStack(void) { constexpr uint8_t kMaxDepth = 50; - void * stack[kMaxDepth]; - char ** symbols; + void *stack[kMaxDepth]; + char **symbols; int depth; depth = backtrace(stack, kMaxDepth); diff --git a/src/posix/platform/entropy.cpp b/src/posix/platform/entropy.cpp index 561f27971..79f493886 100644 --- a/src/posix/platform/entropy.cpp +++ b/src/posix/platform/entropy.cpp @@ -95,7 +95,7 @@ otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) #if __SANITIZE_ADDRESS__ == 0 - FILE * file = nullptr; + FILE *file = nullptr; size_t readLength; VerifyOrExit(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS); diff --git a/src/posix/platform/hdlc_interface.cpp b/src/posix/platform/hdlc_interface.cpp index ffbc20650..257aa72d0 100644 --- a/src/posix/platform/hdlc_interface.cpp +++ b/src/posix/platform/hdlc_interface.cpp @@ -125,8 +125,8 @@ namespace ot { namespace Posix { HdlcInterface::HdlcInterface(SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - SpinelInterface::RxFrameBuffer & aFrameBuffer) + void *aCallbackContext, + SpinelInterface::RxFrameBuffer &aFrameBuffer) : mReceiveFrameCallback(aCallback) , mReceiveFrameContext(aCallbackContext) , mReceiveFrameBuffer(aFrameBuffer) @@ -437,7 +437,7 @@ int HdlcInterface::OpenFile(const Url::Url &aRadioUrl) if (isatty(fd)) { struct termios tios; - const char * value; + const char *value; speed_t speed; int stopBit = 1; @@ -630,7 +630,7 @@ int HdlcInterface::ForkPty(const Url::Url &aRadioUrl) if (0 == pid) { constexpr int kMaxArguments = 32; - char * argv[kMaxArguments + 1]; + char *argv[kMaxArguments + 1]; size_t index = 0; argv[index++] = const_cast(aRadioUrl.GetPath()); diff --git a/src/posix/platform/hdlc_interface.hpp b/src/posix/platform/hdlc_interface.hpp index 4fa2ba00f..c66776761 100644 --- a/src/posix/platform/hdlc_interface.hpp +++ b/src/posix/platform/hdlc_interface.hpp @@ -61,8 +61,8 @@ public: * */ HdlcInterface(Spinel::SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - Spinel::SpinelInterface::RxFrameBuffer & aFrameBuffer); + void *aCallbackContext, + Spinel::SpinelInterface::RxFrameBuffer &aFrameBuffer); /** * This destructor deinitializes the object. @@ -146,7 +146,10 @@ public: * @param[in] aEvent The data event. * */ - void Process(const VirtualTimeEvent &aEvent) { Decode(aEvent.mData, aEvent.mDataLength); } + void Process(const VirtualTimeEvent &aEvent) + { + Decode(aEvent.mData, aEvent.mDataLength); + } #endif /** @@ -155,7 +158,10 @@ public: * @returns Bus speed in bits/second. * */ - uint32_t GetBusSpeed(void) const { return mBaudRate; } + uint32_t GetBusSpeed(void) const + { + return mBaudRate; + } /** * This method is called when RCP failure detected and resets internal states of the interface. @@ -175,7 +181,10 @@ public: * @returns The RCP interface metrics. * */ - const otRcpInterfaceMetrics *GetRcpInterfaceMetrics(void) const { return &mInterfaceMetrics; } + const otRcpInterfaceMetrics *GetRcpInterfaceMetrics(void) const + { + return &mInterfaceMetrics; + } private: /** @@ -258,8 +267,8 @@ private: }; Spinel::SpinelInterface::ReceiveFrameCallback mReceiveFrameCallback; - void * mReceiveFrameContext; - Spinel::SpinelInterface::RxFrameBuffer & mReceiveFrameBuffer; + void *mReceiveFrameContext; + Spinel::SpinelInterface::RxFrameBuffer &mReceiveFrameBuffer; int mSockFd; uint32_t mBaudRate; diff --git a/src/posix/platform/include/openthread/platform/secure_settings.h b/src/posix/platform/include/openthread/platform/secure_settings.h index d206c269a..288ad4ff2 100644 --- a/src/posix/platform/include/openthread/platform/secure_settings.h +++ b/src/posix/platform/include/openthread/platform/secure_settings.h @@ -97,8 +97,8 @@ void otPosixSecureSettingsDeinit(otInstance *aInstance); otError otPosixSecureSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, - uint8_t * aValue, - uint16_t * aValueLength); + uint8_t *aValue, + uint16_t *aValueLength); /** * This function sets or replaces the value of a setting identified by aKey. If there was more than one value diff --git a/src/posix/platform/infra_if.cpp b/src/posix/platform/infra_if.cpp index 3fbb4e894..3e7de4dcf 100644 --- a/src/posix/platform/infra_if.cpp +++ b/src/posix/platform/infra_if.cpp @@ -94,7 +94,7 @@ exit: otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address *aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength) { return ot::Posix::InfraNetif::Get().SendIcmp6Nd(aInfraIfIndex, *aDestAddress, aBuffer, aBufferLength); @@ -194,7 +194,7 @@ int CreateNetLinkSocket(void) otError InfraNetif::SendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address &aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength) { otError error = OT_ERROR_NONE; @@ -205,7 +205,7 @@ otError InfraNetif::SendIcmp6Nd(uint32_t aInfraIfIndex, int hopLimit = 255; uint8_t cmsgBuffer[CMSG_SPACE(sizeof(*packetInfo)) + CMSG_SPACE(sizeof(hopLimit))]; struct msghdr msgHeader; - struct cmsghdr * cmsgPointer; + struct cmsghdr *cmsgPointer; ssize_t rval; struct sockaddr_in6 dest; @@ -538,7 +538,7 @@ const uint8_t InfraNetif::kValidNat64PrefixLength[] = {96, 64, 56, 48, 40, void InfraNetif::DiscoverNat64PrefixDone(union sigval sv) { - struct gaicb * req = (struct gaicb *)sv.sival_ptr; + struct gaicb *req = (struct gaicb *)sv.sival_ptr; struct addrinfo *res = (struct addrinfo *)req->ar_result; otIp6Prefix prefix = {}; @@ -616,7 +616,7 @@ otError InfraNetif::DiscoverNat64Prefix(uint32_t aInfraIfIndex) { otError error = OT_ERROR_NONE; struct addrinfo *hints = nullptr; - struct gaicb * reqs[1]; + struct gaicb *reqs[1]; struct sigevent sig; int status; diff --git a/src/posix/platform/infra_if.hpp b/src/posix/platform/infra_if.hpp index 2bd727a64..f9cd86fb3 100644 --- a/src/posix/platform/infra_if.hpp +++ b/src/posix/platform/infra_if.hpp @@ -127,7 +127,7 @@ public: */ otError SendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address &aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength); /** diff --git a/src/posix/platform/multicast_routing.cpp b/src/posix/platform/multicast_routing.cpp index c7272d6fe..9d71481e9 100644 --- a/src/posix/platform/multicast_routing.cpp +++ b/src/posix/platform/multicast_routing.cpp @@ -86,16 +86,16 @@ void MulticastRoutingManager::TearDown(void) Mainloop::Manager::Get().Remove(*this); } -void MulticastRoutingManager::HandleBackboneMulticastListenerEvent(void * aContext, +void MulticastRoutingManager::HandleBackboneMulticastListenerEvent(void *aContext, otBackboneRouterMulticastListenerEvent aEvent, - const otIp6Address * aAddress) + const otIp6Address *aAddress) { static_cast(aContext)->HandleBackboneMulticastListenerEvent( aEvent, static_cast(*aAddress)); } void MulticastRoutingManager::HandleBackboneMulticastListenerEvent(otBackboneRouterMulticastListenerEvent aEvent, - const Ip6::Address & aAddress) + const Ip6::Address &aAddress) { switch (aEvent) { @@ -543,8 +543,8 @@ void MulticastRoutingManager::MulticastForwardingCache::SetValidPktCnt(unsigned mLastUseTime = otPlatTimeGet(); } -void MulticastRoutingManager::SaveMulticastForwardingCache(const Ip6::Address & aSrcAddr, - const Ip6::Address & aGroupAddr, +void MulticastRoutingManager::SaveMulticastForwardingCache(const Ip6::Address &aSrcAddr, + const Ip6::Address &aGroupAddr, MulticastRoutingManager::MifIndex aIif, MulticastRoutingManager::MifIndex aOif) { diff --git a/src/posix/platform/multicast_routing.hpp b/src/posix/platform/multicast_routing.hpp index 72177d805..c55844c27 100644 --- a/src/posix/platform/multicast_routing.hpp +++ b/src/posix/platform/multicast_routing.hpp @@ -126,11 +126,11 @@ private: void RemoveMulticastForwardingCache(MulticastForwardingCache &aMfc) const; static const char *MifIndexToString(MifIndex aMif); void DumpMulticastForwardingCache(void) const; - static void HandleBackboneMulticastListenerEvent(void * aContext, + static void HandleBackboneMulticastListenerEvent(void *aContext, otBackboneRouterMulticastListenerEvent aEvent, - const otIp6Address * aAddress); + const otIp6Address *aAddress); void HandleBackboneMulticastListenerEvent(otBackboneRouterMulticastListenerEvent aEvent, - const Ip6::Address & aAddress); + const Ip6::Address &aAddress); MulticastForwardingCache mMulticastForwardingCacheTable[kMulitcastForwardingCacheTableSize]; uint64_t mLastExpireTime; diff --git a/src/posix/platform/netif.cpp b/src/posix/platform/netif.cpp index 192be598f..a701028bf 100644 --- a/src/posix/platform/netif.cpp +++ b/src/posix/platform/netif.cpp @@ -1026,10 +1026,10 @@ static void logAddrEvent(bool isAdd, const ot::Ip6::Address &aAddress, otError e { otLogInfoPlat("[netif] %s [%s] %s%s", isAdd ? "ADD" : "DEL", aAddress.IsMulticast() ? "M" : "U", aAddress.ToString().AsCString(), - error == OT_ERROR_ALREADY - ? " (already subscribed, ignored)" - : error == OT_ERROR_REJECTED ? " (rejected)" - : error == OT_ERROR_NOT_FOUND ? " (not found, ignored)" : ""); + error == OT_ERROR_ALREADY ? " (already subscribed, ignored)" + : error == OT_ERROR_REJECTED ? " (rejected)" + : error == OT_ERROR_NOT_FOUND ? " (not found, ignored)" + : ""); } else { @@ -1042,7 +1042,7 @@ static void logAddrEvent(bool isAdd, const ot::Ip6::Address &aAddress, otError e static void processNetifAddrEvent(otInstance *aInstance, struct nlmsghdr *aNetlinkMessage) { - struct ifaddrmsg * ifaddr = reinterpret_cast(NLMSG_DATA(aNetlinkMessage)); + struct ifaddrmsg *ifaddr = reinterpret_cast(NLMSG_DATA(aNetlinkMessage)); size_t rtaLength; otError error = OT_ERROR_NONE; struct sockaddr_in6 addr6; @@ -1207,10 +1207,10 @@ static void processNetifAddrEvent(otInstance *aInstance, struct rt_msghdr *rtm) #endif struct sockaddr_in6 addr6; struct sockaddr_in6 netmask; - uint8_t * addrbuf; + uint8_t *addrbuf; unsigned int addrmask = 0; unsigned int i; - struct sockaddr * sa; + struct sockaddr *sa; bool is_link_local; addr6.sin6_family = 0; @@ -1531,10 +1531,10 @@ static void processMLDEvent(otInstance *aInstance) struct sockaddr_in6 srcAddr; socklen_t addrLen = sizeof(srcAddr); bool fromSelf = false; - MLDv2Header * hdr = reinterpret_cast(buffer); + MLDv2Header *hdr = reinterpret_cast(buffer); size_t offset; uint8_t type; - struct ifaddrs * ifAddrs = nullptr; + struct ifaddrs *ifAddrs = nullptr; char addressString[INET6_ADDRSTRLEN + 1]; bufferLen = recvfrom(sMLDMonitorFd, buffer, sizeof(buffer), 0, reinterpret_cast(&srcAddr), &addrLen); @@ -1606,7 +1606,7 @@ exit: static void platformConfigureTunDevice(otPlatformConfig *aPlatformConfig) { struct ifreq ifr; - const char * interfaceName; + const char *interfaceName; sTunFd = open(OPENTHREAD_POSIX_TUN_DEVICE, O_RDWR | O_CLOEXEC | O_NONBLOCK); VerifyOrDie(sTunFd >= 0, OT_EXIT_ERROR_ERRNO); diff --git a/src/posix/platform/platform-posix.h b/src/posix/platform/platform-posix.h index 9e2252a99..8c36122ef 100644 --- a/src/posix/platform/platform-posix.h +++ b/src/posix/platform/platform-posix.h @@ -324,7 +324,7 @@ void virtualTimeDeinit(void); * @param[in] aWriteFdSet A pointer to the write file descriptors. * */ -void virtualTimeProcess(otInstance * aInstance, +void virtualTimeProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet, const fd_set *aErrorFdSet); @@ -340,10 +340,10 @@ void virtualTimeProcess(otInstance * aInstance, * @param[in,out] aTimeout A pointer to the timeout. * */ -void virtualTimeUpdateFdSet(fd_set * aReadFdSet, - fd_set * aWriteFdSet, - fd_set * aErrorFdSet, - int * aMaxFd, +void virtualTimeUpdateFdSet(fd_set *aReadFdSet, + fd_set *aWriteFdSet, + fd_set *aErrorFdSet, + int *aMaxFd, struct timeval *aTimeout); /** diff --git a/src/posix/platform/radio.cpp b/src/posix/platform/radio.cpp index 9114f1d06..1a7aec91b 100644 --- a/src/posix/platform/radio.cpp +++ b/src/posix/platform/radio.cpp @@ -143,7 +143,7 @@ void Radio::Init(void) if (maxPowerTable != nullptr) { constexpr int8_t kPowerDefault = 30; // Default power 1 watt (30 dBm). - const char * str = nullptr; + const char *str = nullptr; uint8_t channel = ot::Radio::kChannelMin; int8_t power = kPowerDefault; otError error; @@ -505,8 +505,8 @@ exit: #if OPENTHREAD_CONFIG_DIAG_ENABLE otError otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, - char * aArgs[], - char * aOutput, + char *aArgs[], + char *aOutput, size_t aOutputMaxLen) { // deliver the platform specific diags commands to radio only ncp. @@ -576,7 +576,7 @@ otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue) otError error; char cmd[OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE]; char output[OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE]; - char * str; + char *str; snprintf(cmd, sizeof(cmd), "gpio get %d", aGpio); SuccessOrExit(error = sRadioSpinel.PlatDiagProcess(cmd, output, sizeof(output))); @@ -604,7 +604,7 @@ otError otPlatDiagGpioGetMode(uint32_t aGpio, otGpioMode *aMode) otError error; char cmd[OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE]; char output[OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE]; - char * str; + char *str; snprintf(cmd, sizeof(cmd), "gpio mode %d", aGpio); SuccessOrExit(error = sRadioSpinel.PlatDiagProcess(cmd, output, sizeof(output))); @@ -658,7 +658,7 @@ otRadioState otPlatRadioGetState(otInstance *aInstance) return sRadioSpinel.GetState(); } -void otPlatRadioSetMacKey(otInstance * aInstance, +void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKeyMaterial *aPrevKey, @@ -726,10 +726,10 @@ otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode) } #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, +otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, const otShortAddress aShortAddress, - const otExtAddress * aExtAddress) + const otExtAddress *aExtAddress) { OT_UNUSED_VARIABLE(aInstance); diff --git a/src/posix/platform/spi_interface.cpp b/src/posix/platform/spi_interface.cpp index 33f6d0cac..0e0218c3b 100644 --- a/src/posix/platform/spi_interface.cpp +++ b/src/posix/platform/spi_interface.cpp @@ -65,8 +65,8 @@ namespace ot { namespace Posix { SpiInterface::SpiInterface(SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - SpinelInterface::RxFrameBuffer & aFrameBuffer) + void *aCallbackContext, + SpinelInterface::RxFrameBuffer &aFrameBuffer) : mReceiveFrameCallback(aCallback) , mReceiveFrameContext(aCallbackContext) , mRxFrameBuffer(aFrameBuffer) @@ -343,7 +343,7 @@ void SpiInterface::TriggerReset(void) uint8_t *SpiInterface::GetRealRxFrameStart(uint8_t *aSpiRxFrameBuffer, uint8_t aAlignAllowance, uint16_t &aSkipLength) { - uint8_t * start = aSpiRxFrameBuffer; + uint8_t *start = aSpiRxFrameBuffer; const uint8_t *end = aSpiRxFrameBuffer + aAlignAllowance; for (; start != end && start[0] == 0xff; start++) @@ -408,8 +408,8 @@ otError SpiInterface::PushPullSpi(void) uint16_t spiTransferBytes = 0; uint8_t successfulExchanges = 0; bool discardRxFrame = true; - uint8_t * spiRxFrameBuffer; - uint8_t * spiRxFrame; + uint8_t *spiRxFrameBuffer; + uint8_t *spiRxFrame; uint8_t slaveHeader; uint16_t slaveAcceptLen; Ncp::SpiFrame txFrame(mSpiTxFrameBuffer); diff --git a/src/posix/platform/spi_interface.hpp b/src/posix/platform/spi_interface.hpp index b2e8a0268..988d13fe3 100644 --- a/src/posix/platform/spi_interface.hpp +++ b/src/posix/platform/spi_interface.hpp @@ -65,8 +65,8 @@ public: * */ SpiInterface(Spinel::SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - Spinel::SpinelInterface::RxFrameBuffer & aFrameBuffer); + void *aCallbackContext, + Spinel::SpinelInterface::RxFrameBuffer &aFrameBuffer); /** * This destructor deinitializes the object. @@ -221,8 +221,8 @@ private: }; Spinel::SpinelInterface::ReceiveFrameCallback mReceiveFrameCallback; - void * mReceiveFrameContext; - Spinel::SpinelInterface::RxFrameBuffer & mRxFrameBuffer; + void *mReceiveFrameContext; + Spinel::SpinelInterface::RxFrameBuffer &mRxFrameBuffer; int mSpiDevFd; int mResetGpioValueFd; diff --git a/src/posix/platform/trel.cpp b/src/posix/platform/trel.cpp index f3ec6cf59..4b7cd50e3 100644 --- a/src/posix/platform/trel.cpp +++ b/src/posix/platform/trel.cpp @@ -85,8 +85,8 @@ static const char *BufferToString(const uint8_t *aBuffer, uint16_t aLength) static char string[1600]; uint16_t num = 0; - char * cur = &string[0]; - char * end = &string[sizeof(string) - 1]; + char *cur = &string[0]; + char *end = &string[sizeof(string) - 1]; cur += snprintf(cur, (uint16_t)(end - cur), "[(len:%d) ", aLength); VerifyOrExit(cur < end); @@ -449,8 +449,8 @@ exit: return; } -void otPlatTrelSend(otInstance * aInstance, - const uint8_t * aUdpPayload, +void otPlatTrelSend(otInstance *aInstance, + const uint8_t *aUdpPayload, uint16_t aUdpPayloadLen, const otSockAddr *aDestSockAddr) { diff --git a/src/posix/platform/udp.cpp b/src/posix/platform/udp.cpp index b7aacc5fa..0ff3441d3 100644 --- a/src/posix/platform/udp.cpp +++ b/src/posix/platform/udp.cpp @@ -98,7 +98,7 @@ otError transmitPacket(int aFd, uint8_t *aPayload, uint16_t aLength, const otMes size_t controlLength = 0; struct iovec iov; struct msghdr msg; - struct cmsghdr * cmsg; + struct cmsghdr *cmsg; ssize_t rval; otError error = OT_ERROR_NONE; @@ -317,7 +317,7 @@ otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifId #else // __NetBSD__ || __FreeBSD__ || __APPLE__ unsigned int netifIndex = 0; VerifyOrExit(setsockopt(fd, IPPROTO_IPV6, IPV6_BOUND_IF, &netifIndex, sizeof(netifIndex)) == 0, - error = OT_ERROR_FAILED); + error = OT_ERROR_FAILED); #endif // __linux__ break; } @@ -328,7 +328,7 @@ otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifId error = OT_ERROR_FAILED); #else // __NetBSD__ || __FreeBSD__ || __APPLE__ VerifyOrExit(setsockopt(fd, IPPROTO_IPV6, IPV6_BOUND_IF, &gNetifIndex, sizeof(gNetifIndex)) == 0, - error = OT_ERROR_FAILED); + error = OT_ERROR_FAILED); #endif // __linux__ break; } @@ -388,8 +388,8 @@ otError otPlatUdpConnect(otUdpSocket *aUdpSocket) if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &netifName, &len) != 0) { - otLogWarnPlat("Failed to read socket bound device: %s", strerror(errno)); - len = 0; + otLogWarnPlat("Failed to read socket bound device: %s", strerror(errno)); + len = 0; } // There is a bug in linux that connecting to AF_UNSPEC does not disconnect. @@ -400,11 +400,11 @@ otError otPlatUdpConnect(otUdpSocket *aUdpSocket) if (len > 0 && netifName[0] != '\0') { - fd = FdFromHandle(aUdpSocket->mHandle); - VerifyOrExit(setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &netifName, len) == 0, { - otLogWarnPlat("Failed to bind to device: %s", strerror(errno)); - error = OT_ERROR_FAILED; - }); + fd = FdFromHandle(aUdpSocket->mHandle); + VerifyOrExit(setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &netifName, len) == 0, { + otLogWarnPlat("Failed to bind to device: %s", strerror(errno)); + error = OT_ERROR_FAILED; + }); } ExitNow(); @@ -463,7 +463,7 @@ exit: return error; } -otError otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket, +otError otPlatUdpJoinMulticastGroup(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier, const otIp6Address *aAddress) { @@ -503,7 +503,7 @@ exit: return error; } -otError otPlatUdpLeaveMulticastGroup(otUdpSocket * aUdpSocket, +otError otPlatUdpLeaveMulticastGroup(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier, const otIp6Address *aAddress) { @@ -624,7 +624,7 @@ void Udp::Process(const otSysMainloopContext &aContext) if (fd > 0 && FD_ISSET(fd, &aContext.mReadFdSet)) { otMessageInfo messageInfo; - otMessage * message = nullptr; + otMessage *message = nullptr; uint8_t payload[kMaxUdpSize]; uint16_t length = sizeof(payload); diff --git a/src/posix/platform/utils.cpp b/src/posix/platform/utils.cpp index e49740429..8183ac391 100644 --- a/src/posix/platform/utils.cpp +++ b/src/posix/platform/utils.cpp @@ -55,7 +55,7 @@ otError ExecuteCommand(const char *aFormat, ...) char cmd[kSystemCommandMaxLength]; char buf[kOutputBufferSize]; va_list args; - FILE * file; + FILE *file; int exitCode; otError error = OT_ERROR_NONE; diff --git a/src/posix/platform/vendor_interface.hpp b/src/posix/platform/vendor_interface.hpp index 0d82eab88..4b2011c55 100644 --- a/src/posix/platform/vendor_interface.hpp +++ b/src/posix/platform/vendor_interface.hpp @@ -62,8 +62,8 @@ public: * */ VendorInterface(Spinel::SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - Spinel::SpinelInterface::RxFrameBuffer & aFrameBuffer); + void *aCallbackContext, + Spinel::SpinelInterface::RxFrameBuffer &aFrameBuffer); /** * This destructor deinitializes the object. diff --git a/src/posix/platform/vendor_interface_example.cpp b/src/posix/platform/vendor_interface_example.cpp index 12121d398..63fc22041 100644 --- a/src/posix/platform/vendor_interface_example.cpp +++ b/src/posix/platform/vendor_interface_example.cpp @@ -50,8 +50,8 @@ class VendorInterfaceImpl { public: explicit VendorInterfaceImpl(SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - SpinelInterface::RxFrameBuffer & aFrameBuffer) + void *aCallbackContext, + SpinelInterface::RxFrameBuffer &aFrameBuffer) : mReceiveFrameCallback(aCallback) , mReceiveFrameContext(aCallbackContext) , mRxFrameBuffer(aFrameBuffer) @@ -65,8 +65,8 @@ public: private: SpinelInterface::ReceiveFrameCallback mReceiveFrameCallback; - void * mReceiveFrameContext; - SpinelInterface::RxFrameBuffer & mRxFrameBuffer; + void *mReceiveFrameContext; + SpinelInterface::RxFrameBuffer &mRxFrameBuffer; }; // ---------------------------------------------------------------------------- @@ -76,8 +76,8 @@ private: static OT_DEFINE_ALIGNED_VAR(sVendorInterfaceImplRaw, sizeof(VendorInterfaceImpl), uint64_t); VendorInterface::VendorInterface(SpinelInterface::ReceiveFrameCallback aCallback, - void * aCallbackContext, - SpinelInterface::RxFrameBuffer & aFrameBuffer) + void *aCallbackContext, + SpinelInterface::RxFrameBuffer &aFrameBuffer) { new (&sVendorInterfaceImplRaw) VendorInterfaceImpl(aCallback, aCallbackContext, aFrameBuffer); OT_UNUSED_VARIABLE(sVendorInterfaceImplRaw); diff --git a/src/posix/platform/virtual_time.cpp b/src/posix/platform/virtual_time.cpp index b6faf38a1..7420098c2 100644 --- a/src/posix/platform/virtual_time.cpp +++ b/src/posix/platform/virtual_time.cpp @@ -55,7 +55,7 @@ static uint16_t sPortOffset = 0; ///< Port offset for simulation. void virtualTimeInit(uint16_t aNodeId) { struct sockaddr_in sockaddr; - char * offset; + char *offset; memset(&sockaddr, 0, sizeof(sockaddr)); sockaddr.sin_family = AF_INET; @@ -159,10 +159,10 @@ void virtualTimeSendRadioSpinelWriteEvent(const uint8_t *aData, uint16_t aLength virtualTimeSendEvent(&event, offsetof(struct VirtualTimeEvent, mData) + event.mDataLength); } -void virtualTimeUpdateFdSet(fd_set * aReadFdSet, - fd_set * aWriteFdSet, - fd_set * aErrorFdSet, - int * aMaxFd, +void virtualTimeUpdateFdSet(fd_set *aReadFdSet, + fd_set *aWriteFdSet, + fd_set *aErrorFdSet, + int *aMaxFd, struct timeval *aTimeout) { OT_UNUSED_VARIABLE(aWriteFdSet); @@ -176,7 +176,7 @@ void virtualTimeUpdateFdSet(fd_set * aReadFdSet, } } -void virtualTimeProcess(otInstance * aInstance, +void virtualTimeProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet, const fd_set *aErrorFdSet) diff --git a/tests/fuzz/cli_received.cpp b/tests/fuzz/cli_received.cpp index aa532925c..a8a2a10e3 100644 --- a/tests/fuzz/cli_received.cpp +++ b/tests/fuzz/cli_received.cpp @@ -73,7 +73,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) const otPanId panId = 0xdead; otInstance *instance = nullptr; - uint8_t * buf = nullptr; + uint8_t *buf = nullptr; VerifyOrExit(size <= 65536); diff --git a/tests/fuzz/fuzzer_platform.cpp b/tests/fuzz/fuzzer_platform.cpp index 1c00d5e0d..f977d075a 100644 --- a/tests/fuzz/fuzzer_platform.cpp +++ b/tests/fuzz/fuzzer_platform.cpp @@ -498,8 +498,8 @@ void otPlatSettingsWipe(otInstance *aInstance) otError otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, - char * aArgs[], - char * aOutput, + char *aArgs[], + char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); diff --git a/tests/fuzz/ip6_send.cpp b/tests/fuzz/ip6_send.cpp index 9dfcc9d8f..ef366a0a5 100644 --- a/tests/fuzz/ip6_send.cpp +++ b/tests/fuzz/ip6_send.cpp @@ -61,8 +61,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const otPanId panId = 0xdead; - otInstance * instance = nullptr; - otMessage * message = nullptr; + otInstance *instance = nullptr; + otMessage *message = nullptr; otError error = OT_ERROR_NONE; otMessageSettings settings; diff --git a/tests/fuzz/ncp_hdlc_received.cpp b/tests/fuzz/ncp_hdlc_received.cpp index 129623abf..8afb417ea 100644 --- a/tests/fuzz/ncp_hdlc_received.cpp +++ b/tests/fuzz/ncp_hdlc_received.cpp @@ -71,7 +71,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) const otPanId panId = 0xdead; otInstance *instance = nullptr; - uint8_t * buf = nullptr; + uint8_t *buf = nullptr; VerifyOrExit(size <= 65536); diff --git a/tests/fuzz/radio_receive_done.cpp b/tests/fuzz/radio_receive_done.cpp index 6878ff370..04399cd6f 100644 --- a/tests/fuzz/radio_receive_done.cpp +++ b/tests/fuzz/radio_receive_done.cpp @@ -61,9 +61,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const otPanId panId = 0xdead; - otInstance * instance = nullptr; + otInstance *instance = nullptr; otRadioFrame frame; - uint8_t * buf = nullptr; + uint8_t *buf = nullptr; VerifyOrExit(size <= OT_RADIO_FRAME_MAX_SIZE); diff --git a/tests/unit/test_aes.cpp b/tests/unit/test_aes.cpp index ce75b2852..e88b1e20e 100644 --- a/tests/unit/test_aes.cpp +++ b/tests/unit/test_aes.cpp @@ -55,7 +55,7 @@ void TestMacBeaconFrame(void) 0xAC, 0x02, 0x05, 0x00, 0x00, 0x00, 0x55, 0xCF, 0x00, 0x00, 0x51, 0x52, 0x53, 0x54, 0x22, 0x3B, 0xC1, 0xEC, 0x84, 0x1A, 0xB5, 0x53}; - otInstance * instance = testInitInstance(); + otInstance *instance = testInitInstance(); ot::Crypto::AesCcm aesCcm; uint32_t headerLength = sizeof(test) - 8; uint32_t payloadLength = 0; @@ -122,8 +122,8 @@ void TestMacCommandFrame(void) uint8_t tag[kTagLength]; - ot::Instance * instance = testInitInstance(); - ot::Message * message; + ot::Instance *instance = testInitInstance(); + ot::Message *message; ot::Crypto::AesCcm aesCcm; VerifyOrQuit(instance != nullptr); @@ -195,9 +195,9 @@ void TestInPlaceAesCcmProcessing(void) uint8_t header[kHeaderLength]; ot::Crypto::AesCcm aesCcm; - ot::Instance * instance = testInitInstance(); - ot::Message * message; - ot::Message * messageClone; + ot::Instance *instance = testInitInstance(); + ot::Message *message; + ot::Message *messageClone; VerifyOrQuit(instance != nullptr); diff --git a/tests/unit/test_checksum.cpp b/tests/unit/test_checksum.cpp index 101b88582..b0b17b5f6 100644 --- a/tests/unit/test_checksum.cpp +++ b/tests/unit/test_checksum.cpp @@ -73,7 +73,7 @@ uint16_t CalculateChecksum(const void *aBuffer, uint16_t aLength) uint16_t CalculateChecksum(const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t aIpProto, - const Message & aMessage) + const Message &aMessage) { // This method calculates the checksum over an IPv6 message. constexpr uint16_t kMaxPayload = 1024; @@ -112,7 +112,7 @@ uint16_t CalculateChecksum(const Ip6::Address &aSource, uint16_t CalculateChecksum(const Ip4::Address &aSource, const Ip4::Address &aDestination, uint8_t aIpProto, - const Message & aMessage) + const Message &aMessage) { // This method calculates the checksum over an IPv4 message. constexpr uint16_t kMaxPayload = 1024; @@ -181,7 +181,7 @@ void TestUdpMessageChecksum(void) for (uint16_t size = kMinSize; size <= kMaxSize; size++) { - Message * message = instance->Get().NewMessage(sizeof(Ip6::Udp::Header)); + Message *message = instance->Get().NewMessage(sizeof(Ip6::Udp::Header)); Ip6::Udp::Header udpHeader; Ip6::MessageInfo messageInfo; @@ -249,7 +249,7 @@ void TestIcmp6MessageChecksum(void) for (uint16_t size = kMinSize; size <= kMaxSize; size++) { - Message * message = instance->Get().NewMessage(sizeof(Ip6::Icmp::Header)); + Message *message = instance->Get().NewMessage(sizeof(Ip6::Icmp::Header)); Ip6::Icmp::Header icmp6Header; Ip6::MessageInfo messageInfo; @@ -324,7 +324,7 @@ void TestTcp4MessageChecksum(void) for (uint16_t size = kMinSize; size <= kMaxSize; size++) { - Message * message = instance->Get().NewMessage(sizeof(Ip4::Tcp::Header)); + Message *message = instance->Get().NewMessage(sizeof(Ip4::Tcp::Header)); Ip4::Tcp::Header tcpHeader; VerifyOrQuit(message != nullptr, "Ip6::NewMesssage() failed"); @@ -379,7 +379,7 @@ void TestUdp4MessageChecksum(void) for (uint16_t size = kMinSize; size <= kMaxSize; size++) { - Message * message = instance->Get().NewMessage(sizeof(Ip4::Udp::Header)); + Message *message = instance->Get().NewMessage(sizeof(Ip4::Udp::Header)); Ip4::Udp::Header udpHeader; VerifyOrQuit(message != nullptr, "Ip6::NewMesssage() failed"); @@ -418,13 +418,13 @@ void TestUdp4MessageChecksum(void) void TestIcmp4MessageChecksum(void) { // A captured ICMP echo request (ping) message. Checksum field is set to zero. - const uint8_t kExampleIcmpMessage[] = "\x08\x00\x00\x00\x67\x2e\x00\x00\x62\xaf\xf1\x61\x00\x04\xfc\x24" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27" - "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37"; - uint16_t kChecksumForExampleMessage = 0x5594; - Instance *instance = static_cast(testInitInstance()); - Message * message = instance->Get().NewMessage(sizeof(kExampleIcmpMessage)); + const uint8_t kExampleIcmpMessage[] = "\x08\x00\x00\x00\x67\x2e\x00\x00\x62\xaf\xf1\x61\x00\x04\xfc\x24" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27" + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37"; + uint16_t kChecksumForExampleMessage = 0x5594; + Instance *instance = static_cast(testInitInstance()); + Message *message = instance->Get().NewMessage(sizeof(kExampleIcmpMessage)); Ip4::Address source; Ip4::Address dest; diff --git a/tests/unit/test_child.cpp b/tests/unit/test_child.cpp index fb30ace79..2a796a333 100644 --- a/tests/unit/test_child.cpp +++ b/tests/unit/test_child.cpp @@ -191,10 +191,10 @@ void TestChildIp6Address(void) Child child; Ip6::Address addresses[kMaxChildIp6Addresses]; uint8_t numAddresses; - const char * ip6Addresses[] = { - "fd00:1234::1234", - "ff6b:e251:52fb:0:12e6:b94c:1c28:c56a", - "fd00:1234::204c:3d7c:98f6:9a1b", + const char *ip6Addresses[] = { + "fd00:1234::1234", + "ff6b:e251:52fb:0:12e6:b94c:1c28:c56a", + "fd00:1234::204c:3d7c:98f6:9a1b", }; const uint8_t meshLocalIidArray[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; diff --git a/tests/unit/test_child_table.cpp b/tests/unit/test_child_table.cpp index 3281baa1a..2fb4583f4 100644 --- a/tests/unit/test_child_table.cpp +++ b/tests/unit/test_child_table.cpp @@ -124,7 +124,7 @@ void VerifyChildTableContent(ChildTable &aTable, uint16_t aChildListLength, cons for (uint16_t listIndex = 0; listIndex < aChildListLength; listIndex++) { - Child * child; + Child *child; Mac::Address address; if (!StateMatchesFilter(aChildList[listIndex].mState, filter)) @@ -164,8 +164,8 @@ void VerifyChildTableContent(ChildTable &aTable, uint16_t aChildListLength, cons for (; !iter.IsDone(); iter++) { - Child * child = iter.GetChild(); - Child & childRef = *iter; + Child *child = iter.GetChild(); + Child &childRef = *iter; bool didFind = false; uint16_t childIndex; diff --git a/tests/unit/test_cmd_line_parser.cpp b/tests/unit/test_cmd_line_parser.cpp index 46d5915c1..7f832cf11 100644 --- a/tests/unit/test_cmd_line_parser.cpp +++ b/tests/unit/test_cmd_line_parser.cpp @@ -252,7 +252,7 @@ void TestParsingHexStrings(void) uint8_t buffer[sizeof(kEvenParsedArray)]; uint8_t buf3[3]; uint16_t len; - const char * string; + const char *string; const uint8_t *bufPtr; // Verify `ParseAsHexString(const char *aString, uint8_t *aBuffer, uint16_t aSize)` diff --git a/tests/unit/test_dns.cpp b/tests/unit/test_dns.cpp index 89cdbe8ae..7214f2ce4 100644 --- a/tests/unit/test_dns.cpp +++ b/tests/unit/test_dns.cpp @@ -49,24 +49,24 @@ void TestDnsName(void) struct TestName { - const char * mName; + const char *mName; uint16_t mEncodedLength; const uint8_t *mEncodedData; - const char ** mLabels; - const char * mExpectedReadName; + const char **mLabels; + const char *mExpectedReadName; }; - Instance * instance; + Instance *instance; MessagePool *messagePool; - Message * message; + Message *message; uint8_t buffer[kMaxSize]; uint16_t len; uint16_t offset; char label[Dns::Name::kMaxLabelSize]; uint8_t labelLength; char name[Dns::Name::kMaxNameSize]; - const char * subDomain; - const char * domain; + const char *subDomain; + const char *domain; static const uint8_t kEncodedName1[] = {7, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 3, 'c', 'o', 'm', 0}; static const uint8_t kEncodedName2[] = {3, 'f', 'o', 'o', 1, 'a', 2, 'b', 'b', 3, 'e', 'd', 'u', 0}; @@ -444,10 +444,10 @@ void TestDnsCompressedName(void) static const char kBadName[] = "bad.name"; - Instance * instance; + Instance *instance; MessagePool *messagePool; - Message * message; - Message * message2; + Message *message; + Message *message2; uint16_t offset; uint16_t name1Offset; uint16_t name2Offset; @@ -799,9 +799,9 @@ void TestHeaderAndResourceRecords(void) const char *kInstanceLabels[] = {kInstance1Label, kInstance2Label}; const char *kInstanceNames[] = {kInstance1Name, kInstance2Name}; - Instance * instance; - MessagePool * messagePool; - Message * message; + Instance *instance; + MessagePool *messagePool; + Message *message; Dns::Header header; uint16_t messageId; uint16_t headerOffset; @@ -1240,9 +1240,9 @@ void TestDnsTxtEntry(void) {kEncodedTxt5, sizeof(kEncodedTxt5)}, {kEncodedTxt6, sizeof(kEncodedTxt6)}, {kEncodedTxt7, sizeof(kEncodedTxt7)}}; - Instance * instance; - MessagePool * messagePool; - Message * message; + Instance *instance; + MessagePool *messagePool; + Message *message; uint8_t txtData[kMaxTxtDataSize]; uint16_t txtDataLength; uint8_t index; diff --git a/tests/unit/test_dso.cpp b/tests/unit/test_dso.cpp index af71aeb66..61c4f5893 100644 --- a/tests/unit/test_dso.cpp +++ b/tests/unit/test_dso.cpp @@ -118,8 +118,8 @@ class Connection : public Dso::Connection friend void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage); public: - explicit Connection(Instance & aInstance, - const char * aName, + explicit Connection(Instance &aInstance, + const char *aName, const Ip6::SockAddr &aLocalSockAddr, const Ip6::SockAddr &aPeerSockAddr) : Dso::Connection(aInstance, aPeerSockAddr, sCallbacks) @@ -129,7 +129,7 @@ public: ClearTestFlags(); } - const char * GetName(void) const { return mName; } + const char *GetName(void) const { return mName; } const Ip6::SockAddr &GetLocalSockAddr(void) const { return mLocalSockAddr; } void ClearTestFlags(void) @@ -247,7 +247,7 @@ private: } Error ProcessResponseMessage(const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Dso::Tlv::Type aResponseTlvType, Dso::Tlv::Type aRequestTlvType) { @@ -289,22 +289,22 @@ private: static Error ProcessRequestMessage(Dso::Connection &aConnection, MessageId aMessageId, - const Message & aMessage, + const Message &aMessage, Dso::Tlv::Type aPrimaryTlvType) { return static_cast(aConnection).ProcessRequestMessage(aMessageId, aMessage, aPrimaryTlvType); } static Error ProcessUnidirectionalMessage(Dso::Connection &aConnection, - const Message & aMessage, + const Message &aMessage, Dso::Tlv::Type aPrimaryTlvType) { return static_cast(aConnection).ProcessUnidirectionalMessage(aMessage, aPrimaryTlvType); } - static Error ProcessResponseMessage(Dso::Connection & aConnection, + static Error ProcessResponseMessage(Dso::Connection &aConnection, const Dns::Header &aHeader, - const Message & aMessage, + const Message &aMessage, Dso::Tlv::Type aResponseTlvType, Dso::Tlv::Type aRequestTlvType) { @@ -312,7 +312,7 @@ private: .ProcessResponseMessage(aHeader, aMessage, aResponseTlvType, aRequestTlvType); } - const char * mName; + const char *mName; Ip6::SockAddr mLocalSockAddr; bool mDidGetConnectedSignal; bool mDidGetSessionEstablishedSignal; @@ -380,8 +380,8 @@ void otPlatDsoEnableListening(otInstance *, bool aEnable) void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr) { - Connection & conn = *static_cast(aConnection); - Connection * peerConn = nullptr; + Connection &conn = *static_cast(aConnection); + Connection *peerConn = nullptr; const Ip6::SockAddr &peerSockAddr = AsCoreType(aPeerSockAddr); Log(" otPlatDsoConnect(%s, aPeer:0x%04x)", conn.GetName(), peerSockAddr.GetPort()); @@ -545,12 +545,12 @@ void TestDso(void) static constexpr uint32_t kRetryDelayInterval = TimeMilli::SecToMsec(3600); static constexpr uint32_t kLongResponseTimeout = Dso::kResponseTimeout + TimeMilli::SecToMsec(17); - Instance & instance = *static_cast(testInitInstance()); + Instance &instance = *static_cast(testInitInstance()); Ip6::SockAddr serverSockAddr(kPortA); Ip6::SockAddr clientSockAddr(kPortB); Connection serverConn(instance, "serverConn", serverSockAddr, clientSockAddr); Connection clientConn(instance, "clinetConn", clientSockAddr, serverSockAddr); - Message * message; + Message *message; Dso::Tlv tlv; Connection::MessageId messageId; diff --git a/tests/unit/test_frame_builder.cpp b/tests/unit/test_frame_builder.cpp index e089f666e..8c648e32e 100644 --- a/tests/unit/test_frame_builder.cpp +++ b/tests/unit/test_frame_builder.cpp @@ -43,8 +43,8 @@ void TestFrameBuilder(void) static constexpr uint16_t kMaxBufferSize = sizeof(kData1) * 2 + sizeof(kData2); - Instance * instance; - Message * message; + Instance *instance; + Message *message; uint16_t offset; uint8_t buffer[kMaxBufferSize]; uint8_t zeroBuffer[kMaxBufferSize]; diff --git a/tests/unit/test_hdlc.cpp b/tests/unit/test_hdlc.cpp index e820d5c46..9e38d1898 100644 --- a/tests/unit/test_hdlc.cpp +++ b/tests/unit/test_hdlc.cpp @@ -58,7 +58,7 @@ static const uint8_t sMottoText[] = "Think good thoughts, say good words, d static const uint8_t sHexText[] = "0123456789abcdef"; static const uint8_t sSkipText[] = "Skip text"; static const uint8_t sHdlcSpecials[] = {kFlagSequence, kFlagXOn, kFlagXOff, - kFlagSequence, kEscapeSequence, kFlagSpecial}; + kFlagSequence, kEscapeSequence, kFlagSpecial}; otError WriteToBuffer(const uint8_t *aText, Hdlc::FrameWritePointer &aWritePointer) { @@ -126,8 +126,8 @@ void TestHdlcFrameBuffer(void) void TestHdlcMultiFrameBuffer(void) { Hdlc::MultiFrameBuffer frameBuffer; - uint8_t * frame = nullptr; - uint8_t * newFrame = nullptr; + uint8_t *frame = nullptr; + uint8_t *newFrame = nullptr; uint16_t length; uint16_t newLength; @@ -454,7 +454,7 @@ void TestEncoderDecoder(void) DecoderContext decoderContext; Hdlc::Encoder encoder(encoderBuffer); Hdlc::Decoder decoder(decoderBuffer, ProcessDecodedFrame, &decoderContext); - uint8_t * frame; + uint8_t *frame; uint16_t length; uint8_t badShortFrame[3] = {kFlagSequence, 0xaa, kFlagSequence}; diff --git a/tests/unit/test_heap.cpp b/tests/unit/test_heap.cpp index 813d200bb..b6cc88425 100644 --- a/tests/unit/test_heap.cpp +++ b/tests/unit/test_heap.cpp @@ -82,7 +82,7 @@ void TestAllocateRandomly(size_t aSizeLimit, unsigned int aSeed) { struct Node { - Node * mNext; + Node *mNext; size_t mSize; }; @@ -93,7 +93,7 @@ void TestAllocateRandomly(size_t aSizeLimit, unsigned int aSeed) srand(aSeed); const size_t totalSize = heap.GetFreeSize(); - Node * last = &head; + Node *last = &head; do { diff --git a/tests/unit/test_heap_array.cpp b/tests/unit/test_heap_array.cpp index 2ed953570..bb95185ca 100644 --- a/tests/unit/test_heap_array.cpp +++ b/tests/unit/test_heap_array.cpp @@ -182,7 +182,7 @@ void TestHeapArrayOfUint16(void) { Heap::Array array; Heap::Array array2; - uint16_t * entry; + uint16_t *entry; printf("\n\n====================================================================================\n"); printf("TestHeapArrayOfUint16\n\n"); @@ -348,7 +348,7 @@ void TestHeapArray(void) { Heap::Array array; Heap::Array array2; - Entry * entry; + Entry *entry; printf("------------------------------------------------------------------------------------\n"); printf("After constructor\n"); diff --git a/tests/unit/test_heap_string.cpp b/tests/unit/test_heap_string.cpp index b7973c2c9..de223f8c8 100644 --- a/tests/unit/test_heap_string.cpp +++ b/tests/unit/test_heap_string.cpp @@ -86,7 +86,7 @@ void TestHeapString(void) { Heap::String str1; Heap::String str2; - const char * oldBuffer; + const char *oldBuffer; printf("====================================================================================\n"); printf("TestHeapString\n\n"); @@ -199,9 +199,9 @@ template void VerifyData(const Heap::Data &aData, const uint8 void TestHeapData(void) { - Instance * instance; - MessagePool * messagePool; - Message * message; + Instance *instance; + MessagePool *messagePool; + Message *message; Heap::Data data; uint16_t offset; const uint8_t *oldBuffer; diff --git a/tests/unit/test_hkdf_sha256.cpp b/tests/unit/test_hkdf_sha256.cpp index ca12be620..a50ac8488 100644 --- a/tests/unit/test_hkdf_sha256.cpp +++ b/tests/unit/test_hkdf_sha256.cpp @@ -59,7 +59,7 @@ void TestHkdfSha256(void) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Test Case #1: RFC-5869 Appendix A.1 const uint8_t kInKey1[] = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}; + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}; const uint8_t kSalt1[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c}; const uint8_t kInfo1[] = {0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9}; const uint8_t kOutKey1[] = {0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, diff --git a/tests/unit/test_hmac_sha256.cpp b/tests/unit/test_hmac_sha256.cpp index 5c9a97831..7b9e20ad1 100644 --- a/tests/unit/test_hmac_sha256.cpp +++ b/tests/unit/test_hmac_sha256.cpp @@ -72,7 +72,7 @@ void TestSha256(void) struct TestCase { - const char * mData; // (null-terminated string). + const char *mData; // (null-terminated string). otCryptoSha256Hash mHash; }; @@ -85,9 +85,9 @@ void TestSha256(void) printf("TestSha256\n"); - Instance * instance = testInitInstance(); + Instance *instance = testInitInstance(); MessagePool *messagePool; - Message * message; + Message *message; uint16_t offsets[GetArrayLength(kTestCases)]; uint8_t index; @@ -142,7 +142,7 @@ void TestHmacSha256(void) struct TestCase { otCryptoKey mKey; - const void * mData; + const void *mData; uint16_t mDataLength; otCryptoSha256Hash mHash; }; @@ -226,9 +226,9 @@ void TestHmacSha256(void) {{&kKey5[0], sizeof(kKey5), 0}, kData5, sizeof(kData5) - 1, kHash5}, }; - Instance * instance = testInitInstance(); + Instance *instance = testInitInstance(); MessagePool *messagePool; - Message * message; + Message *message; uint16_t offsets[GetArrayLength(kTestCases)]; uint8_t index; diff --git a/tests/unit/test_ip_address.cpp b/tests/unit/test_ip_address.cpp index dc9fd0639..8d459d555 100644 --- a/tests/unit/test_ip_address.cpp +++ b/tests/unit/test_ip_address.cpp @@ -36,7 +36,7 @@ template struct TestVector { - const char * mString; + const char *mString; const uint8_t mAddr[sizeof(AddressType)]; ot::Error mError; }; @@ -529,10 +529,10 @@ void TestIp4Cidr(void) using ot::Encoding::BigEndian::HostSwap32; struct TestCase { - const char * mNetwork; + const char *mNetwork; const uint8_t mLength; const uint32_t mHost; - const char * mOutcome; + const char *mOutcome; }; const TestCase kTestCases[] = { diff --git a/tests/unit/test_link_quality.cpp b/tests/unit/test_link_quality.cpp index e66db690d..1fd895926 100644 --- a/tests/unit/test_link_quality.cpp +++ b/tests/unit/test_link_quality.cpp @@ -339,30 +339,30 @@ void TestLinkQualityCalculations(void) { const int8_t rssList1[] = {-81, -80, -79, -78, -76, -80, -77, -75, -77, -76, -77, -74}; const RssTestData rssData1 = { - rssList1, // mRssList - sizeof(rssList1), // mRssListSize - 3 // mExpectedLinkQuality + rssList1, // mRssList + sizeof(rssList1), // mRssListSize + 3 // mExpectedLinkQuality }; const int8_t rssList2[] = {-90, -80, -85}; const RssTestData rssData2 = { - rssList2, // mRssList - sizeof(rssList2), // mRssListSize - 2 // mExpectedLinkQuality + rssList2, // mRssList + sizeof(rssList2), // mRssListSize + 2 // mExpectedLinkQuality }; const int8_t rssList3[] = {-95, -96, -98, -99, -100, -100, -98, -99, -100, -100, -100, -100, -100}; const RssTestData rssData3 = { - rssList3, // mRssList - sizeof(rssList3), // mRssListSize - 0 // mExpectedLinkQuality + rssList3, // mRssList + sizeof(rssList3), // mRssListSize + 0 // mExpectedLinkQuality }; const int8_t rssList4[] = {-75, -100, -100, -100, -100, -100, -95, -92, -93, -94, -93, -93}; const RssTestData rssData4 = { - rssList4, // mRssList - sizeof(rssList4), // mRssListSize - 1 // mExpectedLinkQuality + rssList4, // mRssList + sizeof(rssList4), // mRssListSize + 1 // mExpectedLinkQuality }; TestLinkQualityData(rssData1); diff --git a/tests/unit/test_linked_list.cpp b/tests/unit/test_linked_list.cpp index f84f63dce..40a4f7f05 100644 --- a/tests/unit/test_linked_list.cpp +++ b/tests/unit/test_linked_list.cpp @@ -88,8 +88,8 @@ constexpr Entry::Type kBetaType = Entry::Type::kBeta; void VerifyLinkedListContent(const LinkedList *aList, ...) { va_list args; - Entry * argEntry; - Entry * argPrev = nullptr; + Entry *argEntry; + Entry *argPrev = nullptr; const Entry *prev; uint16_t unusedId = 100; @@ -134,7 +134,7 @@ void TestLinkedList(void) { Entry a("a", 1, kAlphaType), b("b", 2, kAlphaType), c("c", 3, kBetaType); Entry d("d", 4, kBetaType), e("e", 5, kAlphaType), f("f", 6, kBetaType); - Entry * prev; + Entry *prev; LinkedList list; LinkedList removedList; diff --git a/tests/unit/test_lowpan.cpp b/tests/unit/test_lowpan.cpp index ee4d2ffeb..c28f8fda8 100644 --- a/tests/unit/test_lowpan.cpp +++ b/tests/unit/test_lowpan.cpp @@ -35,8 +35,8 @@ using namespace ot; namespace ot { -ot::Instance * sInstance; -Ip6::Ip6 * sIp6; +ot::Instance *sInstance; +Ip6::Ip6 *sIp6; Lowpan::Lowpan *sLowpan; void TestIphcVector::GetCompressedStream(uint8_t *aIphc, uint16_t &aIphcLength) @@ -146,7 +146,7 @@ static void Init(void) */ static void Test(TestIphcVector &aVector, bool aCompress, bool aDecompress) { - Message * message = nullptr; + Message *message = nullptr; uint8_t result[512]; uint8_t iphc[512]; uint8_t ip6[512]; @@ -173,7 +173,7 @@ static void Test(TestIphcVector &aVector, bool aCompress, bool aDecompress) if (aCompress) { FrameBuilder frameBuilder; - Message * compressedMsg; + Message *compressedMsg; Ip6::Ecn ecn; frameBuilder.Init(result, 127); diff --git a/tests/unit/test_mac_frame.cpp b/tests/unit/test_mac_frame.cpp index 5aac167cc..846c6373e 100644 --- a/tests/unit/test_mac_frame.cpp +++ b/tests/unit/test_mac_frame.cpp @@ -58,7 +58,7 @@ void TestMacAddress(void) const uint8_t kExtAddr[OT_EXT_ADDRESS_SIZE] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; const Mac::ShortAddress kShortAddr = 0x1234; - ot::Instance * instance; + ot::Instance *instance; Mac::Address addr; Mac::ExtAddress extAddr; uint8_t buffer[OT_EXT_ADDRESS_SIZE]; @@ -358,7 +358,7 @@ void TestMacFrameApi(void) #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) uint8_t data_psdu1[] = {0x29, 0xee, 0x53, 0xce, 0xfa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x05, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x01}; + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x01}; uint8_t mac_cmd_psdu2[] = {0x6b, 0xaa, 0x8d, 0xce, 0xfa, 0x00, 0x68, 0x01, 0x68, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x01, 0x04, 0x0d, 0xed, 0x0b, 0x35, 0x0c, 0x80, 0x3f, 0x04, 0x4b, 0x88, 0x89, 0xd6, 0x59, 0xe1}; @@ -477,12 +477,12 @@ void TestMacFrameAckGeneration(void) // Destination: 16:6e:0a:00:00:00:00:01 (16:6e:0a:00:00:00:00:01) // Extended Source: 16:6e:0a:00:00:00:00:02 (16:6e:0a:00:00:00:00:02) uint8_t data_psdu1[] = {0x61, 0xdc, 0xbd, 0xce, 0xfa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x7f, 0x33, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, - 0x8b, 0xf0, 0x00, 0x15, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc2, - 0x57, 0x9c, 0x31, 0xb3, 0x2a, 0xa1, 0x86, 0xba, 0x9a, 0xed, 0x5a, 0xb9, 0xa3, 0x59, - 0x88, 0xeb, 0xbb, 0x0d, 0xc3, 0xed, 0xeb, 0x8a, 0x53, 0xa6, 0xed, 0xf7, 0xdd, 0x45, - 0x6e, 0xf7, 0x9a, 0x17, 0xb4, 0xab, 0xc6, 0x75, 0x71, 0x46, 0x37, 0x93, 0x4a, 0x32, - 0xb1, 0x21, 0x9f, 0x9d, 0xb3, 0x65, 0x27, 0xd5, 0xfc, 0x50, 0x16, 0x90, 0xd2, 0xd4}; + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6e, 0x16, 0x7f, 0x33, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, + 0x8b, 0xf0, 0x00, 0x15, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc2, + 0x57, 0x9c, 0x31, 0xb3, 0x2a, 0xa1, 0x86, 0xba, 0x9a, 0xed, 0x5a, 0xb9, 0xa3, 0x59, + 0x88, 0xeb, 0xbb, 0x0d, 0xc3, 0xed, 0xeb, 0x8a, 0x53, 0xa6, 0xed, 0xf7, 0xdd, 0x45, + 0x6e, 0xf7, 0x9a, 0x17, 0xb4, 0xab, 0xc6, 0x75, 0x71, 0x46, 0x37, 0x93, 0x4a, 0x32, + 0xb1, 0x21, 0x9f, 0x9d, 0xb3, 0x65, 0x27, 0xd5, 0xfc, 0x50, 0x16, 0x90, 0xd2, 0xd4}; receivedFrame.mPsdu = data_psdu1; receivedFrame.mLength = sizeof(data_psdu1); @@ -537,8 +537,8 @@ void TestMacFrameAckGeneration(void) // [Key Number: 0] // FCS: 0x8c40 (Correct) uint8_t data_psdu2[] = {0x69, 0xa8, 0x8e, 0xce, 0xfa, 0x02, 0x24, 0x00, 0x24, 0x0d, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x6b, 0x64, 0x60, 0x08, 0x55, 0xb8, 0x10, - 0x18, 0xc7, 0x40, 0x2e, 0xfb, 0xf3, 0xda, 0xf9, 0x4e, 0x58, 0x70}; + 0x00, 0x00, 0x00, 0x01, 0x6b, 0x64, 0x60, 0x08, 0x55, 0xb8, 0x10, + 0x18, 0xc7, 0x40, 0x2e, 0xfb, 0xf3, 0xda, 0xf9, 0x4e, 0x58, 0x70}; receivedFrame.mPsdu = data_psdu2; receivedFrame.mLength = sizeof(data_psdu2); diff --git a/tests/unit/test_message.cpp b/tests/unit/test_message.cpp index fe2ce3f13..425a55b8d 100644 --- a/tests/unit/test_message.cpp +++ b/tests/unit/test_message.cpp @@ -46,10 +46,10 @@ void TestMessage(void) kLengthStep = 21, }; - Instance * instance; + Instance *instance; MessagePool *messagePool; - Message * message; - Message * message2; + Message *message; + Message *message2; uint8_t writeBuffer[kMaxSize]; uint8_t readBuffer[kMaxSize]; uint8_t zeroBuffer[kMaxSize]; @@ -246,8 +246,8 @@ void TestAppender(void) static constexpr uint16_t kMaxBufferSize = sizeof(kData1) * 2 + sizeof(kData2); - Instance * instance; - Message * message; + Instance *instance; + Message *message; uint8_t buffer[kMaxBufferSize]; uint8_t zeroBuffer[kMaxBufferSize]; Appender bufAppender(buffer, sizeof(buffer)); diff --git a/tests/unit/test_message_queue.cpp b/tests/unit/test_message_queue.cpp index b8cedc6bf..9eb3c7721 100644 --- a/tests/unit/test_message_queue.cpp +++ b/tests/unit/test_message_queue.cpp @@ -40,7 +40,7 @@ #define kNumTestMessages 5 -static ot::Instance * sInstance; +static ot::Instance *sInstance; static ot::MessagePool *sMessagePool; // This function verifies the content of the message queue to match the passed in messages @@ -48,8 +48,8 @@ void VerifyMessageQueueContent(ot::MessageQueue &aMessageQueue, int aExpectedLen { const ot::MessageQueue &constQueue = aMessageQueue; va_list args; - ot::Message * message; - ot::Message * msgArg; + ot::Message *message; + ot::Message *msgArg; va_start(args, aExpectedLength); @@ -103,7 +103,7 @@ void VerifyMessageQueueContent(ot::MessageQueue &aMessageQueue, int aExpectedLen void TestMessageQueue(void) { ot::MessageQueue messageQueue; - ot::Message * messages[kNumTestMessages]; + ot::Message *messages[kNumTestMessages]; ot::MessageQueue::Info info; sInstance = testInitInstance(); @@ -280,8 +280,8 @@ void VerifyMessageQueueContentUsingOtApi(otMessageQueue *aQueue, int aExpectedLe // This test checks all the OpenThread C APIs for `otMessageQueue` void TestMessageQueueOtApis(void) { - otMessage * messages[kNumTestMessages]; - otMessage * message; + otMessage *messages[kNumTestMessages]; + otMessage *message; otMessageQueue queue, queue2; sInstance = testInitInstance(); diff --git a/tests/unit/test_nat64.cpp b/tests/unit/test_nat64.cpp index c060b3770..66e5fbeb1 100644 --- a/tests/unit/test_nat64.cpp +++ b/tests/unit/test_nat64.cpp @@ -91,7 +91,7 @@ template void TestCase6To4(const char *aTestName, const uint8_t (&aIp6Message)[N], Nat64::Translator::Result aResult, - const uint8_t * aOutMessage, + const uint8_t *aOutMessage, size_t aOutMessageLen) { Message *msg = sInstance->Get().NewMessage(0); @@ -118,7 +118,7 @@ template void TestCase4To6(const char *aTestName, const uint8_t (&aIp4Message)[N], Nat64::Translator::Result aResult, - const uint8_t * aOutMessage, + const uint8_t *aOutMessage, size_t aOutMessageLen) { Message *msg = sInstance->Get().NewMessage(0); diff --git a/tests/unit/test_netif.cpp b/tests/unit/test_netif.cpp index d82b05197..1a5c0e120 100644 --- a/tests/unit/test_netif.cpp +++ b/tests/unit/test_netif.cpp @@ -89,7 +89,7 @@ void TestNetifMulticastAddresses(void) { const uint8_t kMaxAddresses = 8; - Instance * instance = testInitInstance(); + Instance *instance = testInitInstance(); TestNetif netif(*instance); Ip6::Address addresses[kMaxAddresses]; diff --git a/tests/unit/test_network_data.cpp b/tests/unit/test_network_data.cpp index a41238da0..51c0b67c4 100644 --- a/tests/unit/test_network_data.cpp +++ b/tests/unit/test_network_data.cpp @@ -106,7 +106,7 @@ void TestNetworkDataIterator(void) { static constexpr uint8_t kMaxRlocsArray = 10; - ot::Instance * instance; + ot::Instance *instance; Iterator iter = kIteratorInit; ExternalRouteConfig rconfig; OnMeshPrefixConfig pconfig; @@ -639,7 +639,7 @@ void TestNetworkDataDsnSrpServices(void) struct UnicastEntry { - const char * mAddress; + const char *mAddress; uint16_t mPort; Service::DnsSrpUnicast::Origin mOrigin; uint16_t mRloc16; @@ -681,7 +681,7 @@ void TestNetworkDataDsnSrpServices(void) const uint8_t kPreferredAnycastEntryIndex = 2; - Service::Manager & manager = instance->Get(); + Service::Manager &manager = instance->Get(); Service::Manager::Iterator iterator; Service::DnsSrpAnycast::Info anycastInfo; Service::DnsSrpUnicast::Info unicastInfo; diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 6c7392dde..8fb5df58f 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -250,7 +250,7 @@ OT_TOOL_WEAK otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) #if __SANITIZE_ADDRESS__ == 0 { - FILE * file = nullptr; + FILE *file = nullptr; size_t readLength; file = fopen("/dev/urandom", "rb"); @@ -512,12 +512,12 @@ OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t) #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE -otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef, +otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, otCryptoKeyStorage aKeyPersistence, - const uint8_t * aKey, + const uint8_t *aKey, size_t aKeyLen) { OT_UNUSED_VARIABLE(aKeyRef); diff --git a/tests/unit/test_priority_queue.cpp b/tests/unit/test_priority_queue.cpp index 51f6b720b..6348f55c5 100644 --- a/tests/unit/test_priority_queue.cpp +++ b/tests/unit/test_priority_queue.cpp @@ -44,8 +44,8 @@ void VerifyPriorityQueueContent(ot::PriorityQueue &aPriorityQueue, int aExpected { const ot::PriorityQueue &constQueue = aPriorityQueue; va_list args; - ot::Message * message; - ot::Message * msgArg; + ot::Message *message; + ot::Message *msgArg; int8_t curPriority = ot::Message::kNumPriorities; ot::PriorityQueue::Info info; @@ -168,14 +168,14 @@ void VerifyMsgQueueContent(ot::MessageQueue &aMessageQueue, int aExpectedLength, void TestPriorityQueue(void) { - ot::Instance * instance; - ot::MessagePool * messagePool; + ot::Instance *instance; + ot::MessagePool *messagePool; ot::PriorityQueue queue; ot::MessageQueue messageQueue; - ot::Message * msgNet[kNumTestMessages]; - ot::Message * msgHigh[kNumTestMessages]; - ot::Message * msgNor[kNumTestMessages]; - ot::Message * msgLow[kNumTestMessages]; + ot::Message *msgNet[kNumTestMessages]; + ot::Message *msgHigh[kNumTestMessages]; + ot::Message *msgNor[kNumTestMessages]; + ot::Message *msgLow[kNumTestMessages]; instance = testInitInstance(); VerifyOrQuit(instance != nullptr, "Null OpenThread instance"); diff --git a/tests/unit/test_pskc.cpp b/tests/unit/test_pskc.cpp index 3eedad98f..0ae4e973e 100644 --- a/tests/unit/test_pskc.cpp +++ b/tests/unit/test_pskc.cpp @@ -39,10 +39,10 @@ void TestMinimumPassphrase(void) { ot::Pskc pskc; const uint8_t expectedPskc[] = {0x44, 0x98, 0x8e, 0x22, 0xcf, 0x65, 0x2e, 0xee, - 0xcc, 0xd1, 0xe4, 0xc0, 0x1d, 0x01, 0x54, 0xf8}; + 0xcc, 0xd1, 0xe4, 0xc0, 0x1d, 0x01, 0x54, 0xf8}; const otExtendedPanId xpanid = {{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}}; const char passphrase[] = "123456"; - otInstance * instance = testInitInstance(); + otInstance *instance = testInitInstance(); SuccessOrQuit(ot::MeshCoP::GeneratePskc(passphrase, *reinterpret_cast("OpenThread"), static_cast(xpanid), pskc)); @@ -54,24 +54,24 @@ void TestMaximumPassphrase(void) { ot::Pskc pskc; const uint8_t expectedPskc[] = {0x9e, 0x81, 0xbd, 0x35, 0xa2, 0x53, 0x76, 0x2f, - 0x80, 0xee, 0x04, 0xff, 0x2f, 0xa2, 0x85, 0xe9}; + 0x80, 0xee, 0x04, 0xff, 0x2f, 0xa2, 0x85, 0xe9}; const otExtendedPanId xpanid = {{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}}; const char passphrase[] = "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "1234567812345678" - "123456781234567"; + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "1234567812345678" + "123456781234567"; otInstance *instance = testInitInstance(); SuccessOrQuit(ot::MeshCoP::GeneratePskc(passphrase, @@ -85,7 +85,7 @@ void TestExampleInSpec(void) { ot::Pskc pskc; const uint8_t expectedPskc[] = {0xc3, 0xf5, 0x93, 0x68, 0x44, 0x5a, 0x1b, 0x61, - 0x06, 0xbe, 0x42, 0x0a, 0x70, 0x6d, 0x4c, 0xc9}; + 0x06, 0xbe, 0x42, 0x0a, 0x70, 0x6d, 0x4c, 0xc9}; const otExtendedPanId xpanid = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}}; const char passphrase[] = "12SECRETPASSWORD34"; diff --git a/tests/unit/test_routing_manager.cpp b/tests/unit/test_routing_manager.cpp index 76672fc2b..9bdb55f8b 100644 --- a/tests/unit/test_routing_manager.cpp +++ b/tests/unit/test_routing_manager.cpp @@ -223,7 +223,7 @@ bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddres otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, const otIp6Address *aDestAddress, - const uint8_t * aBuffer, + const uint8_t *aBuffer, uint16_t aBufferLength) { Icmp6Packet packet; @@ -656,9 +656,9 @@ struct DefaultRoute }; void SendRouterAdvert(const Ip6::Address &aRouterAddress, - const Pio * aPios, + const Pio *aPios, uint16_t aNumPios, - const Rio * aRios, + const Rio *aRios, uint16_t aNumRios, const DefaultRoute &aDefaultRoute) { @@ -720,7 +720,7 @@ void SendRouterAdvert(const Ip6::Address &aRouterAddress, const DefaultRoute &aD struct OnLinkPrefix : public Pio { - OnLinkPrefix(const Ip6::Prefix & aPrefix, + OnLinkPrefix(const Ip6::Prefix &aPrefix, uint32_t aValidLifetime, uint32_t aPreferredLifetime, const Ip6::Address &aRouterAddress) @@ -734,7 +734,7 @@ struct OnLinkPrefix : public Pio struct RoutePrefix : public Rio { - RoutePrefix(const Ip6::Prefix & aPrefix, + RoutePrefix(const Ip6::Prefix &aPrefix, uint32_t aValidLifetime, RoutePreference aPreference, const Ip6::Address &aRouterAddress) @@ -760,7 +760,7 @@ template void VerifyPrefixTable(const OnLinkPrefix void VerifyPrefixTable(const OnLinkPrefix *aOnLinkPrefixes, uint16_t aNumOnLinkPrefixes, - const RoutePrefix * aRoutePrefixes, + const RoutePrefix *aRoutePrefixes, uint16_t aNumRoutePrefixes) { BorderRouter::RoutingManager::PrefixTableIterator iter; diff --git a/tests/unit/test_smart_ptrs.cpp b/tests/unit/test_smart_ptrs.cpp index 273dc9d26..70ec98ca4 100644 --- a/tests/unit/test_smart_ptrs.cpp +++ b/tests/unit/test_smart_ptrs.cpp @@ -60,7 +60,7 @@ static constexpr uint16_t kSkipRetainCountCheck = 0xffff; template void VerifyPointer(const PointerType &aPointer, - const TestObject * aObject, + const TestObject *aObject, uint16_t aRetainCount = kSkipRetainCountCheck) { if (aObject == nullptr) diff --git a/tests/unit/test_spinel_buffer.cpp b/tests/unit/test_spinel_buffer.cpp index 4df9764c6..0fbdb07a4 100644 --- a/tests/unit/test_spinel_buffer.cpp +++ b/tests/unit/test_spinel_buffer.cpp @@ -58,7 +58,7 @@ static const uint8_t sMysteryText[] = "4871(\\):|(3$}{4|/4/2%14(\\)"; static const uint8_t sHexText[] = "0123456789abcdef"; static ot::Instance *sInstance; -static MessagePool * sMessagePool; +static MessagePool *sMessagePool; struct CallbackContext { @@ -126,10 +126,10 @@ void VerifyAndRemoveTagFromHistory(Spinel::Buffer::FrameTag aTag, Spinel::Buffer } } -void FrameAddedCallback(void * aContext, +void FrameAddedCallback(void *aContext, Spinel::Buffer::FrameTag aTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aNcpBuffer) + Spinel::Buffer *aNcpBuffer) { CallbackContext *callbackContext = reinterpret_cast(aContext); @@ -143,10 +143,10 @@ void FrameAddedCallback(void * aContext, callbackContext->mFrameAddedCount++; } -void FrameRemovedCallback(void * aContext, +void FrameRemovedCallback(void *aContext, Spinel::Buffer::FrameTag aTag, Spinel::Buffer::Priority aPriority, - Spinel::Buffer * aNcpBuffer) + Spinel::Buffer *aNcpBuffer) { CallbackContext *callbackContext = reinterpret_cast(aContext); @@ -173,7 +173,7 @@ void ReadAndVerifyContent(Spinel::Buffer &aNcpBuffer, const uint8_t *aContentBuf void WriteTestFrame1(Spinel::Buffer &aNcpBuffer, Spinel::Buffer::Priority aPriority) { - Message * message; + Message *message; CallbackContext oldContext; message = sMessagePool->Allocate(Message::kTypeIp6); @@ -216,8 +216,8 @@ void VerifyAndRemoveFrame1(Spinel::Buffer &aNcpBuffer) void WriteTestFrame2(Spinel::Buffer &aNcpBuffer, Spinel::Buffer::Priority aPriority) { - Message * message1; - Message * message2; + Message *message1; + Message *message2; CallbackContext oldContext = sContext; message1 = sMessagePool->Allocate(Message::kTypeIp6); @@ -262,7 +262,7 @@ void VerifyAndRemoveFrame2(Spinel::Buffer &aNcpBuffer) void WriteTestFrame3(Spinel::Buffer &aNcpBuffer, Spinel::Buffer::Priority aPriority) { - Message * message1; + Message *message1; CallbackContext oldContext = sContext; message1 = sMessagePool->Allocate(Message::kTypeIp6); @@ -335,7 +335,7 @@ void TestBuffer(void) uint8_t buffer[kTestBufferSize]; Spinel::Buffer ncpBuffer(buffer, kTestBufferSize); - Message * message; + Message *message; uint8_t readBuffer[16]; uint16_t readLen, readOffset; Spinel::Buffer::WritePosition pos1, pos2; diff --git a/tests/unit/test_spinel_decoder.cpp b/tests/unit/test_spinel_decoder.cpp index 13bd82c43..1a2249ab7 100644 --- a/tests/unit/test_spinel_decoder.cpp +++ b/tests/unit/test_spinel_decoder.cpp @@ -90,12 +90,12 @@ void TestDecoder(void) int64_t i64; unsigned int u_1, u_2, u_3, u_4; const spinel_ipv6addr_t *ip6Addr; - const spinel_eui48_t * eui48; - const spinel_eui64_t * eui64; - const char * utf_1; - const char * utf_2; - const uint8_t * dataPtr_1; - const uint8_t * dataPtr_2; + const spinel_eui48_t *eui48; + const spinel_eui64_t *eui64; + const char *utf_1; + const char *utf_2; + const uint8_t *dataPtr_1; + const uint8_t *dataPtr_2; uint16_t dataLen_1; uint16_t dataLen_2; diff --git a/tests/unit/test_spinel_encoder.cpp b/tests/unit/test_spinel_encoder.cpp index b640af379..e15157c90 100644 --- a/tests/unit/test_spinel_encoder.cpp +++ b/tests/unit/test_spinel_encoder.cpp @@ -105,11 +105,11 @@ void TestEncoder(void) int64_t i64; unsigned int u_1, u_2, u_3, u_4; spinel_ipv6addr_t *ip6Addr; - spinel_eui48_t * eui48; - spinel_eui64_t * eui64; - const char * utf_1; - const char * utf_2; - const uint8_t * dataPtr; + spinel_eui48_t *eui48; + spinel_eui64_t *eui64; + const char *utf_1; + const char *utf_2; + const uint8_t *dataPtr; spinel_size_t dataLen; memset(buffer, 0, sizeof(buffer)); diff --git a/tests/unit/test_srp_server.cpp b/tests/unit/test_srp_server.cpp index a72b00a3e..cde868623 100644 --- a/tests/unit/test_srp_server.cpp +++ b/tests/unit/test_srp_server.cpp @@ -230,9 +230,9 @@ static UpdateHandlerMode sUpdateHandlerMode = kAccept; static bool sProcessedUpdateCallback = false; void HandleSrpServerUpdate(otSrpServerServiceUpdateId aId, - const otSrpServerHost * aHost, + const otSrpServerHost *aHost, uint32_t aTimeout, - void * aContext) + void *aContext) { Log("HandleSrpServerUpdate() called with %u, timeout:%u", aId, aTimeout); @@ -259,9 +259,9 @@ static Error sLastClientCallbackError = kErrorNone; void HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, - const otSrpClientService * aServices, - const otSrpClientService * aRemovedServices, - void * aContext) + const otSrpClientService *aServices, + const otSrpClientService *aRemovedServices, + void *aContext) { Log("HandleSrpClientCallback() called with error %s", ErrorToString(aError)); @@ -284,7 +284,7 @@ void PrepareService1(Srp::Client::Service &aService) static const char kSub1[] = "_sub1"; static const char kSub2[] = "_V1234567"; static const char kSub3[] = "_XYZWS"; - static const char * kSubLabels[] = {kSub1, kSub2, kSub3, nullptr}; + static const char *kSubLabels[] = {kSub1, kSub2, kSub3, nullptr}; static const char kTxtKey1[] = "ABCD"; static const uint8_t kTxtValue1[] = {'a', '0'}; static const char kTxtKey2[] = "Z0"; @@ -292,9 +292,9 @@ void PrepareService1(Srp::Client::Service &aService) static const char kTxtKey3[] = "D"; static const uint8_t kTxtValue3[] = {0}; static const otDnsTxtEntry kTxtEntries[] = { - {kTxtKey1, kTxtValue1, sizeof(kTxtValue1)}, - {kTxtKey2, kTxtValue2, sizeof(kTxtValue2)}, - {kTxtKey3, kTxtValue3, sizeof(kTxtValue3)}, + {kTxtKey1, kTxtValue1, sizeof(kTxtValue1)}, + {kTxtKey2, kTxtValue2, sizeof(kTxtValue2)}, + {kTxtKey3, kTxtValue3, sizeof(kTxtValue3)}, }; aService.mName = kServiceName; @@ -330,7 +330,7 @@ void ValidateHost(Srp::Server &aServer, const char *aHostName) // registered on SRP server. const Srp::Server::Host *host; - const char * name; + const char *name; Log("ValidateHost()"); @@ -351,8 +351,8 @@ void ValidateHost(Srp::Server &aServer, const char *aHostName) void TestSrpServerBase(void) { - Srp::Server * srpServer; - Srp::Client * srpClient; + Srp::Server *srpServer; + Srp::Client *srpClient; Srp::Client::Service service1; Srp::Client::Service service2; uint16_t heapAllocations; @@ -476,8 +476,8 @@ void TestSrpServerBase(void) void TestSrpServerReject(void) { - Srp::Server * srpServer; - Srp::Client * srpClient; + Srp::Server *srpServer; + Srp::Client *srpClient; Srp::Client::Service service1; Srp::Client::Service service2; uint16_t heapAllocations; @@ -588,8 +588,8 @@ void TestSrpServerReject(void) void TestSrpServerIgnore(void) { - Srp::Server * srpServer; - Srp::Client * srpClient; + Srp::Server *srpServer; + Srp::Client *srpClient; Srp::Client::Service service1; Srp::Client::Service service2; uint16_t heapAllocations; diff --git a/tests/unit/test_timer.cpp b/tests/unit/test_timer.cpp index 00cc02ed8..8ec612f98 100644 --- a/tests/unit/test_timer.cpp +++ b/tests/unit/test_timer.cpp @@ -150,7 +150,7 @@ template int TestOneTimer(void) { const uint32_t kTimeT0 = 1000; const uint32_t kTimerInterval = 10; - ot::Instance * instance = testInitInstance(); + ot::Instance *instance = testInitInstance(); TestTimer timer(*instance); // Test one Timer basic operation. @@ -276,7 +276,7 @@ template int TestTwoTimers(void) { const uint32_t kTimeT0 = 1000; const uint32_t kTimerInterval = 10; - ot::Instance * instance = testInitInstance(); + ot::Instance *instance = testInitInstance(); TestTimer timer1(*instance); TestTimer timer2(*instance); diff --git a/tests/unit/test_tlv.cpp b/tests/unit/test_tlv.cpp index c39cfdebc..1af0121be 100644 --- a/tests/unit/test_tlv.cpp +++ b/tests/unit/test_tlv.cpp @@ -40,8 +40,8 @@ namespace ot { void TestTlv(void) { - Instance * instance = testInitInstance(); - Message * message; + Instance *instance = testInitInstance(); + Message *message; Tlv tlv; ExtendedTlv extTlv; uint16_t offset; diff --git a/tools/spi-hdlc-adapter/spi-hdlc-adapter.c b/tools/spi-hdlc-adapter/spi-hdlc-adapter.c index 76650fcab..1e8001c74 100644 --- a/tools/spi-hdlc-adapter/spi-hdlc-adapter.c +++ b/tools/spi-hdlc-adapter/spi-hdlc-adapter.c @@ -314,9 +314,9 @@ static void signal_critical(int sig, siginfo_t *info, void *ucontext) // This is the last hurah for this process. // We dump the stack, because that's all we can do. - void * stack_mem[AUTO_PRINT_BACKTRACE_STACK_DEPTH]; - void ** stack = stack_mem; - char ** stack_symbols; + void *stack_mem[AUTO_PRINT_BACKTRACE_STACK_DEPTH]; + void **stack = stack_mem; + char **stack_symbols; int stack_depth, i; ucontext_t *uc = (ucontext_t *)ucontext; @@ -813,7 +813,7 @@ static bool hdlc_byte_needs_escape(uint8_t byte) static int push_hdlc(void) { int ret = 0; - const uint8_t * spiRxFrameBuffer = get_real_rx_frame_start(); + const uint8_t *spiRxFrameBuffer = get_real_rx_frame_start(); static uint8_t escaped_frame_buffer[MAX_FRAME_SIZE * 2]; static uint16_t unescaped_frame_len; static uint16_t escaped_frame_len; @@ -1019,7 +1019,7 @@ static int pull_hdlc(void) static int push_raw(void) { int ret = 0; - const uint8_t * spiRxFrameBuffer = get_real_rx_frame_start(); + const uint8_t *spiRxFrameBuffer = get_real_rx_frame_start(); static uint8_t raw_frame_buffer[MAX_FRAME_SIZE]; static uint16_t raw_frame_len; static uint16_t raw_frame_sent; @@ -1291,9 +1291,9 @@ static void trigger_reset(void) static bool setup_int_gpio(const char *path) { - char * edge_path = NULL; - char * dir_path = NULL; - char * value_path = NULL; + char *edge_path = NULL; + char *dir_path = NULL; + char *value_path = NULL; ssize_t len; int setup_fd = -1;