/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * Copyright (c) 2025-present Eclipse ThreadX Contributors * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Component */ /** */ /** Internet Protocol (IP) */ /** */ /**************************************************************************/ /**************************************************************************/ #define NX_SOURCE_CODE /* Include necessary system files. */ #include "nx_api.h" #include "nx_ip.h" /* Bring in externs for caller checking code. */ NX_CALLER_CHECKING_EXTERNS /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _nxe_ip_raw_packet_receive PORTABLE C */ /* 6.4.3 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks for errors in the IP raw packet receive */ /* function call. */ /* */ /* INPUT */ /* */ /* ip_ptr IP control block pointer */ /* packet_ptr Pointer to place allocated packet */ /* in */ /* wait_option Suspension option */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* _nx_packet_release Release invalid packet */ /* _nx_ip_raw_packet_receive Actual IP raw packet receive */ /* function */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* */ /**************************************************************************/ UINT _nxe_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option) { UINT status; /* Check for invalid input pointers. */ if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (packet_ptr == NX_NULL)) { return(NX_PTR_ERROR); } /* Check to see if IP raw packet processing is enabled. */ if (!ip_ptr -> nx_ip_raw_ip_processing) { return(NX_NOT_ENABLED); } /* Check for appropriate caller. */ NX_THREADS_ONLY_CALLER_CHECKING /* Call actual IP raw packet receive function. */ status = _nx_ip_raw_packet_receive(ip_ptr, packet_ptr, wait_option); /* Return completion status. */ return(status); }