Skip to content

Commit

Permalink
Fix MISRA violations Rule 1.1 for forward declaration (FreeRTOS#1004)
Browse files Browse the repository at this point in the history
* Fix MISRA things for forward declaration

* Formatting

* Fix return structure of prvAllowIPPacketIPv4 and comments.
  • Loading branch information
ActoryOu authored Aug 10, 2023
1 parent 4c6c8ab commit f5ecc5f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ TaskHandle_t FreeRTOS_GetIPTaskHandle( void )
*
* @param pxEndPoint The end-point which goes up.
*/
void vIPNetworkUpCalls( NetworkEndPoint_t * pxEndPoint )
void vIPNetworkUpCalls( struct xNetworkEndPoint * pxEndPoint )
{
pxEndPoint->bits.bEndPointUp = pdTRUE_UNSIGNED;

Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_IP_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ BaseType_t xIsCallingFromIPTask( void )
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-89 */
/* coverity[misra_c_2012_rule_8_9_violation] */
/* coverity[single_use] */
void prvProcessNetworkDownEvent( NetworkInterface_t * pxInterface )
void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
{
NetworkEndPoint_t * pxEndPoint;

Expand Down
8 changes: 4 additions & 4 deletions source/FreeRTOS_IPv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ BaseType_t xIsIPv4Multicast( uint32_t ulIPAddress )
*
* @return Whether the packet should be processed or dropped.
*/
eFrameProcessingResult_t prvAllowIPPacketIPv4( const IPPacket_t * const pxIPPacket,
const NetworkBufferDescriptor_t * const pxNetworkBuffer,
UBaseType_t uxHeaderLength )
enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * const pxIPPacket,
const struct xNETWORK_BUFFER * const pxNetworkBuffer,
UBaseType_t uxHeaderLength )
{
eFrameProcessingResult_t eReturn = eProcessBuffer;

Expand Down Expand Up @@ -417,7 +417,7 @@ eFrameProcessingResult_t prvAllowIPPacketIPv4( const IPPacket_t * const pxIPPack
*
* @return Either 'eProcessBuffer' or 'eReleaseBuffer'
*/
eFrameProcessingResult_t prvCheckIP4HeaderOptions( NetworkBufferDescriptor_t * const pxNetworkBuffer )
enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * const pxNetworkBuffer )
{
eFrameProcessingResult_t eReturn = eProcessBuffer;

Expand Down
6 changes: 3 additions & 3 deletions source/include/FreeRTOS_IP_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#define ipFOREVER() 1
#endif

/* Forward declaration of 'NetworkEndPoint_t'. */
typedef struct xNetworkEndPoint NetworkEndPoint_t;
/* Forward declaration. */
struct xNetworkEndPoint;

typedef enum eFrameProcessingResult
{
Expand Down Expand Up @@ -889,7 +889,7 @@ BaseType_t xIsCallingFromIPTask( void );
#endif /* ipconfigSUPPORT_SELECT_FUNCTION */

/* Send the network-up event and start the ARP timer. */
void vIPNetworkUpCalls( NetworkEndPoint_t * pxEndPoint );
void vIPNetworkUpCalls( struct xNetworkEndPoint * pxEndPoint );

/* *INDENT-OFF* */
#ifdef __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions source/include/FreeRTOS_IP_Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
#endif
/* *INDENT-ON* */

/* Forward declaration of 'NetworkInterface_t'. */
typedef struct xNetworkInterface NetworkInterface_t;
/* Forward declaration. */
struct xNetworkInterface;

#if ( ipconfigUSE_DHCP != 0 )

Expand Down Expand Up @@ -101,7 +101,7 @@ void vPreCheckConfigs( void );
* @brief Called to create a network connection when the stack is first
* started, or when the network connection is lost.
*/
void prvProcessNetworkDownEvent( NetworkInterface_t * pxInterface );
void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface );

/* *INDENT-OFF* */
#ifdef __cplusplus
Expand Down
14 changes: 7 additions & 7 deletions source/include/FreeRTOS_IPv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
/* *INDENT-ON* */

/* Forward declarations. */
typedef struct xNETWORK_BUFFER NetworkBufferDescriptor_t;
typedef enum eFrameProcessingResult eFrameProcessingResult_t;
typedef struct xIP_PACKET IPPacket_t;
struct xNETWORK_BUFFER;
enum eFrameProcessingResult;
struct xIP_PACKET;

#define ipSIZE_OF_IPv4_HEADER 20U
#define ipSIZE_OF_IPv4_ADDRESS 4U
Expand Down Expand Up @@ -89,12 +89,12 @@ uint32_t FreeRTOS_GetIPAddress( void );
BaseType_t xIsIPv4Multicast( uint32_t ulIPAddress );

/* The function 'prvAllowIPPacket()' checks if a packets should be processed. */
eFrameProcessingResult_t prvAllowIPPacketIPv4( const IPPacket_t * const pxIPPacket,
const NetworkBufferDescriptor_t * const pxNetworkBuffer,
UBaseType_t uxHeaderLength );
enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * const pxIPPacket,
const struct xNETWORK_BUFFER * const pxNetworkBuffer,
UBaseType_t uxHeaderLength );

/* Check if the IP-header is carrying options. */
eFrameProcessingResult_t prvCheckIP4HeaderOptions( NetworkBufferDescriptor_t * const pxNetworkBuffer );
enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * const pxNetworkBuffer );


/* *INDENT-OFF* */
Expand Down

0 comments on commit f5ecc5f

Please sign in to comment.