SunSPOT API V6.0


com.sun.spot.ipv6
Class IP

java.lang.Object
  extended by com.sun.spot.resources.Resource
      extended by com.sun.spot.service.BasicService
          extended by com.sun.spot.ipv6.IP
All Implemented Interfaces:
IResource, IService

public class IP
extends BasicService

The main IP stack class

Author:
Pete St. Pierre

Field Summary
static byte[] ALL_NODES
           
static byte[] ALL_ROUTERS
           
static byte HEADER_ICMP4
           
static byte HEADER_ICMP6
           
static byte HEADER_TCP
           
static byte HEADER_UDP
           
static byte[] UNSPECIFIED
           
 
Fields inherited from interface com.sun.spot.service.IService
PAUSED, PAUSING, READY, RESUMING, RUNNING, STARTING, STOPPED, STOPPING
 
Method Summary
 void addAddress(byte[] address)
           
 void addLocalRoute(byte[] dest, int prefixlen, byte[] me, IIPNetworkInterface iface)
           
 void deregisterInterface(IIPNetworkInterface iface)
           
protected  void dumpRoutingTable()
          A method that asks IP to dump the active IPv6 routing table.
protected  void dumpState()
           
protected  int generateFlowLabel()
          Generates a value suitable for use as a flow label
 IIPNetworkInterface getDefaultInterface()
           
static IP getInstance()
          Return this IP stack singleton
 IIPNetworkInterface getInterface(String name)
           
 byte[] getMyAddress()
          Returns a global IPv6 address for this object.
static short getRouteMSS(byte[] remote_ip)
           
 String getServiceName()
          Return the name of this service
 Timer getTimer()
           
 boolean isRouter()
           
 boolean isRunning()
          Return whether the service is currently running.
 boolean isStopped()
           
static void main(String[] args)
          This main() is invoked by the system startup if the appropriate manifest property is set.
 void processIncomingPacket(IPv6Packet psix, IIPNetworkInterface inface)
          Process incoming packets that the IPNetworkInterface layer underneath believes to be IPv6
 void registerInterface(IIPNetworkInterface iface, boolean d)
           
 void send(IPv6Packet p)
          The method is used by higher level protocols to send a properly constructed IPv6 packet.
 boolean start()
          Start the service, and return whether successful.
 
Methods inherited from class com.sun.spot.service.BasicService
getEnabled, getStatus, pause, resume, setEnabled, setServiceName, stop
 
Methods inherited from class com.sun.spot.resources.Resource
addTag, getTags, getTagValue, hasTag, removeTag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

Field Detail

ALL_NODES

public static final byte[] ALL_NODES

ALL_ROUTERS

public static final byte[] ALL_ROUTERS

UNSPECIFIED

public static final byte[] UNSPECIFIED

HEADER_ICMP4

public static final byte HEADER_ICMP4
See Also:
Constant Field Values

HEADER_TCP

public static final byte HEADER_TCP
See Also:
Constant Field Values

HEADER_UDP

public static final byte HEADER_UDP
See Also:
Constant Field Values

HEADER_ICMP6

public static final byte HEADER_ICMP6
See Also:
Constant Field Values
Method Detail

start

public boolean start()
Description copied from interface: IService
Start the service, and return whether successful.

Specified by:
start in interface IService
Overrides:
start in class BasicService
Returns:
true if the service was successfully started

isRunning

public boolean isRunning()
Description copied from interface: IService
Return whether the service is currently running.

Specified by:
isRunning in interface IService
Overrides:
isRunning in class BasicService
Returns:
true if the service is currently running

isStopped

public boolean isStopped()

isRouter

public boolean isRouter()

getInstance

public static IP getInstance()
Return this IP stack singleton

Returns:
the IP stack singleton

getTimer

public Timer getTimer()

deregisterInterface

public void deregisterInterface(IIPNetworkInterface iface)

registerInterface

public void registerInterface(IIPNetworkInterface iface,
                              boolean d)

getDefaultInterface

public IIPNetworkInterface getDefaultInterface()

getInterface

public IIPNetworkInterface getInterface(String name)

addAddress

public void addAddress(byte[] address)

addLocalRoute

public void addLocalRoute(byte[] dest,
                          int prefixlen,
                          byte[] me,
                          IIPNetworkInterface iface)

getServiceName

public String getServiceName()
Return the name of this service

Specified by:
getServiceName in interface IService
Specified by:
getServiceName in class BasicService
Returns:
the name of the UDP service

getRouteMSS

public static short getRouteMSS(byte[] remote_ip)
Parameters:
remote_ip - a destination IP address
Returns:
the Max Segment Size of packets routed to this destination

getMyAddress

public byte[] getMyAddress()
Returns a global IPv6 address for this object. If the node has multiple global addresses, there is no guarantee which one is returned.

Returns:
A globally accessible IPv6 address for this node if one exists

generateFlowLabel

protected int generateFlowLabel()
Generates a value suitable for use as a flow label

Returns:
a random value to use as a flow label

send

public void send(IPv6Packet p)
          throws NoRouteToHostException,
                 NetworkException
The method is used by higher level protocols to send a properly constructed IPv6 packet. The method chooses the appropriate interface (if there is more than one) formats the packet with any lower level required fields - and hands it off. This should only be used to send packets generated by the local IP stack. Routed packets should use routePacket().

Parameters:
p - a properly formated IPv6 packet
Throws:
NoRouteException
NoRouteToHostException
NetworkException

processIncomingPacket

public void processIncomingPacket(IPv6Packet psix,
                                  IIPNetworkInterface inface)
Process incoming packets that the IPNetworkInterface layer underneath believes to be IPv6

Parameters:
psix - An IPv6 Packet
inface - The interface object on which the packet arrived

dumpRoutingTable

protected void dumpRoutingTable()
A method that asks IP to dump the active IPv6 routing table.


dumpState

protected void dumpState()

main

public static void main(String[] args)
This main() is invoked by the system startup if the appropriate manifest property is set.

Parameters:
args - Standard startup arguments.

SunSPOT API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.