update to v6.1.3

This commit is contained in:
Scott Larson 2021-01-07 18:07:52 -08:00
parent 6d0d7dd97d
commit fd45d4cbd1
17 changed files with 2205 additions and 81 deletions

View File

@ -2553,7 +2553,7 @@ CHAR *work_ptr;
/* FUNCTION RELEASE */
/* */
/* _nx_dhcp_parse_next_option PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -2576,7 +2576,7 @@ CHAR *work_ptr;
/* */
/* CALLS */
/* */
/* atoi Convert ascii number to integer*/
/* _nx_utility_string_to_uint Convert ascii number to integer*/
/* */
/* CALLED BY */
/* */
@ -2589,6 +2589,9 @@ CHAR *work_ptr;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), fixed */
/* obsolescent functions, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dhcp_parse_next_option(CHAR **option_list, UINT *option, UINT length)
@ -2651,10 +2654,8 @@ CHAR *buffer;
*option_list += j;
/* Convert the number string to an actual integer. */
*option = (UINT) atoi(num_string);
return(NX_SUCCESS);
/* Convert the number string to an actual unsigned integer. */
return(_nx_utility_string_to_uint(num_string, buffer_index, option));
}

View File

@ -65,7 +65,7 @@ static UINT _nx_dns_process_a_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr
static UINT _nx_dns_process_aaaa_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr, UCHAR **buffer_prepend_ptr, UCHAR **buffer_append_ptr, UINT *record_count, UINT rr_location);
#ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES
static UINT _nx_dns_resource_name_real_size_calculate(UCHAR *data, UINT start);
static UINT _nx_dns_resource_name_real_size_calculate(UCHAR *data, UINT start, UINT data_length);
static UINT _nx_dns_process_cname_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr, UCHAR *record_buffer, UINT buffer_size, UINT *record_count);
static UINT _nx_dns_process_txt_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr, UCHAR *record_buffer, UINT buffer_size, UINT *record_count);
static UINT _nx_dns_process_ns_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr, UCHAR **buffer_prepend_ptr, UCHAR **buffer_append_ptr, UINT *record_count);
@ -5164,7 +5164,7 @@ ULONG rr_ttl;
/* FUNCTION RELEASE */
/* */
/* _nx_dns_process_ns_type PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -5211,6 +5211,10 @@ ULONG rr_ttl;
/* updated resource get APIs to*/
/* improve buffer bound check, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Updated input parameter of the*/
/* API to get the real size of */
/* resource name, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dns_process_ns_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr,
@ -5280,7 +5284,7 @@ ULONG rr_ttl;
}
/* Get the real size of the name, and set the name buffer size.*/
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr));
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr), packet_ptr -> nx_packet_length);
/* Check the buffer space. */
if ((*buffer_append_ptr - name_buffer_size - 1 ) < (*buffer_prepend_ptr + sizeof(NX_DNS_NS_ENTRY)))
@ -5367,7 +5371,7 @@ ULONG rr_ttl;
/* FUNCTION RELEASE */
/* */
/* _nx_dns_process_mx_type PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -5415,6 +5419,10 @@ ULONG rr_ttl;
/* updated resource get APIs to*/
/* improve buffer bound check, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Updated input parameter of the*/
/* API to get the real size of */
/* resource name, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dns_process_mx_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr,
@ -5493,7 +5501,7 @@ UINT size;
data_ptr += 2;
/* Get the real size of the name, and set the name buffer size.*/
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr));
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr), packet_ptr -> nx_packet_length);
/* Check the buffer space. */
if ((*buffer_append_ptr - name_buffer_size - 1 ) < (*buffer_prepend_ptr + sizeof(NX_DNS_MX_ENTRY)))
@ -5598,7 +5606,7 @@ UINT size;
/* FUNCTION RELEASE */
/* */
/* _nx_dns_process_srv_type PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -5646,6 +5654,10 @@ UINT size;
/* updated resource get APIs to*/
/* improve buffer bound check, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Updated input parameter of the*/
/* API to get the real size of */
/* resource name, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dns_process_srv_type(NX_DNS *dns_ptr, NX_PACKET *packet_ptr, UCHAR *data_ptr, UCHAR **buffer_prepend_ptr,
@ -5737,7 +5749,7 @@ UINT size;
data_ptr += 2;
/* Get the real size of the name, and set the name buffer size.*/
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr));
name_buffer_size = _nx_dns_resource_name_real_size_calculate(packet_ptr -> nx_packet_prepend_ptr, (UINT)(data_ptr - packet_ptr -> nx_packet_prepend_ptr), packet_ptr -> nx_packet_length);
/* Check the buffer space. */
if ((*buffer_append_ptr - name_buffer_size - 1 ) < (*buffer_prepend_ptr + sizeof(NX_DNS_MX_ENTRY)))
@ -6814,7 +6826,7 @@ UINT count = 1;
/* FUNCTION RELEASE */
/* */
/* _nx_dns_name_string_unencode PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -6852,6 +6864,10 @@ UINT count = 1;
/* 09-30-2020 Yuxin Zhou Modified comment(s), improved */
/* compression pointer check, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), prevented*/
/* infinite loop in name */
/* compression, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dns_name_string_unencode(NX_PACKET *packet_ptr, UCHAR *data, UCHAR *buffer, UINT buffer_size)
@ -6862,6 +6878,7 @@ UCHAR *message_start;
UINT label_size;
UINT offset;
UINT length;
UINT pointer_count = 0;
/* Initialize the value. */
character = data;
@ -6924,6 +6941,14 @@ UINT length;
}
else
{
/* Prevent infinite loop with compression pointers. */
pointer_count++;
if (pointer_count > NX_DNS_MAX_COMPRESSION_POINTERS)
{
/* This is malformed packet. */
return(0);
}
/* update valid pointer */
character = message_start + offset;
}
@ -7060,7 +7085,7 @@ UINT size = 0;
/* FUNCTION RELEASE */
/* */
/* _nx_dns_resource_name_real_size_calculate PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -7073,6 +7098,7 @@ UINT size = 0;
/* */
/* data Pointer to buffer to decode */
/* start Location of start of data */
/* data_length Data buffer length */
/* */
/* OUTPUT */
/* */
@ -7094,14 +7120,20 @@ UINT size = 0;
/* 09-30-2020 Yuxin Zhou Modified comment(s), improved */
/* compression pointer check, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* pointer check, prevented */
/* infinite loop in name */
/* compression, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_dns_resource_name_real_size_calculate(UCHAR *data, UINT start)
static UINT _nx_dns_resource_name_real_size_calculate(UCHAR *data, UINT start, UINT data_length)
{
UCHAR *character = data + start;
UINT length = 0;
UINT offset;
UINT pointer_count = 0;
/* As long as there is space in the buffer and we haven't
found a zero terminating label */
@ -7128,8 +7160,18 @@ UINT length = 0;
else if ((labelSize & NX_DNS_COMPRESS_MASK) == NX_DNS_COMPRESS_VALUE)
{
/* Get the offset. */
offset = ((labelSize & NX_DNS_LABEL_MAX) << 8) + *character;
/* Check the offset. */
if (offset >= data_length)
{
return(0);
}
/* This is a pointer, just adjust the source. */
if (character == data + ((labelSize & NX_DNS_LABEL_MAX) << 8) + *character)
if (character == data + offset)
{
/* If compression pointer equals the same offset currently being parsed,
it could lead to an infinite loop. */
@ -7137,8 +7179,19 @@ UINT length = 0;
}
else
{
/* Prevent infinite loop with compression pointers. */
pointer_count++;
if (pointer_count > NX_DNS_MAX_COMPRESSION_POINTERS)
{
/* This is malformed packet. */
return(0);
}
/* update valid pointer */
character = data + ((labelSize & NX_DNS_LABEL_MAX) << 8) + *character;
character = data + offset;
}
}
else
@ -7150,7 +7203,10 @@ UINT length = 0;
}
/* Reduce the last '.' string, update the length. */
if (length)
{
length --;
}
/* Return name size. */
return(length);

View File

@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_dns.h PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -45,6 +45,10 @@
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), prevented*/
/* infinite loop in name */
/* compression, resulting in */
/* version 6.1.3 */
/* */
/**************************************************************************/
@ -294,6 +298,10 @@ extern "C" {
#define NX_DNS_PACKET_ALLOCATE_TIMEOUT NX_IP_PERIODIC_RATE
#endif
/* Define the maximum number of pointers allowed in name compression. */
#ifndef NX_DNS_MAX_COMPRESSION_POINTERS
#define NX_DNS_MAX_COMPRESSION_POINTERS 16
#endif
/* Define the basic DNS data structure. */

View File

@ -1355,7 +1355,7 @@ ULONG events;
/* FUNCTION RELEASE */
/* */
/* _nx_ftp_server_command_process PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -1426,6 +1426,9 @@ ULONG events;
/* packet length verification, */
/* verified memcpy use cases, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* packet length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
VOID _nx_ftp_server_command_process(NX_FTP_SERVER *ftp_server_ptr)
@ -1724,6 +1727,18 @@ ULONG block_size;
break;
}
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "File Open Fail");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2005,6 +2020,18 @@ ULONG block_size;
break;
}
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "File Open Failed");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2184,6 +2211,18 @@ ULONG block_size;
case NX_FTP_RNFR:
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Rename File not found");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2250,6 +2289,18 @@ ULONG block_size;
case NX_FTP_RNTO:
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Rename failed");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2320,6 +2371,18 @@ ULONG block_size;
case NX_FTP_DELE:
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Delete Failed");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2376,6 +2439,18 @@ ULONG block_size;
case NX_FTP_RMD:
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Delete Directory Fail");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2438,6 +2513,18 @@ ULONG block_size;
case NX_FTP_MKD:
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Directory Create failed");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2543,6 +2630,18 @@ ULONG block_size;
break;
}
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "List bad Directory");
break;
}
/* Change to the default directory of this connection. */
fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -2916,6 +3015,18 @@ ULONG block_size;
break;
}
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Bad Directory");
break;
}
/* Change to the default directory of this connection. */
status = fx_directory_local_path_restore(ftp_server_ptr -> nx_ftp_server_media_ptr, &(client_req_ptr -> nx_ftp_client_local_path));
@ -3687,6 +3798,9 @@ ULONG block_size;
/* If CDUP command, create the "up one directory" pathname string. */
if (ftp_command == NX_FTP_CDUP)
{
/* Move the pointer to make sure there is enough memory to store the data. */
buffer_ptr -= 3;
buffer_ptr[0] = '.';
buffer_ptr[1] = '.';
buffer_ptr[2] = NX_NULL;
@ -3696,6 +3810,18 @@ ULONG block_size;
else
{
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message. */
/* Now send an error response to the client. */
_nx_ftp_server_response(&(client_req_ptr -> nx_ftp_client_request_control_socket), packet_ptr,
NX_FTP_CODE_BAD_FILE, "Change Dir Fail");
break;
}
/* Find the end of the message. */
j = 0;
while (j < packet_ptr -> nx_packet_length - 1)
@ -4554,7 +4680,7 @@ NX_FTP_CLIENT_REQUEST *client_req_ptr;
/* FUNCTION RELEASE */
/* */
/* _nx_ftp_server_parse_command PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -4588,6 +4714,9 @@ NX_FTP_CLIENT_REQUEST *client_req_ptr;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* packet length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
UINT _nx_ftp_server_parse_command(NX_PACKET *packet_ptr)
@ -4597,6 +4726,14 @@ UINT i;
char *buffer_ptr;
/* Check packet length. */
if (packet_ptr -> nx_packet_length == 0)
{
/* Empty message, just return INVALID. */
return(NX_FTP_INVALID);
}
/* Setup pointer to command buffer area. */
buffer_ptr = (char *) packet_ptr -> nx_packet_prepend_ptr;

View File

@ -608,7 +608,7 @@ UINT status;
/* FUNCTION RELEASE */
/* */
/* _nx_pppoe_client_service_name_set_extended PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -649,6 +649,9 @@ UINT status;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* string length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
UINT _nx_pppoe_client_service_name_set_extended(NX_PPPOE_CLIENT *pppoe_client_ptr, UCHAR *service_name, UINT service_name_length)
@ -670,6 +673,9 @@ UINT temp_service_name_length = 0;
/* Setup service name pointer. */
pppoe_client_ptr -> nx_pppoe_service_name = service_name;
/* Setup service name length. */
pppoe_client_ptr -> nx_pppoe_service_name_length = service_name_length;
/* Release the IP internal mutex. */
tx_mutex_put(&(pppoe_client_ptr -> nx_pppoe_ip_ptr -> nx_ip_protection));
@ -868,7 +874,7 @@ UINT status;
/* FUNCTION RELEASE */
/* */
/* _nx_pppoe_client_host_uniq_set_extended PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -909,6 +915,9 @@ UINT status;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* string length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
UINT _nx_pppoe_client_host_uniq_set_extended(NX_PPPOE_CLIENT *pppoe_client_ptr, UCHAR *host_uniq, UINT host_uniq_length)
@ -926,9 +935,12 @@ UINT temp_host_uniq_length = 0;
/* Obtain the IP internal mutex before processing the IP event. */
tx_mutex_get(&(pppoe_client_ptr -> nx_pppoe_ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
/* Setup service name pointer. */
/* Setup host unique pointer. */
pppoe_client_ptr -> nx_pppoe_host_uniq = host_uniq;
/* Setup host unique length. */
pppoe_client_ptr -> nx_pppoe_host_uniq_length = host_uniq_length;
/* Release the IP internal mutex. */
tx_mutex_put(&(pppoe_client_ptr -> nx_pppoe_ip_ptr -> nx_ip_protection));
@ -2157,7 +2169,7 @@ UINT ethernet_type;
/* FUNCTION RELEASE */
/* */
/* _nx_pppoe_client_discovery_packet_process PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -2200,6 +2212,9 @@ UINT ethernet_type;
/* packet length verification, */
/* verified memcpy use cases, */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* string length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
VOID _nx_pppoe_client_discovery_packet_process(NX_PPPOE_CLIENT *pppoe_client_ptr, NX_PACKET *packet_ptr, ULONG server_mac_msw, ULONG server_mac_lsw)
@ -2364,7 +2379,8 @@ UINT tag_host_uniq_valid = NX_FALSE;
{
/* Compare the service name with PPPoE Service name that Client is requesting. */
if (!memcmp(tag_ptr + tag_index, pppoe_client_ptr -> nx_pppoe_service_name, tag_length))
if ((pppoe_client_ptr -> nx_pppoe_service_name_length == tag_length) &&
(!memcmp(tag_ptr + tag_index, pppoe_client_ptr -> nx_pppoe_service_name, tag_length)))
{
/* Update the information. */
@ -2404,7 +2420,8 @@ UINT tag_host_uniq_valid = NX_FALSE;
tag_host_uniq_count ++;
/* Check the Host-Uniq. */
if (!memcmp(tag_ptr + tag_index, pppoe_client_ptr -> nx_pppoe_host_uniq, tag_length))
if ((pppoe_client_ptr -> nx_pppoe_host_uniq_length == tag_length) &&
(!memcmp(tag_ptr + tag_index, pppoe_client_ptr -> nx_pppoe_host_uniq, tag_length)))
{
/* Update the information. */
@ -2751,7 +2768,7 @@ NX_PPPOE_SERVER_SESSION *server_session_ptr;
/* FUNCTION RELEASE */
/* */
/* _nx_pppoe_client_discovery_send PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -2793,6 +2810,9 @@ NX_PPPOE_SERVER_SESSION *server_session_ptr;
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* string length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
static UINT _nx_pppoe_client_discovery_send(NX_PPPOE_CLIENT *pppoe_client_ptr, UINT code)
@ -2803,7 +2823,6 @@ NX_PACKET *packet_ptr;
UCHAR *work_ptr;
UINT status;
UINT index = 0;
UINT tag_length;
/* Allocate a PPPoE packet. */
@ -2843,21 +2862,12 @@ UINT tag_length;
if (pppoe_client_ptr -> nx_pppoe_service_name)
{
/* Calculate the name length. */
if (_nx_utility_string_length_check((char *)(pppoe_client_ptr -> nx_pppoe_service_name), &tag_length, NX_MAX_STRING_LENGTH))
{
/* Packet too small. */
nx_packet_release(packet_ptr);
return(NX_PPPOE_CLIENT_SERVICE_NAME_ERROR);
}
if (((ULONG)(packet_ptr -> nx_packet_data_end) - (ULONG)(&work_ptr[index])) >=
(4 + tag_length))
(4 + pppoe_client_ptr -> nx_pppoe_service_name_length))
{
/* Added the Service-Name tag. */
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_SERVICE_NAME, tag_length, pppoe_client_ptr -> nx_pppoe_service_name, &index);
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_SERVICE_NAME, pppoe_client_ptr -> nx_pppoe_service_name_length, pppoe_client_ptr -> nx_pppoe_service_name, &index);
}
else
{
@ -2878,21 +2888,12 @@ UINT tag_length;
if (pppoe_client_ptr -> nx_pppoe_host_uniq)
{
/* Calculate the name length. */
if (_nx_utility_string_length_check((char *)(pppoe_client_ptr -> nx_pppoe_host_uniq), &tag_length, NX_MAX_STRING_LENGTH))
{
/* Packet too small. */
nx_packet_release(packet_ptr);
return(NX_PPPOE_CLIENT_PACKET_PAYLOAD_ERROR);
}
if (((ULONG)(packet_ptr -> nx_packet_data_end) - (ULONG)(&work_ptr[index])) >=
(4 + tag_length))
(4 + pppoe_client_ptr -> nx_pppoe_host_uniq_length))
{
/* Added the Host-Uniq tag. */
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_HOST_UNIQ, tag_length, pppoe_client_ptr -> nx_pppoe_host_uniq, &index);
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_HOST_UNIQ, pppoe_client_ptr -> nx_pppoe_host_uniq_length, pppoe_client_ptr -> nx_pppoe_host_uniq, &index);
}
else
{
@ -2911,22 +2912,12 @@ UINT tag_length;
if (pppoe_client_ptr -> nx_pppoe_service_name)
{
/* Calculate the name length. */
if (_nx_utility_string_length_check((char *)(pppoe_client_ptr -> nx_pppoe_service_name), &tag_length, NX_MAX_STRING_LENGTH))
{
/* Packet too small. */
nx_packet_release(packet_ptr);
return(NX_PPPOE_CLIENT_SERVICE_NAME_ERROR);
}
if (((ULONG)(packet_ptr -> nx_packet_data_end) - (ULONG)(&work_ptr[index])) >=
(4 + tag_length))
(4 + pppoe_client_ptr -> nx_pppoe_service_name_length))
{
/* Added the Service-Name tag. */
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_SERVICE_NAME, tag_length, pppoe_client_ptr -> nx_pppoe_service_name, &index);
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_SERVICE_NAME, pppoe_client_ptr -> nx_pppoe_service_name_length, pppoe_client_ptr -> nx_pppoe_service_name, &index);
}
else
{
@ -2947,21 +2938,12 @@ UINT tag_length;
if (pppoe_client_ptr -> nx_pppoe_host_uniq)
{
/* Calculate the name length. */
if (_nx_utility_string_length_check((char *)(pppoe_client_ptr -> nx_pppoe_host_uniq), &tag_length, NX_MAX_STRING_LENGTH))
{
/* Packet too small. */
nx_packet_release(packet_ptr);
return(NX_PPPOE_CLIENT_PACKET_PAYLOAD_ERROR);
}
if (((ULONG)(packet_ptr -> nx_packet_data_end) - (ULONG)(&work_ptr[index])) >=
(4 + tag_length))
(4 + pppoe_client_ptr -> nx_pppoe_host_uniq_length))
{
/* Added the Host-Uniq tag. */
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_HOST_UNIQ, tag_length, pppoe_client_ptr -> nx_pppoe_host_uniq, &index);
_nx_pppoe_client_tag_string_add(work_ptr, NX_PPPOE_CLIENT_TAG_TYPE_HOST_UNIQ, pppoe_client_ptr -> nx_pppoe_host_uniq_length, pppoe_client_ptr -> nx_pppoe_host_uniq, &index);
}
else
{

View File

@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_pppoe_client.h PORTABLE C */
/* 6.1 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -44,6 +44,9 @@
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
/* resulting in version 6.1 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), improved */
/* string length verification, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
@ -228,7 +231,9 @@ typedef struct NX_PPPOE_CLIENT_STRUCT
UINT nx_pppoe_state;
NX_PPPOE_SERVER_SESSION nx_pppoe_server_session;
UCHAR *nx_pppoe_service_name;
UINT nx_pppoe_service_name_length;
UCHAR *nx_pppoe_host_uniq;
UINT nx_pppoe_host_uniq_length;
UCHAR nx_pppoe_ac_name[NX_PPPOE_CLIENT_MAX_AC_NAME_SIZE];
UINT nx_pppoe_ac_name_size;
UCHAR nx_pppoe_ac_cookie[NX_PPPOE_CLIENT_MAX_AC_COOKIE_SIZE];

View File

@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_api.h PORTABLE C */
/* 6.1.2 */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
@ -52,6 +52,11 @@
/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
/* updated product constants, */
/* resulting in version 6.1.2 */
/* 12-31-2020 Yuxin Zhou Modified comment(s), and */
/* added function to convert */
/* string to unsigned integer, */
/* updated product constants, */
/* resulting in version 6.1.3 */
/* */
/**************************************************************************/
@ -360,7 +365,7 @@ VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG
#define AZURE_RTOS_NETX
#define NETX_MAJOR_VERSION 6
#define NETX_MINOR_VERSION 1
#define NETX_PATCH_VERSION 2
#define NETX_PATCH_VERSION 3
/* The following symbols are defined for backward compatibility reasons.*/
#define EL_PRODUCT_NETX
@ -2368,6 +2373,7 @@ VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index);
/* Utility functions. */
UINT _nx_utility_string_length_check(CHAR *input_string, UINT *string_length, UINT max_string_length);
UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number);
/* Determine if a C++ compiler is being used. If so, complete the standard
C conditional started above. */

View File

@ -109,3 +109,93 @@ UINT i;
return(NX_SUCCESS);
}
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _nx_utility_string_to_uint PORTABLE C */
/* 6.1.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function converts the string to unsigned integer. */
/* */
/* INPUT */
/* */
/* input_string Pointer to input string */
/* string_length Length of input string */
/* number Pointer to the number */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number)
{
UINT i;
/* Check for invalid input pointers. */
if ((input_string == NX_NULL) || (number == NX_NULL))
{
return(NX_PTR_ERROR);
}
/* Check string length. */
if (string_length == 0)
{
return(NX_SIZE_ERROR);
}
/* Initialize. */
i = 0;
*number = 0;
/* Traverse the string. */
while (i < string_length)
{
/* Is a numeric character present? */
if ((input_string[i] >= '0') && (input_string[i] <= '9'))
{
/* Check overflow. Max Value: Hex:0xFFFFFFFF, Decimal: 4294967295. */
if (((*number == 429496729) && (input_string[i] > '5')) ||
(*number >= 429496730))
{
return(NX_OVERFLOW);
}
/* Yes, numeric character is present. Update the number. */
*number = (*number * 10) + (UINT) (input_string[i] - '0');
}
else
{
return(NX_INVALID_PARAMETERS);
}
i++;
}
/* Return success. */
return(NX_SUCCESS);
}

View File

@ -0,0 +1,210 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M23/AC5 */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
{ \
ULONG i; \
ULONG tmp; \
i = (UINT)arg; \
/* i = A, B, C, D */ \
tmp = i ^ (((i) >> 16) | (i << 16)); \
/* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \
tmp &= 0xff00ffff; \
/* tmp = A^C, 0, C^A, D^B */ \
i = ((i) >> 8) | (i<<24); \
/* i = D, A, B, C */ \
i = i ^ ((tmp) >> 8); \
/* i = D, C, B, A */ \
arg = i; \
}
#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF)
#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \
| (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24))
#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8))
#ifndef htonl
#define htonl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __SWAP16__(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __SWAP16__(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M23/AC5 Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,199 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M23/GNU */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
/* By default IPv6 is enabled. */
#ifndef FEATURE_NX_IPV6
#define FEATURE_NX_IPV6
#endif /* FEATURE_NX_IPV6 */
#ifdef NX_DISABLE_IPV6
#undef FEATURE_NX_IPV6
#endif /* !NX_DISABLE_IPV6 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) (arg) = __builtin_bswap32(arg)
#define NX_CHANGE_USHORT_ENDIAN(arg) (arg) = __builtin_bswap16(arg)
#ifndef htonl
#define htonl(val) __builtin_bswap32(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __builtin_bswap32(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __builtin_bswap16(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __builtin_bswap16(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M23/GNU Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,190 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M23/IAR */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) arg = __REV(arg)
#define NX_CHANGE_USHORT_ENDIAN(arg) arg = __REV16(arg)
#ifndef htonl
#define htonl(val) __REV(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __REV(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __REV16(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __REV16(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M23/IAR Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,210 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M33/AC5 */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
{ \
ULONG i; \
ULONG tmp; \
i = (UINT)arg; \
/* i = A, B, C, D */ \
tmp = i ^ (((i) >> 16) | (i << 16)); \
/* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \
tmp &= 0xff00ffff; \
/* tmp = A^C, 0, C^A, D^B */ \
i = ((i) >> 8) | (i<<24); \
/* i = D, A, B, C */ \
i = i ^ ((tmp) >> 8); \
/* i = D, C, B, A */ \
arg = i; \
}
#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF)
#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \
| (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24))
#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8))
#ifndef htonl
#define htonl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __SWAP16__(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __SWAP16__(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M33/AC5 Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,199 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M33/GNU */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
/* By default IPv6 is enabled. */
#ifndef FEATURE_NX_IPV6
#define FEATURE_NX_IPV6
#endif /* FEATURE_NX_IPV6 */
#ifdef NX_DISABLE_IPV6
#undef FEATURE_NX_IPV6
#endif /* !NX_DISABLE_IPV6 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) (arg) = __builtin_bswap32(arg)
#define NX_CHANGE_USHORT_ENDIAN(arg) (arg) = __builtin_bswap16(arg)
#ifndef htonl
#define htonl(val) __builtin_bswap32(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __builtin_bswap32(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __builtin_bswap16(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __builtin_bswap16(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M33/GNU Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,190 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h Cortex-M33/IAR */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) arg = __REV(arg)
#define NX_CHANGE_USHORT_ENDIAN(arg) arg = __REV16(arg)
#ifndef htonl
#define htonl(val) __REV(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __REV(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __REV16(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __REV16(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX Cortex-M33/IAR Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,221 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h RXv2/CCRX */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
/* By default IPv6 is enabled. */
#ifndef FEATURE_NX_IPV6
#define FEATURE_NX_IPV6
#endif /* FEATURE_NX_IPV6 */
#ifdef NX_DISABLE_IPV6
#undef FEATURE_NX_IPV6
#endif /* !NX_DISABLE_IPV6 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
{ \
ULONG i; \
ULONG tmp; \
i = (UINT)arg; \
/* i = A, B, C, D */ \
tmp = i ^ (((i) >> 16) | (i << 16)); \
/* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \
tmp &= 0xff00ffff; \
/* tmp = A^C, 0, C^A, D^B */ \
i = ((i) >> 8) | (i<<24); \
/* i = D, A, B, C */ \
i = i ^ ((tmp) >> 8); \
/* i = D, C, B, A */ \
arg = i; \
}
#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF)
#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \
| (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24))
#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8))
#ifndef htonl
#define htonl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __SWAP16__(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __SWAP16__(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX RXv2/CCRX Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,210 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h RXv2/GNU */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
{ \
ULONG i; \
ULONG tmp; \
i = (UINT)arg; \
/* i = A, B, C, D */ \
tmp = i ^ (((i) >> 16) | (i << 16)); \
/* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \
tmp &= 0xff00ffff; \
/* tmp = A^C, 0, C^A, D^B */ \
i = ((i) >> 8) | (i<<24); \
/* i = D, A, B, C */ \
i = i ^ ((tmp) >> 8); \
/* i = D, C, B, A */ \
arg = i; \
}
#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF)
#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \
| (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24))
#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8))
#ifndef htonl
#define htonl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __SWAP16__(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __SWAP16__(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX RXv2/GNU Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif

View File

@ -0,0 +1,210 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_port.h RXv2/IAR */
/* 6.1.3 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make the NetX */
/* real-time TCP/IP function identically on a variety of different */
/* processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-2020 Yuxin Zhou Initial Version 6.1.3 */
/* */
/**************************************************************************/
#ifndef NX_PORT_H
#define NX_PORT_H
/* Determine if the optional NetX user define file should be used. */
#ifdef NX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in nx_user.h. The defines in this file may
alternately be defined on the command line. */
#include "nx_user.h"
#endif
/* Default to little endian, since this is what most ARM targets are. */
#define NX_LITTLE_ENDIAN 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Define various constants for the port. */
#ifndef NX_IP_PERIODIC_RATE
#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for
ports with 10ms timer interrupts. This
value may be defined instead at the
command line and this value will not be
used. */
#endif
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
{ \
ULONG i; \
ULONG tmp; \
i = (UINT)arg; \
/* i = A, B, C, D */ \
tmp = i ^ (((i) >> 16) | (i << 16)); \
/* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \
tmp &= 0xff00ffff; \
/* tmp = A^C, 0, C^A, D^B */ \
i = ((i) >> 8) | (i<<24); \
/* i = D, A, B, C */ \
i = i ^ ((tmp) >> 8); \
/* i = D, C, B, A */ \
arg = i; \
}
#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF)
#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \
| (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24))
#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8))
#ifndef htonl
#define htonl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) __SWAP32__(val)
#endif /* htonl */
#ifndef htons
#define htons(val) __SWAP16__(val)
#endif /*htons */
#ifndef ntohs
#define ntohs(val) __SWAP16__(val)
#endif /*htons */
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons
#define htons(val) (val)
#endif /* htons */
#ifndef ntohs
#define ntohs(val) (val)
#endif /* ntohs */
#ifndef ntohl
#define ntohl(val) (val)
#endif
#ifndef htonl
#define htonl(val) (val)
#endif /* htonl */
#endif
/* Define several macros for the error checking shell in NetX. */
#ifndef TX_TIMER_PROCESS_IN_ISR
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern TX_THREAD _tx_timer_thread; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \
(_tx_thread_current_ptr == &_tx_timer_thread)) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
return(NX_CALLER_ERROR);
#else
#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \
extern volatile ULONG _tx_thread_system_state;
#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \
(_tx_thread_current_ptr == TX_NULL)) \
return(NX_CALLER_ERROR);
#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \
return(NX_CALLER_ERROR);
#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \
return(NX_CALLER_ERROR);
#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \
((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
return(NX_CALLER_ERROR);
#endif
/* Define the version ID of NetX. This may be utilized by the application. */
#ifdef NX_SYSTEM_INIT
CHAR _nx_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * NetX RXv2/IAR Version 6.1.3 *";
#else
extern CHAR _nx_version_id[];
#endif
#endif