📄 jdd_netapi.h.svn-base
字号:
* @param[in] uiSocketID Specifies the socket descriptor
* @param[in] pucSendBuffer Specifies the byte stream which needs to be transmitted.
* @param[in] uiSendBufferLen Specifies the length of the content (pucSendBuffer) that needs to be transmitted.
* @param[in] eFlags Currently this flag is not used
* @param[in] pstDestAddr Specifes the information about the destination address
* @param[in] uiDestAddrLen Specifies the address of #JC_NET_ADDR.
* @param[out] puiSentBytes Returns the actual number of bytes that has been transmitted from the given byte stream.
*
* @retval JC_ERR_NET_SEND Specifies that the data could not be sent on the socket.
* @retval JC_ERR_NET_SOCKET Specifies that there was an error in the socket.
* @retval JC_ERR_NET_WOULDBLOCK Specifies that the socket is marked as non-blocking and the send operation would blocked.
*
* This function shall be used to send a datagram to a specified peer socket identified by the destination address.
* @see jdd_NetRecvFrom
*/
JC_RETCODE jdd_NetSendTo (JC_UINT32 uiSocketID, JC_UINT8 *pucSendBuffer,
JC_UINT32 uiSendBufferLen, ESendFlags eFlags,
JC_NET_ADDR *pstDestAddr, JC_UINT32 uiDestAddrLen,
JC_UINT32 *puiSentBytes) ;
/**
* @brief This function receives the data from the socket and stores the source address.
* @param[in] uiSocketID Specifies the socket descriptor
* @param[in] eFlags This flag is not used.
* @param[out] pucRecvBuffer Specifies the buffer which will received the data from the socket.
* @param[in] uiBufferLength Specifies the size of the pucRecvBufer.
* @param[out] puiReceivedBytes Returns the actual number of bytes received
* @param[out] pstSourceAddress Returns the information about the source address. This information is available only if this is not NULL.
* @param[in] uiSourceAddressLen Specifies the size of the pstSourceAddress.
* @retval JC_ERR_NET_CONNECT Specifies that the connection request to peer was not successful
* @retval JC_ERR_NET_RECV Specifies that the data could not be received from the socket.
* @retval JC_ERR_NET_SOCKET Specifies that there was an error in the socket
* @retval JC_ERR_NET_WOULDBLOCK Specifies that the socket is marked as non-blocking and the receive operation would block
*
* This function shall be used only for datagram sockets.
* @see jdd_NetSendTo
*/
JC_RETCODE jdd_NetRecvFrom (JC_UINT32 uiSocketID, ERecvFlags eFlags, JC_UINT8 *pucRecvBuffer,
JC_UINT32 uiBufferLength, JC_UINT32 *puiReceivedBytes,
JC_NET_ADDR *pstSourceAddress, JC_UINT32 uiSourceAddressLen) ;
/**
* @brief This function is invoked to receive the data on the connected socket.
* @param[in] uiSocketID Specifies the socket descriptor
* @param[out] pucRecvBuffer Specifies the buffer for the incoming data.
* @param[in] uiBufferSize Specifies the size of the pucRecvBuffer. The network layer should not copy more than this value to the pucRecvBuffer.
* @param[out] puiReceivedBytes Returns the number of bytes that is copied to the pucRecvBuffer.
* @param[in] eFlags Currently this is not used.
*
* @see jdd_NetSend
*/
JC_RETCODE jdd_NetRecv (JC_UINT32 uiSocketID, JC_UINT8 *pucRecvBuffer, JC_UINT32 uiBufferSize,
JC_UINT32 *puiReceivedBytes, ERecvFlags eFlags) ;
/**
* @brief This function is invoked to send the data on the connected socket.
* @param[in] uiSocketID Specifies the socket descriptor.
* @param[in] pucSendBuffer Specifies the byte stream which needs to be transmitted.
* @param[in] uiSendBufferLen Specifies the length of the content (pucSendBuffer) that needs to be transmitted.
* @param[out] puiSentBytes Returns the number of bytes that was transmitted.
*
* @retval JC_ERR_NET_CONNECT Specifies that the connection request to peer was not successful.
* @retval JC_ERR_NET_TIMEOUT Specifies that the time has expired before the network operation took place.
* @retval JC_ERR_NET_SEND Specifies that the data could not be sent on the socket.
* @retval JC_ERR_NET_SOCKET Specifies that there was an error in the socket.
* @retval JC_ERR_NET_WOULDBLOCK Specifies that the socket is marked as non-blocking and the send operation would blocked.
*
* If this function returns JC_ERR_NET_WOULDBLOCK, it needs to resend the data for transmission.
* @see jdd_NetRecv
*/
JC_RETCODE jdd_NetSend (JC_UINT32 uiSocketID, JC_UINT8 *pucSendBuffer, JC_UINT32 uiSendBufferLen,
JC_UINT32 *puiSentBytes) ;
/**
* @brief ??
*/
JC_RETCODE jdd_NetGetSockName (JC_UINT32 uiSocketID, JC_INT8 *pcIpAddress,
JC_UINT16 *puhPortNo) ;
/**
* @brief This function retrieves the host IP address from the host name.
* @param[in] pcHostName Specifies the host name, where IP address needs to be resolved.
* @param[in] pvApplicationData This flag is not used
* @param[in] ppucIpAddresses ??
* @retval JC_ERR_NET_DNS_WOULDBLOCK Specifies that DNS could not be resolved as the environment does not blocking call.
*
* When the platform does not support the blocking call interface, the network layer
* should post the result to the application task.
*/
JC_RETCODE jdd_NetGetHostByName (JC_UINT32 uiConnID, JC_INT8 *pcHostName,
void *pvApplicationData, JC_UINT8 **ppucIpAddresses) ;
/**
* @brief This function closes an existing socket.
* @param[in] uiSocketID Specifies the socket descriptor
* This function is used to release the socket descriptor so that further references
* to this socket will fail.
* @see jdd_NetSocket
*/
JC_RETCODE jdd_NetClose (JC_UINT32 uiSocketID) ;
/**
* @brief This function sets the socket option.
* @param[in] uiSocketID Specifies the socket descriptor.
* @param[in] eSocketLevel Specifies the socket level.
* @param[in] eOptName Specifies the name of the option which needs to be set.
* @param[in] pvOptValue Specifies the value which needs to be set.
* @param[in] uiOptLen Specifies the size of the pvOptValue.
*
* Specifies the different socket options for different socket level.
* For boolean option in order to enable the pvOptValue should be nonzero.
* To enable the option set the pvOptValue parameter to Zero.
* For Integer and structure options the pvOptValue hold the actual value.
*/
JC_RETCODE jdd_NetSetSockOpt (JC_UINT32 uiSocketID, ESocketLevel eSocketLevel,
EOptionName eOptName, void *pvOptValue, JC_UINT32 uiOptLen) ;
/**
* @brief This function sets the socket option.
* @param[in] uiSocketID Specifies the socket descriptor.
* @param[in] eSocketLevel Specifies the socket socket level.
* @param[in] eOptName Specifies the name of the option which needs to be get.
* @param[out] pvOptValue Specifies the option value which needs to be retrieved.
* @param[in,out] puiOptLen Specifies the size of the pvOptValue. Returns the actual size that is used.
*
*/
JC_RETCODE jdd_NetGetSockOpt (JC_UINT32 uiSocketID, ESocketLevel eSocketLevel,
EOptionName eOptName, void *pvOptValue, JC_UINT32 *puiOptLen) ;
/**
* @brief
*/
JC_RETCODE jdd_NetAbortConnection (JC_UINT32 uiSocketID) ;
/**
* @brief
*/
JC_BOOLEAN jdd_NetInetAddress (const JC_INT8 *pcIPAddress, JC_UINT32 uiConnID, JC_UINT32 *puiIP) ;
/**
* @brief
*/
JC_UINT16 jdd_NetHtons (JC_UINT16 uhVal) ;
/**
* @brief
*/
JC_UINT16 jdd_NetNtohs (JC_UINT16 uhVal) ;
/**
* @brief
*/
JC_UINT32 jdd_NetHtonl (JC_UINT32 uiVal) ;
/**
* @brief
*/
JC_UINT32 jdd_NetNtohl (JC_UINT32 uiVal) ;
JC_RETCODE jdd_NetNtoA (JC_UINT32 uiAddr, JC_UINT32 *puiSize, JC_INT8 *pcIPAddress) ;
#ifdef __cplusplus
}
#endif
#endif
/* END OF FILE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -