Users Guide: Network Microcontroller Supplement User Manual

High-Speed Microcontroller Users
Guide: Network Microcontroller
Supplement
201
join/leave
Descriptions: int join(
int s, /* socket to add to the multicast group */
struct sockaddr *addr, /* address of specified multicast group */
int addrlen); /* length of addr structure */
int leave(
int s, /* socket to remove from the multicast group */
struct sockaddr *addr, /* address of specified multicast gr
oup */
int addrlen); /* length of addr structure */
The join and leave functions add or remove, respectively, socket s to/from the specified multicast group. The multicast group
name is specified by the addr structure. Join and leave return a success/failure code in the accumulator. Note: The curr
ent
implementation does not support IPv6 multicasting.
ping
Description: int ping(
struct sockaddr *addr, /* addr
ess to ping */
int addrlen, /* size of addr structure */
int TTL, /* time-to-live */
unsigned char *response); /* data returned in response to ping */
The ping function pings the specified address and returns the result. It sends an ICMP echo r
equest, or ping, to a remote host
specified by addr. The packets sent by ping have the specified time-to-live (TTL). Ping retur
ns the response time and the
buffer pointed to by *response gets filled in with the returned data.
getnetworkparams/setnetworkparams
Descriptions: int setnetworkparams(
void *parameters); /* pointer to network parameters buffer */
int getnetworkparams(
void *parameters); /* pointer to network parameters buffer */
The setnetworkparams and getnetworkparams functions set/get the IPv4 address and configuration parameters. These
functions allow the user to set/get the IPv4 portion of the network configuration (Note: the IPv6 address is autoconfigur
ed). To
autoconfigure IPv4, use the DHCP functionality instead of setnetworkparams. The address configured by DHCP can be read
using getnetworkparams. Both functions return a success/failure code in the accumulator. Network parameters is a buffer
containing the following data:
PARAMETER OFFSET LENGTH DESCRIPTION
(zero) 0 12 Must be 0
IP4ADDR 12 4 IP address
IP4SUBNET 16
4 Subnet mask
IP4PREFIX 20 1 Number of 1 bits in subnet mask
(zero) 21 12 Must be 0
IP4GATEWA
Y 33 4 IP address of default gateway
INPUT PARAMETER#–DESCRIPTION OUTPUT DESCRIPTION
*parameters
Param0[0:2]–Pointer to
parameters buffer
ACC
Return value (= 0 for success)
INPUT PARAMETER#–DESCRIPTION OUTPUT DESCRIPTION
*addr
addrlen
TTL
*response
Param0[0:2]–pointer to addr
Param1[0]–size of addr structure
Param2[0]–time-to-live
Param3[0:2]–pointer to return data
ACC
Return value (= 0 for success)
INPUT PARAMETER#–DESCRIPTION OUTPUT DESCRIPTION
s
*addr
addrlen
Param0[0]–socket handle #
Param1[0:2]–pointer to addr
Param2[0]–size of addr structure
ACC Return value (= 0 for success)
Maxim Integrated