Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give header files a uniform indentation #1034

Merged
merged 20 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 40 additions & 36 deletions source/include/FreeRTOS_BitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,50 +33,54 @@
*/

#ifndef FREERTOS_BITCONFIG_H
#define FREERTOS_BITCONFIG_H
#define FREERTOS_BITCONFIG_H

#ifdef __cplusplus
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#endif
/* *INDENT-ON* */

/**< @brief The struct BitConfig_t holds a character array, its length and an index. */
typedef struct xBitConfig
{
uint8_t * ucContents; /**< An allocated buffer to hold the binary data stream. */
size_t uxIndex; /**< Points to the next character to analyse or write. */
size_t uxSize; /**< The size of the allocated buffer 'uxContents'. */
BaseType_t xHasError; /**< It will be set to pdTRUE in case an error occurred, usually because the buffer is too small. */
} BitConfig_t;
typedef struct xBitConfig
{
uint8_t * ucContents; /**< An allocated buffer to hold the binary data stream. */
size_t uxIndex; /**< Points to the next character to analyse or write. */
size_t uxSize; /**< The size of the allocated buffer 'uxContents'. */
BaseType_t xHasError; /**< It will be set to pdTRUE in case an error occurred, usually because the buffer is too small. */
} BitConfig_t;

BaseType_t xBitConfig_init( BitConfig_t * pxConfig,
const uint8_t * pucData,
size_t uxSize );
BaseType_t xBitConfig_init( BitConfig_t * pxConfig,
const uint8_t * pucData,
size_t uxSize );

uint8_t ucBitConfig_read_8( BitConfig_t * pxConfig );
uint16_t usBitConfig_read_16( BitConfig_t * pxConfig );
uint32_t ulBitConfig_read_32( BitConfig_t * pxConfig );
BaseType_t xBitConfig_read_uc( BitConfig_t * pxConfig,
uint8_t * pucData,
size_t uxSize );
BaseType_t pucBitConfig_peek_last_index_uc( BitConfig_t * pxConfig,
uint8_t * pucData,
size_t uxSize );
uint8_t ucBitConfig_read_8( BitConfig_t * pxConfig );
uint16_t usBitConfig_read_16( BitConfig_t * pxConfig );
uint32_t ulBitConfig_read_32( BitConfig_t * pxConfig );
BaseType_t xBitConfig_read_uc( BitConfig_t * pxConfig,
uint8_t * pucData,
size_t uxSize );
BaseType_t pucBitConfig_peek_last_index_uc( BitConfig_t * pxConfig,
uint8_t * pucData,
size_t uxSize );

void vBitConfig_write_8( BitConfig_t * pxConfig,
uint8_t ucValue );
void vBitConfig_write_16( BitConfig_t * pxConfig,
uint16_t usValue );
void vBitConfig_write_32( BitConfig_t * pxConfig,
uint32_t ulValue );
void vBitConfig_write_uc( BitConfig_t * pxConfig,
const uint8_t * pucData,
size_t uxSize );
void vBitConfig_write_8( BitConfig_t * pxConfig,
uint8_t ucValue );
void vBitConfig_write_16( BitConfig_t * pxConfig,
uint16_t usValue );
void vBitConfig_write_32( BitConfig_t * pxConfig,
uint32_t ulValue );
void vBitConfig_write_uc( BitConfig_t * pxConfig,
const uint8_t * pucData,
size_t uxSize );

void vBitConfig_release( BitConfig_t * pxConfig );
void vBitConfig_release( BitConfig_t * pxConfig );


#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* !defined( FREERTOS_STREAM_BUFFER_H ) */
#endif /* FREERTOS_STREAM_BUFFER_H */
154 changes: 79 additions & 75 deletions source/include/FreeRTOS_DHCPv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,147 +24,151 @@
*/

#ifndef FREERTOS_DHCPV6_H
#define FREERTOS_DHCPV6_H
#define FREERTOS_DHCPV6_H

/* Application level configuration options. */
#include "FreeRTOS_DHCP.h"
#include "FreeRTOSIPConfig.h"
#include "IPTraceMacroDefaults.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOSIPConfig.h"
#include "IPTraceMacroDefaults.h"

#ifdef __cplusplus
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#endif
/* *INDENT-ON* */

/* IPv6 option numbers. */
/** @brief IPv6 DHCP option number - Solicit */
#define DHCPv6_message_Type_Solicit 1U
#define DHCPv6_message_Type_Solicit 1U
/** @brief IPv6 DHCP option number - Advertise */
#define DHCPv6_message_Type_Advertise 2U
#define DHCPv6_message_Type_Advertise 2U
/** @brief IPv6 DHCP option number - Request */
#define DHCPv6_message_Type_Request 3U
#define DHCPv6_message_Type_Request 3U
/** @brief IPv6 DHCP option number - Confirm */
#define DHCPv6_message_Type_Confirm 4U
#define DHCPv6_message_Type_Confirm 4U
/** @brief IPv6 DHCP option number - Renew */
#define DHCPv6_message_Type_Renew 5U
#define DHCPv6_message_Type_Renew 5U
/** @brief IPv6 DHCP option number - Reply */
#define DHCPv6_message_Type_Reply 7U
#define DHCPv6_message_Type_Reply 7U
/** @brief IPv6 DHCP option number - Release */
#define DHCPv6_message_Type_Release 8U
#define DHCPv6_message_Type_Release 8U
/** @brief IPv6 DHCP option number - Decline */
#define DHCPv6_message_Type_Decline 9U
#define DHCPv6_message_Type_Decline 9U

/* Note: IA stands for "Identity_Association". */
/** @brief IPv6 DHCP option - Client Identifier */
#define DHCPv6_Option_Client_Identifier 1U
#define DHCPv6_Option_Client_Identifier 1U
/** @brief IPv6 DHCP option - Server Identifier */
#define DHCPv6_Option_Server_Identifier 2U
#define DHCPv6_Option_Server_Identifier 2U
/** @brief IPv6 DHCP option - Non Temporary Address */
#define DHCPv6_Option_NonTemporaryAddress 3U
#define DHCPv6_Option_NonTemporaryAddress 3U
/** @brief IPv6 DHCP option - Temporary Address */
#define DHCPv6_Option_TemporaryAddress 4U
#define DHCPv6_Option_TemporaryAddress 4U
/** @brief IPv6 DHCP option - Identity_Association Address */
#define DHCPv6_Option_IA_Address 5U
#define DHCPv6_Option_IA_Address 5U
/** @brief IPv6 DHCP option - Option */
#define DHCPv6_Option_Option_List 6U
#define DHCPv6_Option_Option_List 6U
/** @brief IPv6 DHCP option - Preference */
#define DHCPv6_Option_Preference 7U
#define DHCPv6_Option_Preference 7U
/** @brief IPv6 DHCP option - Elapsed time */
#define DHCPv6_Option_Elapsed_Time 8U
#define DHCPv6_Option_Elapsed_Time 8U
/** @brief IPv6 DHCP option - Status code */
#define DHCPv6_Option_Status_Code 13U
#define DHCPv6_Option_Status_Code 13U
/** @brief IPv6 DHCP option - Recursive name server */
#define DHCPv6_Option_DNS_recursive_name_server 23U
#define DHCPv6_Option_DNS_recursive_name_server 23U
/** @brief IPv6 DHCP option - Search list */
#define DHCPv6_Option_Domain_Search_List 24U
#define DHCPv6_Option_Domain_Search_List 24U
/** @brief IPv6 DHCP option - IA for prefix delegation */
#define DHCPv6_Option_IA_for_Prefix_Delegation 25U
#define DHCPv6_Option_IA_for_Prefix_Delegation 25U
/** @brief IPv6 DHCP option - IA Prefix */
#define DHCPv6_Option_IA_Prefix 26U
#define DHCPv6_Option_IA_Prefix 26U

/** @brief DHCPv6 option request, used in combination with 'DHCPv6_Option_Option_List' */
#define DHCP6_OPTION_REQUEST_DNS 0x0017
#define DHCP6_OPTION_REQUEST_DNS 0x0017
/** @brief DHCPv6 option request domain search list, used in combination with 'DHCPv6_Option_Option_List' */
#define DHCP6_OPTION_REQUEST_DOMAIN_SEARCH_LIST 0x0018
#define DHCP6_OPTION_REQUEST_DOMAIN_SEARCH_LIST 0x0018

#define DHCPv6_MAX_CLIENT_SERVER_ID_LENGTH 128
#define DHCPv6_MAX_CLIENT_SERVER_ID_LENGTH 128

/** @brief The function time() counts since 1-1-1970. The DHCPv6 time-stamp however
* uses a time stamp that had zero on 1-1-2000. */
#define SECS_FROM_1970_TILL_2000 946684800U
#define SECS_FROM_1970_TILL_2000 946684800U

/** @brief If a lease time is not received, use the default of two days. 48 hours in ticks.
* Do not use the macro pdMS_TO_TICKS() here as integer overflow can occur. */
#define dhcpv6DEFAULT_LEASE_TIME ( ( 48U * 60U * 60U ) * configTICK_RATE_HZ )
#define dhcpv6DEFAULT_LEASE_TIME ( ( 48U * 60U * 60U ) * configTICK_RATE_HZ )

/** @brief Don't allow the lease time to be too short. */
#define dhcpv6MINIMUM_LEASE_TIME ( pdMS_TO_TICKS( 60000U ) ) /* 60 seconds in ticks. */
#define dhcpv6MINIMUM_LEASE_TIME ( pdMS_TO_TICKS( 60000U ) ) /* 60 seconds in ticks. */

/** @brief Default v6 DHCP client port. */
#define ipDHCPv6_CLIENT_PORT 546U
/** @brief Default v6 DHCP server port. */
#define ipDHCPv6_SERVER_PORT 547U
#define ipDHCPv6_CLIENT_PORT 546U
/** @brief Default v6 DHCP server port. */
#define ipDHCPv6_SERVER_PORT 547U

/** @brief The ID of a client or a server. */
typedef struct xClientServerID
{
uint16_t usDUIDType; /**< A DHCP Unique Identifier ( DUID ). */
uint16_t usHardwareType; /**< The hardware type: 1 = Ethernet. */
uint8_t pucID[ DHCPv6_MAX_CLIENT_SERVER_ID_LENGTH ]; /**< Universally Unique IDentifier (UUID) format. */
size_t uxLength; /**< The number of valid bytes within 'pucID'. */
} ClientServerID_t;
typedef struct xClientServerID
{
uint16_t usDUIDType; /**< A DHCP Unique Identifier ( DUID ). */
uint16_t usHardwareType; /**< The hardware type: 1 = Ethernet. */
uint8_t pucID[ DHCPv6_MAX_CLIENT_SERVER_ID_LENGTH ]; /**< Universally Unique IDentifier (UUID) format. */
size_t uxLength; /**< The number of valid bytes within 'pucID'. */
} ClientServerID_t;

/** @brief DHCPMessage_IPv6_t holds all data of a DHCP client. */
typedef struct xDHCPMessage_IPv6
{
uint8_t uxMessageType; /**< The type of the last message received: Advertise / Confirm / Reply / Decline */
uint8_t ucTransactionID[ 3 ]; /**< ID of a transaction, shall be renewed when the transaction is ready ( and a reply has been received ). */
uint32_t ulTransactionID; /**< The same as above but now as a long integer. */
IP_Address_t xDNSServers[ ipconfigENDPOINT_DNS_ADDRESS_COUNT ]; /**< The IP-address of the DNS server. */
size_t uxDNSCount; /**< The number of the DNS server stored in xDNSServers. */
uint32_t ulPreferredLifeTime; /**< The preferred life time. */
uint32_t ulValidLifeTime; /**< The valid life time. */
uint32_t ulTimeStamp; /**< DUID Time: seconds since 1-1-2000. */
uint8_t ucprefixLength; /**< The length of the prefix offered. */
uint8_t ucHasUID; /**< When pdFALSE: a transaction ID must be created. */
IP_Address_t xPrefixAddress; /**< The prefix offered. */
IP_Address_t xIPAddress; /**< The IP-address offered. */
ClientServerID_t xClientID; /**< The UUID of the client. */
ClientServerID_t xServerID; /**< The UUID of the server. */
} DHCPMessage_IPv6_t;
typedef struct xDHCPMessage_IPv6
{
uint8_t uxMessageType; /**< The type of the last message received: Advertise / Confirm / Reply / Decline */
uint8_t ucTransactionID[ 3 ]; /**< ID of a transaction, shall be renewed when the transaction is ready ( and a reply has been received ). */
uint32_t ulTransactionID; /**< The same as above but now as a long integer. */
IP_Address_t xDNSServers[ ipconfigENDPOINT_DNS_ADDRESS_COUNT ]; /**< The IP-address of the DNS server. */
size_t uxDNSCount; /**< The number of the DNS server stored in xDNSServers. */
uint32_t ulPreferredLifeTime; /**< The preferred life time. */
uint32_t ulValidLifeTime; /**< The valid life time. */
uint32_t ulTimeStamp; /**< DUID Time: seconds since 1-1-2000. */
uint8_t ucprefixLength; /**< The length of the prefix offered. */
uint8_t ucHasUID; /**< When pdFALSE: a transaction ID must be created. */
IP_Address_t xPrefixAddress; /**< The prefix offered. */
IP_Address_t xIPAddress; /**< The IP-address offered. */
ClientServerID_t xClientID; /**< The UUID of the client. */
ClientServerID_t xServerID; /**< The UUID of the server. */
} DHCPMessage_IPv6_t;

/** @brief A struct describing an option. */
typedef struct xDHCPOptionSet
{
size_t uxOptionLength; /**< The length of the option being handled. */
size_t uxStart; /**< The position in xMessage where the option starts. */
} DHCPOptionSet_t;
typedef struct xDHCPOptionSet
{
size_t uxOptionLength; /**< The length of the option being handled. */
size_t uxStart; /**< The position in xMessage where the option starts. */
} DHCPOptionSet_t;

struct xNetworkEndPoint;
struct xNetworkEndPoint;

/* Returns the current state of a DHCP process. */
eDHCPState_t eGetDHCPv6State( struct xNetworkEndPoint * pxEndPoint );
eDHCPState_t eGetDHCPv6State( struct xNetworkEndPoint * pxEndPoint );

/*
* NOT A PUBLIC API FUNCTION.
* It will be called when the DHCP timer expires, or when
* data has been received on the DHCP socket.
*/
void vDHCPv6Process( BaseType_t xReset,
struct xNetworkEndPoint * pxEndPoint );
void vDHCPv6Process( BaseType_t xReset,
struct xNetworkEndPoint * pxEndPoint );

/*
* NOT A PUBLIC API FUNCTION.
* It will be called when the network interface, that the endpoint is associated with, goes down.
*/
void vDHCPv6Stop( struct xNetworkEndPoint * pxEndPoint );
void vDHCPv6Stop( struct xNetworkEndPoint * pxEndPoint );

#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

/* The application should supply the following time-function.
* It must return the number of seconds that have passed since
* 1/1/1970. */
extern uint32_t ulApplicationTimeHook( void );
extern uint32_t ulApplicationTimeHook( void );

#endif /* FREERTOS_DHCPv6_H */
#endif /* FREERTOS_DHCPV6_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
struct freertos_addrinfo ** ppxAddressInfo );
#endif /* if ( ipconfigUSE_DNS_CACHE == 1 ) */

#endif /* ifndef FREERTOS_DNS_CACHE_H */
#endif /* FREERTOS_DNS_CACHE_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
#endif
/* *INDENT-ON* */

#endif /* ifndef FREERTOS_DNS_CALLBACK_H */
#endif /* FREERTOS_DNS_CALLBACK_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,4 @@
#define ipMDNS_IP_ADDRESS 0xfb0000e0U /* 224.0.0.251 */
#endif

#endif /* ifndef FREERTOS_DNS_GLOBALS_H */
#endif /* FREERTOS_DNS_GLOBALS_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Networking.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
void DNS_CloseSocket( Socket_t xDNSSocket );

#endif /* if ( ipconfigUSE_DNS != 0 ) */
#endif /* ifndef FREERTOS_DNS_NETWORKING_H */
#endif /* FREERTOS_DNS_NETWORKING_H */
16 changes: 15 additions & 1 deletion source/include/FreeRTOS_DNS_Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@

/* Standard includes. */
#include <stdint.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

#if ( ipconfigUSE_DNS != 0 )

/** @brief Flag DNS parsing errors in situations where an IPv4 address is the return
Expand Down Expand Up @@ -87,4 +94,11 @@
size_t * uxBytesRead );

#endif /* if ( ipconfigUSE_DNS != 0 ) */
#endif /* ifndef FREERTOS_DNS_PARSER_H */

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_DNS_PARSER_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * c
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_H */
#endif /* FREERTOS_IPV4_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv4_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ typedef struct xTCP_PACKET TCPPacket_t;
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_PRIVATE_H */
#endif /* FREERTOS_IPV4_PRIVATE_H */
Loading