network.h File Reference

Network system defines. More...

Go to the source code of this file.


Defines

#define IP_ADDRESS(a, b, c, d)   ( ( (int)a << 24 ) + ( (int)b << 16 ) + ( (int)c << 8 ) + (int)d )
 Generate an address appropriate for Socket functions from 4 integers.

Functions

int Network_SetActive (int active)
 Sets whether the Network subsystem is active.
int Network_GetActive (void)
 Returns the active state of the Network subsystem.
int Network_SetAddress (int a0, int a1, int a2, int a3)
 Set the IP address of the Make Controller.
int Network_SetMask (int a0, int a1, int a2, int a3)
 Set the network mask of the Make Controller on your local network.
int Network_SetGateway (int a0, int a1, int a2, int a3)
 Set the gateway address for the local network the Make Controller is on.
int Network_SetValid (int v)
 Create a checksum for the current address settings and store it in EEPROM.
int Network_GetAddress (int *a0, int *a1, int *a2, int *a3)
 Read the board's current IP address.
int Network_GetMask (int *a0, int *a1, int *a2, int *a3)
 Read the board's current network mask.
int Network_GetGateway (int *a0, int *a1, int *a2, int *a3)
 Read the board's current gateway address.
int Network_GetValid (void)
 Read the checksum for address settings in EEPROM, and determine if it matches the current settings.
void * Socket (int address, int port)
 Create a new TCP socket connected to the address and port specified.
int SocketBytesAvailable (void *socket)
 Get the number of bytes available in a TCP socket.
int SocketRead (void *socket, char *data, int length)
 Read from a TCP socket.
int SocketReadLine (void *socket, char *data, int length)
 Read a line from a TCP socket terminated by CR LF (0x0D 0x0A).
int SocketWrite (void *socket, char *data, int length)
 Write to a TCP socket.
void SocketClose (void *socket)
 Close an existing TCP socket.
void * ServerSocket (int port)
 Create a new TCP server socket and start listening for connections.
void * ServerSocketAccept (void *serverSocket)
 Accept an incoming connection to a ServerSocket that you have created.
int ServerSocketClose (void *serverSocket)
 Close a ServerSocket that you have created.
void * DatagramSocket (int port)
 Create a socket to read and write UDP packets.
int DatagramSocketSend (void *datagramSocket, int address, int port, void *data, int length)
 Send a UDP packet to a specified address.
int DatagramSocketReceive (void *datagramSocket, int receivingPort, int *address, int *port, void *data, int length)
 Receive a UDP packet.
void DatagramSocketClose (void *socket)
 Close a DatagramSocket().
void Network_SetDhcpEnabled (int enabled)
 Set whether DHCP is enabled.
int Network_GetDhcpEnabled (void)
 Read whether DHCP is currently enabled.
int Network_DnsGetHostByName (const char *name)
 Resolve the IP address for a given host name.

Detailed Description

Network system defines.

Definition in file network.h.


Function Documentation

int Network_GetValid ( void   ) 

Read the checksum for address settings in EEPROM, and determine if it matches the current settings.

Returns:
An integer specifying the validity of the settings - 1 (valid) or 0 (invalid).

Definition at line 1053 of file network.c.

int Network_SetValid ( int  v  ) 

Create a checksum for the current address settings and store it in EEPROM.

This should be called each time an address setting is changed so that if the board gets powered down, it will know when it comes back up whether or not the address settings is currently has are valid.

Parameters:
v An integer specifying whether to validate the current settings (1) or to force them to be invalidated (0). Passing in 0 returns the address settings to their factory defaults.
Returns:
0 on success.

Definition at line 1009 of file network.c.