Contiki-NG
Loading...
Searching...
No Matches
uIP: the IPv6 stack

The low-power IPv6 stack More...

Topics

 A simple UDP API
 
 
 Architecture specific uIP functions
 
 
 Configuration options for uIP
 
 
 IPv6 Multicast Forwarding
 
 
 Protosockets library
 
 
 Sicslowpan
 
 
 The Contiki/uIP interface
 
 
 Variables used in uIP device drivers
 
 
 uIP address manipulation library
 
 
 uIP application functions
 
 
 uIP configuration functions
 
 
 uIP conversion functions
 
 
 uIP device driver functions
 
 
 uIP hostname resolver functions
 
 
 uIP initialization functions
 
 

Files

file  uip-ds6-nbr.c
 IPv6 Neighbor cache (link-layer/IPv6 address mapping)
 
file  uip-ds6-nbr.h
 IPv6 Neighbor cache (link-layer/IPv6 address mapping)
 
file  uip-ds6-route.c
 Routing table manipulation.
 
file  uip-ds6-route.h
 Header file for routing table manipulation.
 
file  uip-ds6.c
 IPv6 data structure manipulation.
 
file  uip-ds6.h
 Header file for IPv6-related data structures.
 
file  uip-icmp6.c
 ICMPv6 (RFC 4443) implementation, with message and error handling.
 
file  uip-icmp6.h
 Header file for ICMPv6 message and error handing (RFC 4443)
 
file  uip-nameserver.c
 uIP Name Server interface
 
file  uip-nameserver.h
 uIP Name Server interface
 
file  uip-nd6.c
 Neighbor discovery (RFC 4861)
 
file  uip-nd6.h
 Header file for IPv6 Neighbor discovery (RFC 4861)
 
file  uip-sr.c
 Source routing support.
 
file  uip-sr.h
 Source routing support.
 
file  uip.h
 Header file for the uIP TCP/IP stack.
 
file  uip6.c
 The uIP TCP/IPv6 stack code.
 
file  rpl-nbr-policy.c
 Default RPL NBR policy decides when to add a new discovered node to the nbr table from RPL.
 

Data Structures

struct  uip_ds6_nbr
 The default nbr_table entry (when UIP_DS6_NBR_MULTI_IPV6_ADDRS is disabled), that implements nbr cache. More...
 
struct  uip_ds6_route_neighbor_routes
 The neighbor routes hold a list of routing table entries that are attached to a specific neihbor. More...
 
struct  uip_ds6_route
 An entry in the routing table. More...
 
struct  uip_ds6_route_neighbor_route
 A neighbor route list entry, used on the uip_ds6_route->neighbor_routes->route_list list. More...
 
struct  uip_ds6_defrt
 An entry in the default router list. More...
 
struct  uip_ds6_prefix
 A prefix list entry. More...
 
struct  uip_ds6_addr
 Unicast address structure. More...
 
struct  uip_ds6_aaddr
 Anycast address
More...
 
struct  uip_ds6_maddr
 A multicast address. More...
 
struct  uip_ds6_netif
 Interface structure (contains all the interface variables) More...
 
struct  uip_ds6_element
 Generic type for a DS6, to use a common loop though all DS. More...
 
struct  uip_icmp6_error
 ICMPv6 Error message constant part. More...
 
struct  uip_nd6_ns
 A neighbor solicitation constant part. More...
 
struct  uip_nd6_na
 A neighbor advertisement constant part. More...
 
struct  uip_nd6_rs
 A router solicitation constant part. More...
 
struct  uip_nd6_ra
 A router advertisement constant part. More...
 
struct  uip_nd6_redirect
 A redirect message constant part. More...
 
struct  uip_nd6_opt_hdr
 ND option header. More...
 
struct  uip_nd6_opt_prefix_info
 ND option prefix information. More...
 
struct  uip_nd6_opt_mtu
 ND option MTU. More...
 
struct  uip_nd6_opt_dns
 ND option RDNSS. More...
 
struct  uip_sr_node
 A node in a source routing graph, stored at the root and representing all child-parent relationship. More...
 
union  uip_ip4addr_t
 Representation of an IP address. More...
 
struct  uip_802154_shortaddr
 16 bit 802.15.4 address More...
 
struct  uip_802154_longaddr
 64 bit 802.15.4 address More...
 
struct  uip_80211_addr
 802.11 address More...
 
struct  uip_eth_addr
 802.3 address More...
 
struct  uip_conn
 Representation of a uIP TCP connection. More...
 
struct  uip_udp_conn
 Representation of a uIP UDP connection. More...
 
struct  uip_stats
 The structure holding the TCP/IP statistics that are gathered if UIP_STATISTICS is set to 1. More...
 
struct  uip_eth_hdr
 The Ethernet header. More...
 

Macros

#define NBR_INCOMPLETE   0
 Possible states for the nbr cache entries.
 
#define UIP_DS6_NBR_MULTI_IPV6_ADDRS   0
 Set non-zero (1) to enable multiple IPv6 addresses to be associated with a link-layer address.
 
#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR   2
 Set the maximum number of IPv6 addresses per link-layer address.
 
#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES    (NBR_TABLE_MAX_NEIGHBORS * UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)
 Set the maximum number of neighbor cache entries.
 
#define UIP_DS6_ROUTE_STATE_TYPE   rpl_route_entry_t
 define some additional RPL related route state and neighbor callback for RPL - if not a DS6_ROUTE_STATE is already set
 
#define UIP_DS6_DEFRT_NBS   0
 Configuration.
 
#define ADDR_TENTATIVE   0
 Possible states for the an address (RFC 4862)
 
#define ADDR_ANYTYPE   0
 How the address was acquired: Autoconf, DHCP or manually.
 
#define UIP_DS6_PERIOD   (60 * CLOCK_SECOND)
 General DS6 definitions.
 
#define UIP_ICMP6_ECHO_REQUEST_LEN   4
 Echo Request constant part length.
 
#define UIP_ICMP6_ERROR_LEN   4
 ICMPv6 Error message constant part length.
 
#define DNS_EXPIRATION(r)
 Expiration time in seconds.
 
#define ND6_OPT(opt)   ((unsigned char *)(UIP_ICMP_PAYLOAD + (opt)))
 Pointer to ND option.
 
#define UIP_ND6_DEF_MAXDADNS   UIP_ND6_SEND_NS
 Do not try DAD when using EUI-64 as allowed by draft-ietf-6lowpan-nd-15 section 8.2.
 
#define UIP_IP_BUF   ((struct uip_ip_hdr *)uip_buf)
 Direct access to IPv6 header.
 
#define UIP_ICMP_BUF   ((struct uip_icmp_hdr *)UIP_IP_PAYLOAD(uip_ext_len))
 Direct access to ICMP, UDP, and TCP headers and payload, with implicit ext header offset (global uip_ext_len)
 
#define UIP_LLADDR_LEN   LINKADDR_SIZE
 802.15.4 address
 
#define UIP_STAT(s)
 The uIP TCP/IP statistics.
 
#define UIP_APPDATA_SIZE
 The buffer size available for user data in the uip_buf buffer.
 
#define UIP_LLPREF_LEN   10
 Length of the link local prefix.
 
#define uip_is_addr_loopback(a)
 Is IPv6 address a the unspecified address a is of type uip_ipaddr_t.
 
#define uip_is_addr_unspecified(a)
 Is IPv6 address a the unspecified address a is of type uip_ipaddr_t.
 
#define uip_is_addr_linklocal_allnodes_mcast(a)
 Is IPv6 address a the link local all-nodes multicast address.
 
#define uip_is_addr_linklocal_allrouters_mcast(a)
 Is IPv6 address a the link local all-routers multicast address.
 
#define uip_is_addr_linklocal(a)
 is addr (a) a link local unicast address, see RFC 4291 i.e.
 
#define uip_create_unspecified(a)   uip_ip6addr(a, 0, 0, 0, 0, 0, 0, 0, 0)
 set IP address a to unspecified
 
#define uip_create_linklocal_allnodes_mcast(a)   uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001)
 set IP address a to the link local all-nodes multicast address
 
#define uip_create_linklocal_allrouters_mcast(a)   uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002)
 set IP address a to the link local all-routers multicast address
 
#define uip_is_addr_solicited_node(a)
 is addr (a) a solicited node multicast address, see RFC 4291 a is of type uip_ipaddr_t*
 
#define uip_create_solicited_node(a, b)
 put in b the solicited node address corresponding to address a both a and b are of type uip_ipaddr_t*
 
#define uip_is_addr_mac_addr_based(a, m)
 was addr (a) forged based on the mac address m a type is uip_ipaddr_t m type is uiplladdr_t
 
#define uip_is_addr_mcast(a)    (((a)->u8[0]) == 0xFF)
 is address a multicast address, see RFC 4291 a is of type uip_ipaddr_t*
 
#define uip_is_addr_mcast_global(a)
 is address a global multicast address (FFxE::/16), a is of type uip_ip6addr_t*
 
#define uip_is_addr_mcast_non_routable(a)
 is address a non-routable multicast address.
 
#define uip_is_addr_mcast_routable(a)
 is address a routable multicast address.
 
#define uip_is_mcast_group_id_all_nodes(a)
 is group-id of multicast address a the all nodes group-id
 
#define uip_is_mcast_group_id_all_routers(a)
 is group-id of multicast address a the all routers group-id
 
#define uip_are_solicited_bytes_equal(a, b)
 are last three bytes of both addresses equal? This is used to compare solicited node multicast addresses
 

Typedefs

typedef struct uip_ds6_nbr uip_ds6_nbr_t
 The default nbr_table entry (when UIP_DS6_NBR_MULTI_IPV6_ADDRS is disabled), that implements nbr cache.
 
typedef struct uip_ds6_route uip_ds6_route_t
 An entry in the routing table.
 
typedef struct uip_ds6_defrt uip_ds6_defrt_t
 An entry in the default router list.
 
typedef struct uip_ds6_prefix uip_ds6_prefix_t
 A prefix list entry.
 
typedef struct uip_ds6_addr uip_ds6_addr_t
 Unicast address structure.
 
typedef struct uip_ds6_aaddr uip_ds6_aaddr_t
 Anycast address

 
typedef struct uip_ds6_maddr uip_ds6_maddr_t
 A multicast address.
 
typedef struct uip_ds6_netif uip_ds6_netif_t
 Interface structure (contains all the interface variables)
 
typedef struct uip_ds6_element uip_ds6_element_t
 Generic type for a DS6, to use a common loop though all DS.
 
typedef struct uip_icmp6_error uip_icmp6_error
 ICMPv6 Error message constant part.
 
typedef struct uip_nameserver_record uip_nameserver_record
 Nameserver record.
 
typedef struct uip_sr_node uip_sr_node_t
 A node in a source routing graph, stored at the root and representing all child-parent relationship.
 
typedef union uip_ip4addr_t uip_ip4addr_t
 Representation of an IP address.
 
typedef struct uip_802154_shortaddr uip_802154_shortaddr
 16 bit 802.15.4 address
 
typedef struct uip_802154_longaddr uip_802154_longaddr
 64 bit 802.15.4 address
 
typedef struct uip_80211_addr uip_80211_addr
 802.11 address
 
typedef struct uip_eth_addr uip_eth_addr
 802.3 address
 

Functions

uip_ds6_nbr_tuip_ds6_nbr_add (const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr, uint8_t isrouter, uint8_t state, nbr_table_reason_t reason, void *data)
 Add a neighbor cache for a specified IPv6 address, which is associated with a specified link-layer address.
 
int uip_ds6_nbr_rm (uip_ds6_nbr_t *nbr)
 Remove a neighbor cache.
 
int uip_ds6_nbr_update_ll (uip_ds6_nbr_t **nbr, const uip_lladdr_t *new_ll_addr)
 Update the link-layer address associated with an IPv6 address.
 
const uip_ipaddr_t * uip_ds6_nbr_get_ipaddr (const uip_ds6_nbr_t *nbr)
 Get an IPv6 address of a neighbor cache.
 
const uip_lladdr_t * uip_ds6_nbr_get_ll (const uip_ds6_nbr_t *nbr)
 Get the link-layer address associated with a specified nbr cache.
 
int uip_ds6_nbr_num (void)
 Return the number of neighbor caches.
 
uip_ds6_nbr_tuip_ds6_nbr_head (void)
 Get the first neighbor cache in nbr_table.
 
uip_ds6_nbr_tuip_ds6_nbr_next (uip_ds6_nbr_t *nbr)
 Get the next neighbor cache of a specified one.
 
uip_ds6_nbr_tuip_ds6_nbr_lookup (const uip_ipaddr_t *ipaddr)
 Get the neighbor cache associated with a specified IPv6 address.
 
uip_ds6_nbr_tuip_ds6_nbr_ll_lookup (const uip_lladdr_t *lladdr)
 Get the neighbor cache associated with a specified link-layer address.
 
uip_ipaddr_t * uip_ds6_nbr_ipaddr_from_lladdr (const uip_lladdr_t *lladdr)
 Get an IPv6 address associated with a specified link-layer address.
 
const uip_lladdr_t * uip_ds6_nbr_lladdr_from_ipaddr (const uip_ipaddr_t *ipaddr)
 Get the link-layer address associated with a specified IPv6 address.
 
void uip_ds6_link_callback (int status, int numtx)
 The callback function to update link-layer stats in a neighbor cache.
 
void uip_ds6_neighbor_periodic (void)
 The housekeeping function called periodically.
 
const uip_ip6addr_t * uip_ds6_default_prefix ()
 Retrieve the Default IPv6 prefix.
 
void uip_ds6_set_default_prefix (const uip_ip6addr_t *prefix)
 Set the Default IPv6 prefix.
 
void uip_ds6_init (void)
 Initialize data structures.
 
void uip_ds6_periodic (void)
 Periodic processing of data structures.
 
uint8_t uip_ds6_list_loop (uip_ds6_element_t *list, uint8_t size, uint16_t elementsize, uip_ipaddr_t *ipaddr, uint8_t ipaddrlen, uip_ds6_element_t **out_element)
 Generic loop routine on an abstract data structure, which generalizes all data structures used in DS6.
 
uip_ds6_addr_tuip_ds6_addr_add (uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type)
 Add a unicast address to the interface.
 
void uip_ds6_select_src (uip_ipaddr_t *src, uip_ipaddr_t *dst)
 Source address selection, see RFC 3484.
 
void uip_ds6_set_addr_iid (uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr)
 set the last 64 bits of an IP address based on the MAC address
 
void uip_ds6_set_lladdr_from_iid (uip_lladdr_t *lladdr, const uip_ipaddr_t *ipaddr)
 Build a link-layer address from an IPv6 address based on its UUID64.
 
uint8_t get_match_length (uip_ipaddr_t *src, uip_ipaddr_t *dst)
 Get the number of matching bits of two addresses.
 
void uip_ds6_dad (uip_ds6_addr_t *addr)
 Perform Duplicate Address Selection on one address.
 
int uip_ds6_dad_failed (uip_ds6_addr_t *addr)
 Callback when DAD failed.
 
void uip_ds6_send_rs (void)
 Send periodic RS to find router.
 
uint32_t uip_ds6_compute_reachable_time (void)
 Compute the reachable time based on base reachable time, see RFC 4861.
 
int uip_sr_num_nodes (void)
 Tells how many nodes are currently stored in the graph.
 
uip_sr_node_tuip_sr_get_node (const void *graph, const uip_ipaddr_t *addr)
 Looks up for a source routing node from its IPv6 global address.
 
int uip_sr_is_addr_reachable (const void *graph, const uip_ipaddr_t *addr)
 Telle whether an address is reachable, i.e.
 
void uip_sr_expire_parent (const void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent)
 Expires a given child-parent link.
 
uip_sr_node_tuip_sr_update_node (void *graph, const uip_ipaddr_t *child, const uip_ipaddr_t *parent, uint32_t lifetime)
 Updates a child-parent link.
 
void uip_sr_init (void)
 Initialize this module.
 
uip_sr_node_tuip_sr_node_head (void)
 Returns the head of the non-storing node list.
 
uip_sr_node_tuip_sr_node_next (const uip_sr_node_t *item)
 Returns the next element of the non-storing node list.
 
void uip_sr_periodic (unsigned seconds)
 A function called periodically.
 
void uip_sr_free_all (void)
 Deallocate all neighbors.
 
int uip_sr_link_snprint (char *buf, int buflen, const uip_sr_node_t *link)
 Print a textual description of a source routing link.
 
uint16_t uip_chksum (uint16_t *data, uint16_t len)
 Calculate the Internet checksum over a buffer.
 
uint16_t uip_ipchksum (void)
 Calculate the IP header checksum of the packet header in uip_buf.
 
uint16_t uip_tcpchksum (void)
 Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
 
uint16_t uip_udpchksum (void)
 Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
 
uint16_t uip_icmp6chksum (void)
 Calculate the ICMP checksum of the packet in uip_buf.
 
bool uip_remove_ext_hdr (void)
 Removes all IPv6 extension headers from uip_buf, updates length fields (uip_len and uip_ext_len)
 
void uip_add32 (uint8_t *op32, uint16_t op16)
 Carry out a 32-bit addition.
 
void uip_init (void)
 uIP initialization function.
 
struct uip_udp_connuip_udp_new (const uip_ipaddr_t *ripaddr, uint16_t rport)
 Set up a new UDP connection.
 
void uip_unlisten (uint16_t port)
 Stop listening to the specified port.
 
void uip_listen (uint16_t port)
 Start listening to the specified port.
 
void uip_reass_over (void)
 Abandon the reassembly of the current packet.
 
static uint8_t ext_hdr_options_process (uint8_t *ext_buf)
 Process the options in Destination and Hop By Hop extension headers.
 
uint16_t uip_htons (uint16_t val)
 Convert a 16-bit quantity from host byte order to network byte order.
 
void uip_send (const void *data, int len)
 Send data on the current connection.
 
void uiplib_ipaddr_print (const uip_ipaddr_t *addr)
 Print an IP address using printf().
 
int uiplib_ipaddr_snprint (char *buffer, size_t size, const uip_ipaddr_t *addr)
 Write at most size - 1 characters of the IP address to the output string.
 
int rpl_has_joined (void)
 Tells whether the node has joined a network or not.
 
int rpl_has_downward_route (void)
 Get the RPL's best guess on if we have downward route or not.
 
enum rpl_mode rpl_get_mode (void)
 Get the RPL mode.
 
enum rpl_mode rpl_set_mode (enum rpl_mode m)
 Set the RPL mode.
 
void rpl_link_callback (const linkaddr_t *addr, int status, int numtx)
 Called by lower layers after every packet transmission.
 
uint8_t rpl_is_in_leaf_mode (void)
 Tells whether the protocol is in leaf mode.
 

Variables

struct etimer uip_ds6_timer_periodic
 Timer for maintenance of data structures.
 
struct etimer uip_ds6_timer_rs
 RS timer, to schedule RS sending.
 
static uint8_t rscount
 number of rs already sent
 
uip_ds6_netif_t uip_ds6_if
 The single interface.
 
struct etimer uip_ds6_timer_periodic
 Timer for maintenance of data structures.
 
struct etimer uip_ds6_timer_rs
 RS timer, to schedule RS sending.
 
static uip_ipaddr_t tmp_ipaddr
 temporary IP address
 
void * uip_appdata
 Pointer to the application data in the packet buffer.
 
struct uip_conn * uip_conn
 Pointer to the current TCP connection.
 
struct uip_udp_conn * uip_udp_conn
 The current UDP connection.
 
struct uip_icmp6_conn uip_icmp6_conns
 single possible icmpv6 "connection"
 
uip_lladdr_t uip_lladdr
 Host L2 address.
 
struct etimer uip_reass_timer
 Timer for reassembly.
 

ICMPv6 RFC4443 Message processing and sending

uint8_t uip_icmp6_input (uint8_t type, uint8_t icode)
 Handle an incoming ICMPv6 message.
 
void uip_icmp6_register_input_handler (uip_icmp6_input_handler_t *handler)
 Register a handler which can handle a specific ICMPv6 message type.
 
void uip_icmp6_error_output (uint8_t type, uint8_t code, uint32_t param)
 Send an icmpv6 error message.
 
void uip_icmp6_send (const uip_ipaddr_t *dest, int type, int code, int payload_len)
 Send an icmpv6 message.
 
void uip_icmp6_echo_reply_callback_add (struct uip_icmp6_echo_reply_notification *n, uip_icmp6_echo_reply_callback_t c)
 Add a callback function for ping replies.
 
void uip_icmp6_echo_reply_callback_rm (struct uip_icmp6_echo_reply_notification *n)
 Remove a callback function for ping replies.
 
void uip_icmp6_init (void)
 Initialise the uIP ICMPv6 core.
 

ND message structures

typedef struct uip_nd6_ns uip_nd6_ns
 A neighbor solicitation constant part.
 
typedef struct uip_nd6_na uip_nd6_na
 A neighbor advertisement constant part.
 
typedef struct uip_nd6_rs uip_nd6_rs
 A router solicitation constant part.
 
typedef struct uip_nd6_ra uip_nd6_ra
 A router advertisement constant part.
 
typedef struct uip_nd6_redirect uip_nd6_redirect
 A redirect message constant part.
 

ND Option structures

typedef struct uip_nd6_opt_hdr uip_nd6_opt_hdr
 ND option header.
 
typedef struct uip_nd6_opt_prefix_info uip_nd6_opt_prefix_info
 ND option prefix information.
 
typedef struct uip_nd6_opt_mtu uip_nd6_opt_mtu
 ND option MTU.
 
typedef struct uip_nd6_opt_dns uip_nd6_opt_dns
 ND option RDNSS.
 

"DS6" Data structures

uip_ds6_netif_t uip_ds6_if
 The single interface.
 
uip_ds6_prefix_t uip_ds6_prefix_list [UIP_DS6_PREFIX_NB]
 Prefix list.
 

Layer 2 variables

uip_lladdr_t uip_lladdr = {{0x00,0x06,0x98,0x00,0x02,0x32}}
 Host L2 address.
 

Layer 3 variables

uint8_t uip_ext_bitmap = 0
 bitmap we use to record which IPv6 headers we have already seen
 
uint16_t uip_ext_len = 0
 Total length of all IPv6 extension headers.
 
uint8_t uip_last_proto = 0
 The final protocol after IPv6 extension headers: UIP_PROTO_TCP, UIP_PROTO_UDP or UIP_PROTO_ICMP6.
 

Buffer variables

uip_buf_t uip_aligned_buf
 Packet buffer for incoming and outgoing packets.
 
void * uip_appdata
 Pointer to the application data in the packet buffer.
 
uint16_t uip_len
 The length of the packet in the uip_buf buffer.
 

General variables

struct uip_conn * uip_conn
 Pointer to the current TCP connection.
 

TCP variables

uint8_t uip_acc32 [4]
 4-byte array used for the 32-bit sequence number calculations.
 

UDP variables

struct uip_udp_conn * uip_udp_conn
 The current UDP connection.
 

ICMPv6 variables

struct uip_icmp6_conn uip_icmp6_conns
 single possible icmpv6 "connection"
 

Nameserver maintenance

void uip_nameserver_update (const uip_ipaddr_t *nameserver, uint32_t lifetime)
 Initialize the module variables.
 
uip_ipaddr_t * uip_nameserver_get (uint8_t num)
 Get a Nameserver ip address given in RA.
 
uint32_t uip_nameserver_next_expiration (void)
 Get next expiration time.
 
uint16_t uip_nameserver_count (void)
 Get the number of recorded name servers.
 

ND Messages Processing and Generation

void uip_nd6_ns_output (const uip_ipaddr_t *src, const uip_ipaddr_t *dest, uip_ipaddr_t *tgt)
 Send a neighbor solicitation, send a Neighbor Advertisement.
 
void uip_nd6_rs_output (void)
 Send a Router Solicitation.
 
void uip_nd6_init (void)
 Initialise the uIP ND core.
 

ICMPv6 message types

#define ICMP6_DST_UNREACH   1
 dest unreachable
 
#define ICMP6_PACKET_TOO_BIG   2
 packet too big
 
#define ICMP6_TIME_EXCEEDED   3
 time exceeded
 
#define ICMP6_PARAM_PROB   4
 ip6 header bad
 
#define ICMP6_ECHO_REQUEST   128
 Echo request.
 
#define ICMP6_ECHO_REPLY   129
 Echo reply.
 
#define ICMP6_RS   133
 Router Solicitation.
 
#define ICMP6_RA   134
 Router Advertisement.
 
#define ICMP6_NS   135
 Neighbor Solicitation.
 
#define ICMP6_NA   136
 Neighbor advertisement.
 
#define ICMP6_REDIRECT   137
 Redirect.
 
#define ICMP6_RPL   155
 RPL.
 
#define ICMP6_MPL   159
 MPL.
 
#define ICMP6_PRIV_EXP_100   100
 Private Experimentation.
 
#define ICMP6_PRIV_EXP_101   101
 Private Experimentation.
 
#define ICMP6_PRIV_EXP_200   200
 Private Experimentation.
 
#define ICMP6_PRIV_EXP_201   201
 Private Experimentation.
 
#define ICMP6_ROLL_TM   ICMP6_PRIV_EXP_200
 ROLL Trickle Multicast.
 
#define ICMP6_ESMRF   ICMP6_PRIV_EXP_201
 ESMRF Multicast.
 

ICMPv6 Destination Unreachable message codes

#define ICMP6_DST_UNREACH_NOROUTE   0
 no route to destination
 
#define ICMP6_DST_UNREACH_ADMIN   1
 administratively prohibited
 
#define ICMP6_DST_UNREACH_NOTNEIGHBOR   2
 not a neighbor(obsolete)
 
#define ICMP6_DST_UNREACH_BEYONDSCOPE   2
 beyond scope of source address
 
#define ICMP6_DST_UNREACH_ADDR   3
 address unreachable
 
#define ICMP6_DST_UNREACH_NOPORT   4
 port unreachable
 

ICMPv6 Time Exceeded message codes

#define ICMP6_TIME_EXCEED_TRANSIT   0
 ttl==0 in transit
 
#define ICMP6_TIME_EXCEED_REASSEMBLY   1
 ttl==0 in reass
 

ICMPv6 Parameter Problem message codes

#define ICMP6_PARAMPROB_HEADER   0
 erroneous header field
 
#define ICMP6_PARAMPROB_NEXTHEADER   1
 unrecognized next header
 
#define ICMP6_PARAMPROB_OPTION   2
 unrecognized option
 

General

#define UIP_NAMESERVER_POOL_SIZE   1
 Number of Nameservers to keep.
 
#define UIP_NAMESERVER_INFINITE_LIFETIME   0xFFFFFFFF
 Infinite Lifetime indicator.
 

Pointers to the header structures.

#define UIP_ND6_RS_BUF   ((uip_nd6_rs *)UIP_ICMP_PAYLOAD)
 

General

#define UIP_ND6_HOP_LIMIT   255
 HOP LIMIT to be used when sending ND messages (255)
 
#define UIP_ND6_INFINITE_LIFETIME   0xFFFFFFFF
 INFINITE lifetime.
 

RFC 4861 Host constant

#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY   1
 Maximum router solicitation delay.
 
#define UIP_ND6_RTR_SOLICITATION_INTERVAL   4
 Router solicitation interval.
 
#define UIP_ND6_MAX_RTR_SOLICITATIONS   3
 Maximum router solicitations.
 

ND6 option length in bytes

#define UIP_ND6_OPT_LLAO_LEN   8
 length of a ND6 LLAO option for default L2 type (e.g.
 
#define UIP_PROTO_HBHO   0
 extension headers types
 
#define UIP_EXT_HDR_OPT_PAD1   0
 Destination and Hop By Hop extension headers option types.
 
#define UIP_EXT_HDR_BITMAP_HBHO   0x01
 Bitmaps for extension header processing.
 

Detailed Description

The low-power IPv6 stack

{@

Macro Definition Documentation

◆ UIP_APPDATA_SIZE

#define UIP_APPDATA_SIZE

The buffer size available for user data in the uip_buf buffer.

This macro holds the available size for user data in the uip_buf buffer. The macro is intended to be used for checking bounds of available user data.

Example:

snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i);
void * uip_appdata
Pointer to the application data in the packet buffer.
Definition uip6.c:148
#define UIP_APPDATA_SIZE
The buffer size available for user data in the uip_buf buffer.
Definition uip.h:1653

Definition at line 1653 of file uip.h.

◆ UIP_DS6_DEFRT_NBS

#define UIP_DS6_DEFRT_NBS   0

Configuration.

For all tables (Neighbor cache, Prefix List, Routing Table, Default Router List, Unicast address list, multicast address list, anycast address list), we define:

  • the number of elements requested by the user in contiki configuration (name suffixed by _NBU)
  • the number of elements assigned by the system (name suffixed by _NBS)
  • the total number of elements is the sum (name suffixed by _NB) The routing table definitions can be found in uip-ds6-route.h The Neighbor cache definitions can be found in nbr-table.h

Definition at line 65 of file uip-ds6.h.

◆ UIP_DS6_PERIOD

#define UIP_DS6_PERIOD   (60 * CLOCK_SECOND)

General DS6 definitions.

Period for uip-ds6 periodic task

Definition at line 169 of file uip-ds6.h.

Referenced by uip_ds6_init().

◆ UIP_EXT_HDR_BITMAP_HBHO

#define UIP_EXT_HDR_BITMAP_HBHO   0x01

Bitmaps for extension header processing.

When processing extension headers, we should record somehow which one we see, because you cannot have twice the same header, except for destination We store all this in one uint8_t bitmap one bit for each header expected. The order in the bitmap is the order recommended in RFC2460

Definition at line 1690 of file uip.h.

◆ uip_is_addr_linklocal

#define uip_is_addr_linklocal ( a)
Value:
((a)->u8[0] == 0xfe && \
(a)->u8[1] == 0x80)

is addr (a) a link local unicast address, see RFC 4291 i.e.

is (a) on prefix FE80::/10 a is of type uip_ipaddr_t*

Definition at line 1766 of file uip.h.

Referenced by coap_endpoint_is_connected(), compress_hdr_iphc(), log_6addr_compact_snprint(), output(), ra_input(), rpl_dag_root_start(), rpl_ext_header_update(), rpl_get_global_address(), uip_ds6_dad_failed(), and uip_ds6_select_src().

◆ uip_is_addr_mcast_non_routable

#define uip_is_addr_mcast_non_routable ( a)
Value:
((((a)->u8[0]) == 0xFF) && \
(((a)->u8[1] & 0x0F) <= 0x02))

is address a non-routable multicast address.

Scopes 1 (interface-local) and 2 (link-local) are non-routable See RFC4291 and draft-ietf-6man-multicast-scopes a is of type uip_ip6addr_t*

Definition at line 1877 of file uip.h.

Referenced by accept(), accept(), and icmp_in().

◆ uip_is_addr_mcast_routable

#define uip_is_addr_mcast_routable ( a)
Value:
((((a)->u8[0]) == 0xFF) && \
(((a)->u8[1] & 0x0F) > 0x02))

is address a routable multicast address.

Scope 3 (Realm-Local) or higher are routable Realm-Local scope is defined in draft-ietf-6man-multicast-scopes See RFC4291 and draft-ietf-6man-multicast-scopes a is of type uip_ip6addr_t*

Definition at line 1888 of file uip.h.

Referenced by uip_ds6_select_src().

◆ UIP_LLADDR_LEN

#define UIP_LLADDR_LEN   LINKADDR_SIZE

802.15.4 address

Link layer address length

Definition at line 145 of file uip.h.

Referenced by extract_lladdr_from_llao_aligned(), ra_input(), uip_ds6_set_addr_iid(), and uip_ds6_set_lladdr_from_iid().

◆ UIP_ND6_OPT_LLAO_LEN

#define UIP_ND6_OPT_LLAO_LEN   8

length of a ND6 LLAO option for default L2 type (e.g.

Ethernet)

Definition at line 243 of file uip-nd6.h.

Referenced by uip_nd6_rs_output().

◆ UIP_ND6_RS_BUF

#define UIP_ND6_RS_BUF   ((uip_nd6_rs *)UIP_ICMP_PAYLOAD)

Pointers to messages just after icmp header

Definition at line 90 of file uip-nd6.c.

◆ UIP_STAT

#define UIP_STAT ( s)

The uIP TCP/IP statistics.

This is the variable in which the uIP TCP/IP statistics are gathered.

Definition at line 1351 of file uip.h.

Referenced by ra_input(), uip_icmp6_error_output(), uip_icmp6_send(), uip_nd6_rs_output(), and uip_reass_over().

Typedef Documentation

◆ uip_ds6_addr_t

typedef struct uip_ds6_addr uip_ds6_addr_t

Unicast address structure.

◆ uip_nd6_na

typedef struct uip_nd6_na uip_nd6_na

A neighbor advertisement constant part.

Possible option is: TLLAO

◆ uip_nd6_ns

typedef struct uip_nd6_ns uip_nd6_ns

A neighbor solicitation constant part.

Possible option is: SLLAO

◆ uip_nd6_ra

typedef struct uip_nd6_ra uip_nd6_ra

A router advertisement constant part.

Possible options are: SLLAO, MTU, Prefix Information

◆ uip_nd6_redirect

typedef struct uip_nd6_redirect uip_nd6_redirect

A redirect message constant part.

Possible options are: TLLAO, redirected header

◆ uip_nd6_rs

typedef struct uip_nd6_rs uip_nd6_rs

A router solicitation constant part.

Possible option is: SLLAO

◆ uip_sr_node_t

typedef struct uip_sr_node uip_sr_node_t

A node in a source routing graph, stored at the root and representing all child-parent relationship.

Used to build source routes

Function Documentation

◆ rpl_get_mode()

enum rpl_mode rpl_get_mode ( void )

Get the RPL mode.

Return values
TheRPL mode.

Definition at line 68 of file rpl.c.

◆ rpl_has_downward_route()

int rpl_has_downward_route ( void )

Get the RPL's best guess on if we have downward route or not.

Return values
1if we have a downward route from RPL Root, 0 if not.

Definition at line 1058 of file rpl-dag.c.

◆ rpl_has_joined()

int rpl_has_joined ( void )

Tells whether the node has joined a network or not.

Return values
1if we have joined a network, 0 if not.

Definition at line 1049 of file rpl-dag.c.

◆ rpl_is_in_leaf_mode()

uint8_t rpl_is_in_leaf_mode ( void )

Tells whether the protocol is in leaf mode.

Return values
1if the protocol is in leaf mode, 0 if not.

Definition at line 436 of file rpl.c.

◆ rpl_link_callback()

void rpl_link_callback ( const linkaddr_t * addr,
int status,
int numtx )

Called by lower layers after every packet transmission.

Parameters
addrThe link-layer addrress of the packet destination
statusThe transmission status (see os/net/mac/mac.h)
numtxThe total number of transmission attempts

Definition at line 265 of file rpl.c.

References addr, ipaddr, uip_ds6_set_addr_iid(), and uip_ip6addr.

◆ rpl_set_mode()

enum rpl_mode rpl_set_mode ( enum rpl_mode mode)

Set the RPL mode.

Parameters
modeThe new RPL mode.
Return values
Theprevious RPL mode.

Definition at line 74 of file rpl.c.

◆ uip_add32()

void uip_add32 ( uint8_t * op32,
uint16_t op16 )

Carry out a 32-bit addition.

Because not all architectures for which uIP is intended has native 32-bit arithmetic, uIP uses an external C function for doing the required 32-bit additions in the TCP protocol processing. This function should add the two arguments and place the result in the global variable uip_acc32.

Note
The 32-bit integer pointed to by the op32 parameter and the result in the uip_acc32 variable are in network byte order (big endian).
Parameters
op32A pointer to a 4-byte array representing a 32-bit integer in network byte order (big endian).
op16A 16-bit integer in host byte order.

Definition at line 252 of file uip6.c.

References uip_acc32.

◆ uip_chksum()

uint16_t uip_chksum ( uint16_t * data,
uint16_t len )

Calculate the Internet checksum over a buffer.

The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.

See RFC1071.

Parameters
dataA pointer to the buffer over which the checksum is to be computed.
lenThe length of the buffer over which the checksum is to be computed.
Returns
The Internet checksum of the buffer.

Definition at line 313 of file uip6.c.

References uip_htons().

◆ uip_ds6_default_prefix()

const uip_ip6addr_t * uip_ds6_default_prefix ( void )

Retrieve the Default IPv6 prefix.

Return values
Apointer to the default prefix

Definition at line 104 of file uip-ds6.c.

◆ uip_ds6_link_callback()

void uip_ds6_link_callback ( int status,
int numtx )

The callback function to update link-layer stats in a neighbor cache.

Parameters
statusMAC return value defined in mac.h
numtxthe number of transmissions happened for a packet

Definition at line 564 of file uip-ds6-nbr.c.

References linkaddr_cmp(), linkaddr_null, list_head(), list_item_next(), MAC_TX_OK, nbr, and uip_ds6_nbr_ll_lookup().

Referenced by packet_sent().

◆ uip_ds6_nbr_add()

uip_ds6_nbr_t * uip_ds6_nbr_add ( const uip_ipaddr_t * ipaddr,
const uip_lladdr_t * lladdr,
uint8_t isrouter,
uint8_t state,
nbr_table_reason_t reason,
void * data )

Add a neighbor cache for a specified IPv6 address, which is associated with a specified link-layer address.

Parameters
ipaddrIPv6 address of a neighbor to add
lladdrLink-layer address to associate with ipaddr
isrouterSet 1 if the neighbor is a router
stateSet the initial neighbor cache state (e.g., NBR_INCOMPLETE)
reasonSet a reason of the addition (e.g., NBR_TABLE_REASON_RPL_DIO)
dataSet data associated with the nbr cache
Returns
the address of a newly added nbr cache on success, NULL on failure

Definition at line 132 of file uip-ds6-nbr.c.

References ipaddr, list_length(), LIST_STRUCT_INIT, memb_alloc(), memb_free(), nbr, routing_driver::neighbor_state_changed, stimer_set(), uip_ds6_nbr_lookup(), UIP_DS6_NBR_MAX_6ADDRS_PER_NBR, and uip_ipaddr_copy.

Referenced by ra_input(), rpl_icmp6_update_nbr_table(), rpl_icmp6_update_nbr_table(), tcpip_ipv6_output(), and uip_ds6_nbr_update_ll().

◆ uip_ds6_nbr_get_ipaddr()

const uip_ipaddr_t * uip_ds6_nbr_get_ipaddr ( const uip_ds6_nbr_t * nbr)

Get an IPv6 address of a neighbor cache.

Parameters
nbrthe pointer to a neighbor cache
Returns
the pointer to an IPv6 address associated with the neighbor cache
Note
This returns the first IPv6 address found in the neighbor cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled

Definition at line 415 of file uip-ds6-nbr.c.

References nbr.

◆ uip_ds6_nbr_get_ll()

const uip_lladdr_t * uip_ds6_nbr_get_ll ( const uip_ds6_nbr_t * nbr)

Get the link-layer address associated with a specified nbr cache.

Parameters
nbrthe address of a neighbor cache
Returns
pointer to the link-layer address on success, NULL on failure

Definition at line 422 of file uip-ds6-nbr.c.

References nbr.

Referenced by ra_input(), rpl_neighbor_get_from_ipaddr(), tcpip_ipv6_output(), uip_ds6_nbr_lladdr_from_ipaddr(), and uip_ds6_nbr_rm().

◆ uip_ds6_nbr_head()

uip_ds6_nbr_t * uip_ds6_nbr_head ( void )

Get the first neighbor cache in nbr_table.

Returns
the pointer to the first neighbor cache entry

Definition at line 459 of file uip-ds6-nbr.c.

References list_head().

Referenced by uip_ds6_nbr_lookup().

◆ uip_ds6_nbr_ipaddr_from_lladdr()

uip_ipaddr_t * uip_ds6_nbr_ipaddr_from_lladdr ( const uip_lladdr_t * lladdr)

Get an IPv6 address associated with a specified link-layer address.

Parameters
lladdra link-layer address used as a search key
Returns
the pointer to an IPv6 address associated with the neighbor cache
Note
This returns the first IPv6 address found in the neighbor cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled

Definition at line 535 of file uip-ds6-nbr.c.

References nbr, and uip_ds6_nbr_ll_lookup().

Referenced by rpl_neighbor_get_ipaddr().

◆ uip_ds6_nbr_ll_lookup()

uip_ds6_nbr_t * uip_ds6_nbr_ll_lookup ( const uip_lladdr_t * lladdr)

Get the neighbor cache associated with a specified link-layer address.

Parameters
lladdra link-layer address used as a search key
Returns
the pointer to a neighbor cache on success, NULL on failure

Definition at line 512 of file uip-ds6-nbr.c.

References list_head().

Referenced by uip_ds6_link_callback(), uip_ds6_nbr_ipaddr_from_lladdr(), and uip_ds6_nbr_update_ll().

◆ uip_ds6_nbr_lladdr_from_ipaddr()

const uip_lladdr_t * uip_ds6_nbr_lladdr_from_ipaddr ( const uip_ipaddr_t * ipaddr)

Get the link-layer address associated with a specified IPv6 address.

Parameters
ipaddran IPv6 address used as a search key
Returns
the pointer to the link-layer address on success, NULL on failure

Definition at line 543 of file uip-ds6-nbr.c.

References ipaddr, nbr, uip_ds6_nbr_get_ll(), and uip_ds6_nbr_lookup().

◆ uip_ds6_nbr_lookup()

uip_ds6_nbr_t * uip_ds6_nbr_lookup ( const uip_ipaddr_t * ipaddr)

Get the neighbor cache associated with a specified IPv6 address.

Parameters
ipaddran IPv6 address used as a search key
Returns
the pointer to a neighbor cache on success, NULL on failure

Definition at line 497 of file uip-ds6-nbr.c.

References ipaddr, nbr, uip_ds6_nbr_head(), and uip_ds6_nbr_next().

Referenced by ra_input(), rpl_icmp6_update_nbr_table(), rpl_icmp6_update_nbr_table(), rpl_neighbor_get_from_ipaddr(), tcpip_ipv6_output(), uip_ds6_nbr_add(), and uip_ds6_nbr_lladdr_from_ipaddr().

◆ uip_ds6_nbr_next()

uip_ds6_nbr_t * uip_ds6_nbr_next ( uip_ds6_nbr_t * nbr)

Get the next neighbor cache of a specified one.

Parameters
nbrthe pointer to a neighbor cache
Returns
the pointer to the next one on success, NULL on failure

Definition at line 474 of file uip-ds6-nbr.c.

References list_head(), list_item_next(), and nbr.

Referenced by uip_ds6_nbr_lookup().

◆ uip_ds6_nbr_num()

int uip_ds6_nbr_num ( void )

Return the number of neighbor caches.

Returns
the number of neighbor caches in use

Definition at line 436 of file uip-ds6-nbr.c.

References list_length(), and nbr.

◆ uip_ds6_nbr_rm()

int uip_ds6_nbr_rm ( uip_ds6_nbr_t * nbr)

Remove a neighbor cache.

Parameters
nbrthe address of a neighbor cache to remove
Returns
1 on success, 0 on failure (nothing was removed)

Definition at line 307 of file uip-ds6-nbr.c.

References nbr, routing_driver::neighbor_state_changed, and uip_ds6_nbr_get_ll().

Referenced by uip_ds6_nbr_update_ll().

◆ uip_ds6_nbr_update_ll()

int uip_ds6_nbr_update_ll ( uip_ds6_nbr_t ** nbr,
const uip_lladdr_t * new_ll_addr )

Update the link-layer address associated with an IPv6 address.

Parameters
nbrthe double pointer to a neighbor cache which has the target IPv6 address
new_ll_addrthe new link-layer address of the IPv6 address return 0 on success, -1 on failure

Definition at line 347 of file uip-ds6-nbr.c.

References list_length(), LIST_STRUCT_INIT, nbr, uip_ds6_nbr_add(), uip_ds6_nbr_ll_lookup(), and uip_ds6_nbr_rm().

Referenced by ra_input().

◆ uip_ds6_set_default_prefix()

void uip_ds6_set_default_prefix ( const uip_ip6addr_t * prefix)

Set the Default IPv6 prefix.

Parameters
prefixA pointer to the new default prefix

uip_ds6_init() will set the default prefix to UIP_DS6_DEFAULT_PREFIX unless this function here has been called beforehand to set a new default prefix.

Definition at line 110 of file uip-ds6.c.

◆ uip_htons()

uint16_t uip_htons ( uint16_t val)

Convert a 16-bit quantity from host byte order to network byte order.

This function is primarily used for converting variables from host byte order to network byte order. For converting constants to network byte order, use the UIP_HTONS() macro instead.

Definition at line 2341 of file uip6.c.

References UIP_HTONS.

Referenced by newdata(), uip_chksum(), uip_ipchksum(), and uip_udp_new().

◆ uip_icmp6_echo_reply_callback_add()

void uip_icmp6_echo_reply_callback_add ( struct uip_icmp6_echo_reply_notification * n,
uip_icmp6_echo_reply_callback_t c )

Add a callback function for ping replies.

Parameters
nA struct uip_icmp6_echo_reply_notification that must have been allocated by the caller
cA pointer to the callback function to be called
        This function adds a callback function to the list of
        callback functions that are called when an ICMP echo
        reply (ping reply) is received. This is used when
        implementing a ping protocol: attach a callback
        function to the ping reply, then send out a ping packet
        with uip_icmp6_send().

        The caller must have statically allocated a struct
        uip_icmp6_echo_reply_notification to hold the internal
        state of the callback function.

        When a ping reply packet is received, all registered
        callback functions are called. The callback functions
        must not modify the contents of the uIP buffer.

Definition at line 302 of file uip-icmp6.c.

References list_add().

Referenced by shell_commands_init().

◆ uip_icmp6_echo_reply_callback_rm()

void uip_icmp6_echo_reply_callback_rm ( struct uip_icmp6_echo_reply_notification * n)

Remove a callback function for ping replies.

Parameters
nA struct uip_icmp6_echo_reply_notification that must have been previously added with uip_icmp6_echo_reply_callback_add()
        This function removes a callback function from the list of
        callback functions that are called when an ICMP echo
        reply (ping reply) is received.

Definition at line 312 of file uip-icmp6.c.

References list_remove().

◆ uip_icmp6_error_output()

void uip_icmp6_error_output ( uint8_t type,
uint8_t code,
uint32_t param )

Send an icmpv6 error message.

Parameters
typetype of the error message
codeof the error message
param32 bit parameter of the error message, semantic depends on error

Definition at line 155 of file uip-icmp6.c.

References routing_driver::ext_header_remove, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, tmp_ipaddr, uip_buf, uip_ds6_if, uip_ds6_select_src(), uip_ext_len, UIP_ICMP6_ERROR_LEN, UIP_ICMP_BUF, UIP_IP_BUF, uip_ipaddr_copy, uip_is_addr_mcast, uip_is_addr_unspecified, uip_last_proto, uip_len, UIP_LINK_MTU, and UIP_STAT.

Referenced by ext_hdr_options_process(), and uip_reass_over().

◆ uip_icmp6_input()

uint8_t uip_icmp6_input ( uint8_t type,
uint8_t icode )

Handle an incoming ICMPv6 message.

Parameters
typeThe ICMPv6 message type
icodeThe ICMPv6 message code
Returns
Success: UIP_ICMP6_INPUT_SUCCESS, Error: UIP_ICMP6_INPUT_ERROR

Generic handler for unknown ICMPv6 types. It will lookup for a registered function capable of handing this message type. The function must have first been registered with uip_icmp6_register_input_handler. The function is in charge of setting uip_len to 0, otherwise the uIPv6 core will attempt to send whatever remains in the UIP_IP_BUF.

A return value of UIP_ICMP6_INPUT_ERROR means that a handler could not be invoked. This is most likely because the ICMPv6 type does not have a valid handler associated with it.

UIP_ICMP6_INPUT_SUCCESS signifies that a handler was found for this ICMPv6 type and that it was invoked. It does NOT provide any indication whatsoever regarding whether the handler itself succeeded.

Definition at line 85 of file uip-icmp6.c.

◆ uip_icmp6_register_input_handler()

void uip_icmp6_register_input_handler ( uip_icmp6_input_handler_t * handler)

Register a handler which can handle a specific ICMPv6 message type.

Parameters
handlerA pointer to the handler

Definition at line 102 of file uip-icmp6.c.

References list_add().

Referenced by rpl_icmp6_init(), uip_icmp6_init(), and uip_nd6_init().

◆ uip_icmp6_send()

void uip_icmp6_send ( const uip_ipaddr_t * dest,
int type,
int code,
int payload_len )

Send an icmpv6 message.

Parameters
destdestination address of the message
typetype of the message
codeof the message
payload_lenlength of the payload

Definition at line 230 of file uip-icmp6.c.

References tcpip_ipv6_output(), uip_ds6_if, uip_ds6_select_src(), UIP_ICMP_BUF, UIP_IP_BUF, uip_len, and UIP_STAT.

Referenced by rpl_icmp6_dao_output(), rpl_icmp6_dio_output(), and rpl_icmp6_dis_output().

◆ uip_icmp6chksum()

uint16_t uip_icmp6chksum ( void )

Calculate the ICMP checksum of the packet in uip_buf.

Returns
The ICMP checksum of the ICMP packet in uip_buf

Definition at line 363 of file uip6.c.

◆ uip_init()

void uip_init ( void )

uIP initialization function.

This function should be called at boot up to initilize the uIP TCP/IP stack.

Definition at line 387 of file uip6.c.

References uip_mcast6_driver::init, uip_udp_conn::lport, uip_conn::tcpstateflags, uip_ds6_init(), uip_icmp6_init(), UIP_LISTENPORTS, uip_nd6_init(), UIP_TCP_CONNS, and UIP_UDP_CONNS.

◆ uip_ipchksum()

uint16_t uip_ipchksum ( void )

Calculate the IP header checksum of the packet header in uip_buf.

The IP header checksum is the Internet checksum of the 20 bytes of the IP header.

Returns
The IP header checksum of the IP header in the uip_buf buffer.

Definition at line 320 of file uip6.c.

References uip_buf, and uip_htons().

◆ uip_listen()

void uip_listen ( uint16_t port)

Start listening to the specified port.

Note
Since this function expects the port number in network byte order, a conversion using UIP_HTONS() or uip_htons() is necessary.
void uip_listen(uint16_t port)
Start listening to the specified port.
Definition uip6.c:578
#define UIP_HTONS(n)
Convert 16-bit quantity from host byte order to network byte order.
Definition uip.h:1157
Parameters
portA 16-bit port number in network byte order.

Definition at line 578 of file uip6.c.

References UIP_LISTENPORTS.

Referenced by tcp_listen().

◆ uip_nameserver_get()

uip_ipaddr_t * uip_nameserver_get ( uint8_t num)

Get a Nameserver ip address given in RA.

Parameters
numThe number of the nameserver to obtain, starting at 0 and going up to the pool size.

Definition at line 173 of file uip-nameserver.c.

References list_head(), and list_item_next().

◆ uip_nameserver_next_expiration()

uint32_t uip_nameserver_next_expiration ( void )

Get next expiration time.

The least expiration time is returned

Definition at line 200 of file uip-nameserver.c.

References DNS_EXPIRATION, list_head(), list_item_next(), list_length(), and UIP_NAMESERVER_INFINITE_LIFETIME.

◆ uip_nameserver_update()

void uip_nameserver_update ( const uip_ipaddr_t * nameserver,
uint32_t lifetime )

Initialize the module variables.

Insert or update a nameserver into/from the pool.

The list is kept according to the RFC6106, which indicates that new entries will replace old ones (with lower lifetime) and existing entries will update their lifetimes.

Parameters
nameserverPointer to the nameserver ip address
lifetimeLife time of the given address. Minimum is 0, which is considered to remove an entry. Maximum is 0xFFFFFFFF which is considered infinite.

Definition at line 99 of file uip-nameserver.c.

References clock_seconds(), DNS_EXPIRATION, list_add(), list_head(), list_item_next(), list_remove(), memb_alloc(), memb_free(), and uip_ipaddr_copy.

Referenced by ra_input().

◆ uip_nd6_ns_output()

void uip_nd6_ns_output ( const uip_ipaddr_t * src,
const uip_ipaddr_t * dest,
uip_ipaddr_t * tgt )

Send a neighbor solicitation, send a Neighbor Advertisement.

Parameters
srcpointer to the src of the NS if known
destpointer to ip address to send the NS, for DAD or ADDR Resol, MUST be NULL, for NUD, must be correct unicast dest
tgtpointer to ip address to fill the target address field, must not be NULL
  • RFC 4861, 7.2.2 : "If the source address of the packet prompting the solicitation is the same as one of the addresses assigned to the outgoing interface, that address SHOULD be placed in the IP Source Address of the outgoing solicitation. Otherwise, any one of the addresses assigned to the interface should be used." This is why we have a src ip address as argument. If NULL, we will do src address selection, otherwise we use the argument.
  • we check if it is a NS for Address resolution or NUD, if yes we include a SLLAO option, otherwise no.

Referenced by uip_ds6_dad().

◆ uip_nd6_rs_output()

void uip_nd6_rs_output ( void )

Send a Router Solicitation.

src is chosen through the uip_netif_select_src function. If src is unspecified (i.e. we do not have a preferred address yet), then we do not put a SLLAO option (MUST NOT in RFC 4861). Otherwise we do.

RS message format, possible option is SLLAO, MUST NOT be included if source = unspecified SHOULD be included otherwise

Send a Router Solicitation.

The NS can be received in 3 cases (procedures):

  • sender is performing DAD (ip src = unspecified, no SLLAO option)
  • sender is performing NUD (ip dst = unicast)
  • sender is performing address resolution (ip dest = solicited node mcast address)

We do:

  • if the tgt belongs to me, reply, otherwise ignore
  • if i was performing DAD for the same address, two cases: – I already sent a NS, hence I win – I did not send a NS yet, hence I lose

If we need to send a NA in response (i.e. the NS was done for NUD, or address resolution, or DAD and there is a conflict), we do it in this function: set src, dst, tgt address in the three cases, then for all cases set the rest, including SLLAO

Definition at line 810 of file uip-nd6.c.

References ICMP6_RS, uip_buf, uip_create_linklocal_allrouters_mcast, uip_ds6_select_src(), UIP_ICMP_BUF, UIP_IP_BUF, uip_is_addr_unspecified, uip_len, UIP_ND6_HOP_LIMIT, UIP_ND6_OPT_LLAO_LEN, and UIP_STAT.

Referenced by uip_ds6_send_rs().

◆ uip_reass_over()

void uip_reass_over ( void )

Abandon the reassembly of the current packet.

Note
We don't have a complete packet to put in the error message. We could include the first fragment but since its not mandated by any RFC, we decided not to include it as it reduces the size of the packet.

Definition at line 773 of file uip6.c.

References etimer_stop(), ICMP6_TIME_EXCEED_REASSEMBLY, ICMP6_TIME_EXCEEDED, uip_icmp6_error_output(), UIP_IP_BUF, uip_reass_timer, and UIP_STAT.

◆ uip_remove_ext_hdr()

bool uip_remove_ext_hdr ( void )

Removes all IPv6 extension headers from uip_buf, updates length fields (uip_len and uip_ext_len)

Returns
true upon success, false otherwise.

Definition at line 491 of file uip6.c.

References uip_ext_len, UIP_IP_BUF, uip_last_proto, and uip_len.

◆ uip_send()

void uip_send ( const void * data,
int len )

Send data on the current connection.

This function is used to send out a single segment of TCP data. Only applications that have been invoked by uIP for event processing can send data.

The amount of data that actually is sent out after a call to this function is determined by the maximum amount of data TCP allows. uIP will automatically crop the data so that only the appropriate amount of data is sent. The function uip_mss() can be used to query uIP for the amount of data that actually will be sent.

Note
This function does not guarantee that the sent data will arrive at the destination. If the data is lost in the network, the application will be invoked with the uip_rexmit() event being set. The application will then have to resend the data using this function.
Parameters
dataA pointer to the data which is to be sent.
lenThe maximum amount of data bytes to be sent.

Definition at line 2353 of file uip6.c.

References UIP_BUFSIZE.

◆ uip_sr_expire_parent()

void uip_sr_expire_parent ( const void * graph,
const uip_ipaddr_t * child,
const uip_ipaddr_t * parent )

Expires a given child-parent link.

Parameters
graphThe graph the link belongs to
childThe IPv6 address of the child
parentThe IPv6 address of the parent

Definition at line 114 of file uip-sr.c.

References uip_sr_get_node().

Referenced by rpl_process_dao().

◆ uip_sr_get_node()

uip_sr_node_t * uip_sr_get_node ( const void * graph,
const uip_ipaddr_t * addr )

Looks up for a source routing node from its IPv6 global address.

Parameters
graphThe graph where to look up for the node
addrThe target address
Returns
A pointer to the node

Definition at line 82 of file uip-sr.c.

References addr, list_head(), and list_item_next().

Referenced by rpl_ext_header_srh_get_next_hop(), uip_sr_expire_parent(), uip_sr_is_addr_reachable(), and uip_sr_update_node().

◆ uip_sr_is_addr_reachable()

int uip_sr_is_addr_reachable ( const void * graph,
const uip_ipaddr_t * addr )

Telle whether an address is reachable, i.e.

if there exists a path from the root to the node in the current source routing graph

Parameters
graphThe graph where to look up for the node
addrThe target IPv6 global address
Returns
1 if the node is reachable, 0 otherwise

Definition at line 95 of file uip-sr.c.

References addr, routing_driver::get_root_ipaddr, and uip_sr_get_node().

Referenced by uip_sr_update_node().

◆ uip_sr_link_snprint()

int uip_sr_link_snprint ( char * buf,
int buflen,
const uip_sr_node_t * link )

Print a textual description of a source routing link.

Parameters
bufThe buffer where to write content
buflenThe buffer len
linkA pointer to the source routing link
Returns
Identical to snprintf: number of bytes written excluding ending null byte. A value >= buflen if the buffer was too small.

Definition at line 261 of file uip-sr.c.

References routing_driver::get_sr_node_ipaddr, log_6addr_compact_snprint(), and uiplib_ipaddr_snprint().

Referenced by rpl_dag_root_print_links().

◆ uip_sr_node_head()

uip_sr_node_t * uip_sr_node_head ( void )

Returns the head of the non-storing node list.

Returns
The head of the list

Definition at line 199 of file uip-sr.c.

References list_head().

Referenced by rpl_dag_root_print_links().

◆ uip_sr_node_next()

uip_sr_node_t * uip_sr_node_next ( const uip_sr_node_t * item)

Returns the next element of the non-storing node list.

Parameters
itemThe current element in the list
Returns
The next element of the list

Definition at line 205 of file uip-sr.c.

References list_item_next().

Referenced by rpl_dag_root_print_links().

◆ uip_sr_num_nodes()

int uip_sr_num_nodes ( void )

Tells how many nodes are currently stored in the graph.

Returns
The number of nodes

Definition at line 63 of file uip-sr.c.

Referenced by rpl_dag_root_print_links().

◆ uip_sr_periodic()

void uip_sr_periodic ( unsigned seconds)

A function called periodically.

Used to age the links (decrease lifetime and expire links accordingly)

Parameters
secondsThe number of seconds elapsted since last call

Definition at line 211 of file uip-sr.c.

References routing_driver::get_sr_node_ipaddr, list_head(), list_item_next(), list_remove(), and memb_free().

◆ uip_sr_update_node()

uip_sr_node_t * uip_sr_update_node ( void * graph,
const uip_ipaddr_t * child,
const uip_ipaddr_t * parent,
uint32_t lifetime )

Updates a child-parent link.

Parameters
graphThe graph the link belongs to
childThe IPv6 address of the child
parentThe IPv6 address of the parent
lifetimeThe link lifetime in seconds

Definition at line 127 of file uip-sr.c.

References list_add(), memb_alloc(), uip_sr_get_node(), uip_sr_is_addr_reachable(), and uip_sr_update_node().

Referenced by rpl_process_dao(), and uip_sr_update_node().

◆ uip_tcpchksum()

uint16_t uip_tcpchksum ( void )

Calculate the TCP checksum of the packet in uip_buf and uip_appdata.

The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.

Returns
The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata.

Definition at line 371 of file uip6.c.

◆ uip_udp_new()

struct uip_udp_conn * uip_udp_new ( const uip_ipaddr_t * ripaddr,
uint16_t rport )

Set up a new UDP connection.

This function sets up a new UDP connection. The function will automatically allocate an unused local port for the new connection. However, another port can be chosen by using the uip_udp_bind() call, after the uip_udp_new() function has been called.

Example:

uip_ipaddr_t addr;
struct uip_udp_conn *c;
uip_ipaddr(&addr, 192,168,2,1);
c = uip_udp_new(&addr, UIP_HTONS(12345));
if(c != NULL) {
}
#define uip_udp_bind(conn, port)
Bind a UDP connection to a local port.
Definition uip.h:830
struct uip_udp_conn * uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
Set up a new UDP connection.
Definition uip6.c:520
#define uip_ipaddr(addr, addr0, addr1, addr2, addr3)
Construct an IP address from four bytes.
Definition uip.h:898
Representation of a uIP UDP connection.
Definition uip.h:1309
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
Definition uip-nd6.c:107
Parameters
ripaddrThe IP address of the remote host.
rportThe remote port number in network byte order.
Returns
The uip_udp_conn structure for the new connection, or NULL if no connection could be allocated.

Definition at line 520 of file uip6.c.

References uip_udp_conn::lport, uip_udp_conn::ripaddr, uip_udp_conn::rport, uip_ds6_if, UIP_HTONS, uip_htons(), uip_ipaddr_copy, and UIP_UDP_CONNS.

Referenced by udp_new().

◆ uip_udpchksum()

uint16_t uip_udpchksum ( void )

Calculate the UDP checksum of the packet in uip_buf and uip_appdata.

The UDP checksum is the Internet checksum of data contents of the UDP segment, and a pseudo-header as defined in RFC768.

Returns
The UDP checksum of the UDP segment in uip_buf and pointed to by uip_appdata.

◆ uip_unlisten()

void uip_unlisten ( uint16_t port)

Stop listening to the specified port.

Note
Since this function expects the port number in network byte order, a conversion using UIP_HTONS() or uip_htons() is necessary.
void uip_unlisten(uint16_t port)
Stop listening to the specified port.
Definition uip6.c:566
Parameters
portA 16-bit port number in network byte order.

Definition at line 566 of file uip6.c.

References UIP_LISTENPORTS.

Referenced by tcp_unlisten().

◆ uiplib_ipaddr_print()

void uiplib_ipaddr_print ( const uip_ipaddr_t * addr)

Print an IP address using printf().

Parameters
addrA pointer to a uip_ipaddr_t that will be printed with printf().

Definition at line 158 of file uiplib.c.

References addr, and uiplib_ipaddr_snprint().

Referenced by coap_endpoint_print().

◆ uiplib_ipaddr_snprint()

int uiplib_ipaddr_snprint ( char * buffer,
size_t size,
const uip_ipaddr_t * addr )

Write at most size - 1 characters of the IP address to the output string.

The output is always null-terminated, unless size is 0.

Parameters
bufferA pointer to an output string with at least size bytes.
sizeThe max number of characters to write to the output string.
addrA pointer to a uip_ipaddr_t that will be printed with printf().

Definition at line 166 of file uiplib.c.

References addr.

Referenced by coap_endpoint_snprint(), log_6addr(), rpl_neighbor_snprint(), shell_output_6addr(), uip_sr_link_snprint(), and uiplib_ipaddr_print().

Variable Documentation

◆ uip_appdata [1/2]

void* uip_appdata
extern

Pointer to the application data in the packet buffer.

This pointer points to the application data when the application is called. If the application wishes to send data, the application may use this space to write the data into before calling uip_send().

Definition at line 148 of file uip6.c.

Referenced by coap_databuf(), and newdata().

◆ uip_appdata [2/2]

void* uip_appdata

Pointer to the application data in the packet buffer.

This pointer points to the application data when the application is called. If the application wishes to send data, the application may use this space to write the data into before calling uip_send().

Definition at line 148 of file uip6.c.

Referenced by coap_databuf(), and newdata().

◆ uip_conn [1/2]

struct uip_conn* uip_conn
extern

Pointer to the current TCP connection.

The uip_conn pointer can be used to access the current TCP connection.

Definition at line 174 of file uip6.c.

◆ uip_conn [2/2]

struct uip_conn* uip_conn

Pointer to the current TCP connection.

The uip_conn pointer can be used to access the current TCP connection.

Definition at line 174 of file uip6.c.

◆ uip_ext_len

uint16_t uip_ext_len = 0

Total length of all IPv6 extension headers.

The length of the extension headers.

Definition at line 122 of file uip6.c.

Referenced by accept(), icmp_in(), uip_icmp6_error_output(), and uip_remove_ext_hdr().

◆ uip_len

uint16_t uip_len

The length of the packet in the uip_buf buffer.

The global variable uip_len holds the length of the packet in the uip_buf buffer.

When the network device driver calls the uIP input function, uip_len should be set to the length of the packet in the uip_buf buffer.

When sending packets, the device driver should use the contents of the uip_len variable to determine the length of the outgoing packet.

Definition at line 159 of file uip6.c.

Referenced by accept(), accept(), icmp_in(), input(), output(), ra_input(), rpl_ext_header_remove(), rpl_ext_header_srh_get_next_hop(), rpl_ext_header_srh_update(), tcpip_ipv6_output(), uip_ds6_periodic(), uip_icmp6_error_output(), uip_icmp6_send(), uip_nd6_rs_output(), and uip_remove_ext_hdr().