tinyos学习笔记12--与网络相关的重要结构体索引

这篇博客主要介绍了TinyOS中涉及网络通信的一些重要结构体,包括sockaddr_in6、in6_addr、dio_prefix_t、in6_packet和ip6_hdr。这些结构体在blip库的ip.h以及RPL.h文件中定义,对于理解和操作TinyOS的网络功能至关重要。
摘要由CSDN通过智能技术生成

1.sockaddr_in6

\support\sdk\c\blip\lib6lowpan\ip.h


struct sockaddr_in6 {
  uint16_t       sin6_port;
  struct in6_addr sin6_addr;
};


2.in6_addr

\support\sdk\c\blip\lib6lowpan\ip.h


// update to use netinet/in definition of an IPv6 address; this is a
//  lot more elegent.
struct in6_addr
  {
    union
      {
	uint8_t	u6_addr8[16];
	uint16_t u6_addr16[8];
	uint32_t u6_addr32[4];
      } in6_u;
#define s6_addr			in6_u.u6_addr8
#define s6_addr16		in6_u.u6_addr16
#define s6_addr32		in6_u.u6_addr32
  };

3.dio_prefix_t

\tos\lib\net\rpl\RPL.h

struct dio_prefix_t { // type 8 ; contains prefix information
  uint8_t type;
  uint8_t option_length;
  uint8_t prefix_length;
  uint8_t flags_reserved;
  nx_uint32_t valid_lifetime;
  nx_uint32_t preferred_lifetime;
  uint32_t reserved2;
  struct in6_addr prefix;
} __attribute__((packed));

4.in6_packet

\support\sdk\c\blip\lib6lowpan\ip.h

struct ip6_packet {
  int ip6_inputif;
  struct ip_iovec  *ip6_data;
  struct ip6_hdr ip6_hdr;
};

5.ip6_hdr

\support\sdk\c\blip\lib6lowpan\ip.h

/*
 * Definition for internet protocol version 6.
 * RFC 2460
 *      @(#)ip.h        8.1 (Berkeley) 6/10/93
 */
struct ip6_hdr {
  union {
    struct ip6_hdrctl {
      uint32_t ip6_un1_flow; /* 20 bits of flow-ID */
      uint16_t ip6_un1_plen; /* payload length */
      uint8_t  ip6_un1_nxt;  /* next header */
      uint8_t  ip6_un1_hlim; /* hop limit */
    } ip6_un1;
    uint8_t ip6_un2_vfc;   /* 4 bits version, top 4 bits class */
  } ip6_ctlun;
  struct in6_addr ip6_src; /* source address */
  struct in6_addr ip6_dst; /* destination address */
} __attribute__((packed));



/*

 * 未完

 */

By:霜月孤鸟

2016.4.7

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值