📄 rom400_sock.h
字号:
* \brief Removes a socket from the specified multicast group.
*
* Removes a UDP socket from the specified multicast group.
*
* \param socket_num handle for the datagram socket that will leave a multicast group
* \param address IP address of the multicast group to leave
*
* \return 0 for success, non-zero for failure.
*
* \sa #join
*/
//---------------------------------------------------------------------------
int syn_leave(int socket_num, struct sockaddr* address);
/**
* \brief Get the IPv4 configuration parameters.
*
* Get the IPv4 configuration parameters, including IP address, subnet mask,
* and gateway. The parameters are returned in a buffer in the following
* form:
* <table>
* <tr> <td> <b>Parameter</b> </td> <td> <b>Offset</b> </td> <td> <b>Length</b> </td> <td> <b>Description</b> </td> </tr>
* <tr> <td> (zero) </td> <td> 0 </td> <td> 12 </td> <td> Must be 0 </td> </tr>
* <tr> <td> IP4ADDR </td> <td> 12 </td> <td> 4 </td> <td> IP address </td> </tr>
* <tr> <td> IP4SUBNET </td> <td> 16 </td> <td> 4 </td> <td> Subnet mask </td> </tr>
* <tr> <td> IP4PREFIX </td> <td> 20 </td> <td> 1 </td> <td> Number of 1 bits in subnet mask </td> </tr>
* <tr> <td> (zero) </td> <td> 21 </td> <td> 12 </td> <td> Must be 0 </td> </tr>
* <tr> <td> IP4GATEWAY </td> <td> 33 </td> <td> 4 </td> <td> Gateway IP address </td> </tr>
* </table>
*
* IPv6 addresses are autoconfigured. To retrieve the IPv6 address, use the
* <i>#getipv6params</i> function.
*
* \param param_buffer pointer to buffer to store IP configuration data
*
* \return 0 for success, non-zero for failure
*
* \sa #setnetworkparams
* \sa #getipv6params
*/
//---------------------------------------------------------------------------
int syn_getnetworkparams(void* param_buffer);
/**
* \brief Set the IPv4 configuration parameters.
*
* Set the IPv4 configuration parameters, including IP address, subnet mask,
* and gateway. Input parameters should be formatted in the following
* form:
* <table>
* <tr> <td> <b>Parameter</b> </td> <td> <b>Offset</b> </td> <td> <b>Length</b> </td> <td> <b>Description</b> </td> </tr>
* <tr> <td> (zero) </td> <td> 0 </td> <td> 12 </td> <td> Must be 0 </td> </tr>
* <tr> <td> IP4ADDR </td> <td> 12 </td> <td> 4 </td> <td> IP address </td> </tr>
* <tr> <td> IP4SUBNET </td> <td> 16 </td> <td> 4 </td> <td> Subnet mask </td> </tr>
* <tr> <td> IP4PREFIX </td> <td> 20 </td> <td> 1 </td> <td> Number of 1 bits in subnet mask </td> </tr>
* <tr> <td> (zero) </td> <td> 21 </td> <td> 12 </td> <td> Must be 0 </td> </tr>
* <tr> <td> IP4GATEWAY </td> <td> 33 </td> <td> 4 </td> <td> Gateway IP address </td> </tr>
* </table>
*
* Use this method to give the DS80C400 a static IP address. To dynamically
* configure an IP address, use methods from the DHCP library in rom400_dhcp.h
* (IP addresses leased by the DHCP client can still be retrieved
* by calling <i>#getnetworkparams</i>).
*
* IPv6 addresses are autoconfigured. To retrieve the IPv6 address, use the
* <i>#getipv6params</i> function.
*
* \param param_buffer pointer to buffer with IP configuration data
*
* \return 0 for success, non-zero for failure
*
* \sa #getnetworkparams
* \sa #getipv6params
*/
//---------------------------------------------------------------------------
int syn_setnetworkparams(void* param_buffer);
/**
* \brief Get the IPv6 address.
*
* Gets the IPv6 address of the ethernet interface. The format for
* the buffer after this function returns is:
* <table>
* <tr> <td> <b>Parameter</b> </td> <td> <b>Offset</b> </td> <td> <b>Length</b> </td> <td> <b>Description</b> </td> </tr>
* <tr> <td> IP6ADDR </td> <td> 0 </td> <td> 16 </td> <td> IP address </td> </tr>
* <tr> <td> IP6PREFIX </td> <td> 16 </td> <td> 1 </td> <td> IP prefix length </td> </tr>
* </table>
*
* \param param_buffer pointer to buffer to store IPv6 configuration data
*
* \return 0 for success, non-zero for failure
*
* \sa #getnetworkparams
* \sa #setnetworkparams
*/
//---------------------------------------------------------------------------
int syn_getipv6params(void* param_buffer);
/**
* \brief Get the ethernet status.
*
* Returns the ethernet status byte. This is a bit-wise OR of the following
* flags:
* <table>
* <tr> <td> <b>Flag</b> </td> <td> <b>Value</b> </td> <td> <b>Description</b> </td> </tr>
* <tr> <td> ETH_STATUS_LINK </td> <td> 01h </td> <td> Ethernet link status </td> </tr>
* </table>
*
* Currently, no other flags are defined.
*
* \return Bitmapped ethernet status byte.
*/
//---------------------------------------------------------------------------
unsigned int syn_getethernetstatus(void);
/**
* \brief Get the address of the TFTP server.
*
* Returns the address of the server accessed by the TFTP functions. To
* communicate with a TFTP server, use the functions listed in rom400_tftp.h,
* the TFTP library.
*
* \param address structure to store the address of the TFTP server
*
* \return 0 for success, non-zero for failure
*
* \sa #settftpserver
*/
//---------------------------------------------------------------------------
int syn_gettftpserver(struct sockaddr* address);
/**
* \brief Set the address of the TFTP server.
*
* Set the address of the server that the TFTP functions will use.
* The <i>#settftpserver</i> function must be used if the address of
* the TFTP server is not acquired by DHCP or 1-Wire. Once the TFTP
* server's address is set, use the functions listed in rom400_tftp.h
* to begin receiving files.
*
* \param address structure to store the address of the TFTP server
*
* \return 0 for success, non-zero for failure
*
* \sa #gettftpserver
*/
//---------------------------------------------------------------------------
int syn_settftpserver(struct sockaddr* address);
/**
* \brief Get the pointer to the MAC ID storage area.
*
* Returns the pointer to the MAC ID storage area. This area will
* store the MAC ID after a successful call to <i>#setmacid</i>.
*
* \return Pointer to the 400's MAC ID (6 bytes stored at this location)
*
* \sa #setmacid
*/
//---------------------------------------------------------------------------
unsigned char* syn_getmacid(void);
/**
* \brief Stores the MAC ID into the MAC ID storage area.
*
* This is a redirected function. The DS80C400's default implementation
* of this function searches the 1-Wire for a DS2502U-E48 1-Wire chip
* which contains a MAC ID. This MAC ID is then stored into the MAC ID
* storage area, the location of which is stored in a pointer in the
* export table. Use the <i>#getmacid</i> function to return a pointer
* to the MAC ID storage area.
*
* \sa #getmacid
*/
//---------------------------------------------------------------------------
void syn_setmacid(void);
/**
* \brief Clears the parameter buffers used by the socket library.
*
* Clears buffers used to store parameters for the socket library. This
* function should be called immediately after calling the <i>#init_rom</i>
* function, and before any socket library functions are called.
*
* \sa #init_rom
*/
//---------------------------------------------------------------------------
void clear_param_buffers(void);
/**
* \brief Returns the version number of this socket library.
*
* \return Version number of this SOCK library.
*/
//---------------------------------------------------------------------------
unsigned int syn_version(void);
/**
* \brief Generate an ARP request for a given IPv4 address.
*
* Unconditionally generate an ARP request for a given IPv4 address.
* This functionality can be used to implement Zeroconf protocols.
*
* \param address structure to store the address
*
* \return 0 for success, non-zero for failure
*/
//---------------------------------------------------------------------------
int syn_arp_generaterequest(struct sockaddr* address);
/**
* \brief Generate an ARP request for a given IPv4 address and add to the ARP cache.
*
* If the given IP address is not in the ARP cache, generate an ARP request and
* add it to the cache.
*
* \param address structure to store the address
*
* \return 0 for success, non-zero for failure
*/
//---------------------------------------------------------------------------
int syn_arp_cacherequest(struct sockaddr* address);
/**
* \brief Returns the number of sockets in the wait queue for this
* listening socket.
*
* Returns the number of sockets in the queue attempting to connect to this
* server socket.
*
* \param socket_handle handle to socket to check for waiting
* connections
* \param address location where the IP and port number will be
* written
*
* \return -1 if the socket is not a streaming socket set up to listen
* 0 or greater for the number of sockets waiting
*
* The IP and port of the socket are returned in <i>address</i>.
*/
//---------------------------------------------------------------------------
int acceptqueue(int socket_handle, struct sockaddr* address);
/**
* \brief Returns whether or not data is available to be read on a
* datagram socket.
*
* Returns <b>1</b> if there is data available to be read on a UDP socket.
*
* \param socket_handle handle to socket to check for available
* datagrams
* \param address location where the IP and port number will be
* written
*
* \return -1 if the socket is not a datagram socket
* 0 if no datagram packets are available
* 1 if a datagram is available
*
* The IP and port of the socket are returned in <i>address</i>.
*/
//---------------------------------------------------------------------------
int udpavailable(int socket_handle, struct sockaddr* address);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -