[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/blip/interfaces ICMP.nc, NONE, 1.1 ICMPPing.nc, NONE, 1.1 IP.nc, NONE, 1.1 IPAddress.nc, NONE, 1.1 IPRouting.nc, NONE, 1.1 Statistics.nc, NONE, 1.1 Tcp.nc, NONE, 1.1 UDP.nc, NONE, 1.1

sdhsdh sdhsdh at users.sourceforge.net
Mon Jan 19 16:28:18 PST 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/blip/interfaces
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6583/tos/lib/net/blip/interfaces

Added Files:
	ICMP.nc ICMPPing.nc IP.nc IPAddress.nc IPRouting.nc 
	Statistics.nc Tcp.nc UDP.nc 
Log Message:
 - initial commit of blip (berkeley low-power ip) stack


--- NEW FILE: ICMP.nc ---
/*
 * "Copyright (c) 2008 The Regents of the University  of California.
 * All rights reserved."
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */

interface ICMP {

  command uint16_t cksum(struct split_ip_msg *msg, uint8_t nxt_hdr);

  // called to start sending router solicitations
  command void sendSolicitations();

  // called when we are done sending router solicitations
  event void solicitationDone();

  command void sendAdvertisements();

  command void sendTimeExceeded(struct ip6_hdr *hdr, unpack_info_t *u_info, uint16_t amount_here);

}

--- NEW FILE: ICMPPing.nc ---

#include <ICMP.h>

interface ICMPPing {

  command error_t ping(struct in6_addr *target, uint16_t period, uint16_t n);

  event void pingReply(struct in6_addr *source, struct icmp_stats *stats);

  event void pingDone(uint16_t ping_rcv, uint16_t ping_n);

}

--- NEW FILE: IP.nc ---

interface IP {

  /*
   * sends the message with the headers and payload given.  Things
   * which we know how to compress should be part of the data passed
   * in as headers; things which we cannot compress must be passed as
   * payload.

   * the interface is this way so that the stack may insert extra
   * (routing, snooping) headers between the two sections.
   * once the call returns, the stack has no claim on the buffer
   * pointed to
   */ 
  command error_t send(struct split_ip_msg *msg);

  /*
   * indicate that the stack has finished writing data into the
   * receive buffer. 
   */
  event void recv(struct ip6_hdr *iph, void *payload, struct ip_metadata *meta);

}

--- NEW FILE: IPAddress.nc ---
/*
 * "Copyright (c) 2008 The Regents of the University  of California.
 * All rights reserved."
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
#include <6lowpan.h>

interface IPAddress {
  command hw_addr_t getShortAddr();
  command void setShortAddr(hw_addr_t newaddr);

  command struct in6_addr *getPublicAddr();
  command void getLLAddr(struct in6_addr *addr);
  command void getIPAddr(struct in6_addr *addr);

  command void setPrefix(uint8_t *prefix);

  command bool haveAddress();
}

--- NEW FILE: IPRouting.nc ---
/*
 * "Copyright (c) 2008 The Regents of the University  of California.
 * All rights reserved."
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */

/*
 *  This interface presents the interface to the IP routing engine.
 *  Related interfaces are the forwarding engine, which implements
 *     the routing decision whare are communicated by this interface, 
 *     and the ICMP interface, which deals with sending and receiving 
 *     ICMP traffic.
 *
 */

#include "IPDispatch.h"

interface IPRouting {
  /*
   * returns weather or not the node should consume a packet addressed
   * to a given address.  Interprets link-local and global addresses,
   * and manages multicast group membership.
   */
  command bool isForMe(struct ip6_hdr *a);

  /*
   * returns a policy for sending this message to someone else.
   *   the send policy includes the layer 2 address, number of retransmissions,
   *     and spacing between them.
   *
   */ 
  command error_t getNextHop(struct ip6_hdr *hdr, 
                             struct source_header *sh,
                             hw_addr_t prev_hop,
                             send_policy_t *ret);


  /*
   * returns the currently configured default IP hop limit.
   *
   */
  command uint8_t getHopLimit();

  command uint16_t getQuality();

  /*
   * 
   *
   */
  command void reportAdvertisement(hw_addr_t neigh, uint8_t hops, 
                                             uint8_t lqi, uint16_t cost);

  /*
   * informs the router of a reception from a neighbor, along with the 
   *  the rssi of the received packet.
   *
   */
  command void reportReception(hw_addr_t neigh, uint8_t lqi);

  /*
   * the result of sending to a neighbor.
   */
  command void reportTransmission(send_policy_t *send);

  /*
   * @returns TRUE if the routing engine has established a default route.
   */
  command bool hasRoute();

  command void insertRoutingHeaders(struct split_ip_msg *msg);
  
#ifdef CENTRALIZED_ROUTING
  command error_t installFlowEntry(struct rinstall_header* rih, bool isMine);

  command void clearFlows();
#endif

}

--- NEW FILE: Statistics.nc ---
/*
 * "Copyright (c) 2008 The Regents of the University  of California.
 * All rights reserved."
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */


interface Statistics <stat_str> {
  
  /*
   * Fills the given structure with the requested statistics.
   */
  command void get(stat_str *stats);

  /*
   * Reset whatever statistics are being collected.
   */
  command void clear();

}

--- NEW FILE: Tcp.nc ---


interface Tcp { 

  /*
   * Bind the socket to a local address
   */
  command error_t bind(uint16_t port);

  /*
   * Accept an incomming connection.
   */
  event bool accept(struct sockaddr_in6 *from, 
                    void **rx_buf, int *rx_buf_len,
                    void **tx_buf, int *tx_buf_len);

  /*
   * Split-phase connect: connect to a remote endpoint.
   *
   * The socket should not be used until connectDone is signaled.
   */
  command error_t connect(struct sockaddr_in6 *dest,
                          void *rx_buf, int rx_buf_len,
                          void *tx_buf, int tx_buf_len);
  event void connectDone(error_t e);

  /*
   * Send and receive data on a socket.  The socket must be CONNECTed
   * for these to succeed.
   */
  command error_t send(void *payload, uint16_t len);

  event void recv(void *payload, uint16_t len);

  /*
   * terminate a connection.
   */
  command error_t close();

  /*
   * notify the app that the socket connection has been closed or
   * reset by the other end, or else a timeout has occured and the
   * local side has given up.
   */
  event void closed(error_t e);
}

--- NEW FILE: UDP.nc ---

interface UDP {
  /*
   * bind a local address.  to cut down memory requirements and handle the
   * common case well, you can only bind a port; all local interfaces are
   * implicitly bound.  the port should be passed in host byte-order (is 
   * this confusing?  
   */       

  command error_t bind(uint16_t port);

  /*
   * send a payload to the socket address indicated
   * once the call returns, the stack has no claim on the buffer pointed to
   */ 
  command error_t sendto(struct sockaddr_in6 *dest, void *payload, 
                         uint16_t len);

  /*
   * indicate that the stack has finished writing data into the
   * receive buffer.  if error is not SUCCESS, the payload does not
   * contain valid data and the src pointer should not be used.
   */
  event void recvfrom(struct sockaddr_in6 *src, void *payload, 
                      uint16_t len, struct ip_metadata *meta);

}



More information about the Tinyos-2-commits mailing list