Skip to content

Commit

Permalink
Undo indent to avoid huge white space changes
Browse files Browse the repository at this point in the history
  • Loading branch information
htibosch committed Oct 18, 2023
1 parent aaa3ee3 commit 71554fa
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 114 deletions.
72 changes: 34 additions & 38 deletions source/include/FreeRTOS_BitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,54 +33,50 @@
*/

#ifndef FREERTOS_BITCONFIG_H
#define FREERTOS_BITCONFIG_H
#define FREERTOS_BITCONFIG_H

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

/**< @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 );


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

#endif /* FREERTOS_STREAM_BUFFER_H */
148 changes: 72 additions & 76 deletions source/include/FreeRTOS_DHCPv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,151 +24,147 @@
*/

#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"

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

/* 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
#define ipDHCPv6_CLIENT_PORT 546U
/** @brief Default v6 DHCP server port. */
#define ipDHCPv6_SERVER_PORT 547U
#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 );

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

/* 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 */

0 comments on commit 71554fa

Please sign in to comment.