Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 201

Advertising
background image

High-Speed Microcontroller User’s

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 group */

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 current

implementation does not support IPv6 multicasting.

ping

Description:

int ping(
struct sockaddr
*addr,

/* address 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 request, or ping, to a remote host

specified by addr. The packets sent by

ping have the specified time-to-live (TTL). Ping returns 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 autoconfigured). 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

IP4GATEWAY

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

Advertising