此文档是经过逆序推到出的,可能有错误之处,敬请指教,谢谢。

1)interfaces_update

更新一些接口信息

2)levent_iface_subscribe

该接口通过socket通信(非阻塞模式)来获取信息。增加了一个event,来接收信息。

3)levent_iface_trigger  直接调用

lldpd_update_localports

更新本地接口信息。

4)lldpd_reset_timer

重启有信息变更的端口的timer。

5)levent_schedule_pdu

安排发送pdu。如果接口(端口)对应的timer不存在,则需添加。

6)levent_send_pdu

int tx_interval = hardware->h_cfg->g_config.c_tx_interval; // 发送间隔

根据发送间隔,以及是否是快速帧(快速帧有自己的发送间隔,快于普通帧)来进行发送pdu。

7)lldpd_send

首先判断模式是否支持发送模式,以及接口是否正常运行状态,若否,则不发送。

if (cfg->g_config.c_receiveonly || cfg->g_config.c_paused) return;
     if ((hardware->h_flags & IFF_RUNNING) == 0)  return;

其次根据使用的协议还有协议是否enabeled来进行发送报文。

for (i=0; cfg->g_protocols[i].mode != 0; i++) {
           if (!cfg->g_protocols[i].enabled)
                      continue;
           /* We send only if we have at least one remote system
        * speaking this protocol or if the protocol is forced */
       if (cfg->g_protocols[i].enabled > 1) {
       cfg->g_protocols[i].send(cfg, hardware);
       sent++;
       continue;
    }

其中重要的结构体有:

struct lldpd_config {

int c_paused;       /* lldpd is paused */

int c_tx_interval;   //lldppdu发送间隔

int c_smart;    /* Bitmask for smart configuration (see SMART_*) */

int c_receiveonly;   //只接受模式,有三种模式,只发送、只接收、同时支持发送和接收

int c_max_neighbors;  //支持的最大邻居数

char *c_mgmt_pattern; /* Pattern to match a management address */

char *c_cid_pattern; /* Pattern to match interfaces to use for chassis ID */

char *c_iface_pattern; /* Pattern to match interfaces to use */

char *c_platform; /* Override platform description (for CDP) */

char *c_description; /* Override chassis description */

int c_advertise_version; /* Should the precise version be advertised? */

int c_set_ifdescr;  /* Set interface description */

#ifdef ENABLE_LLDPMED

int c_noinventory; /* Don't send inventory with LLDP-MED */

int c_enable_fast_start; /* enable fast start */ //是否启动fast start模式,每秒钟发送报文个数快于平常

int c_tx_fast_init; //fast start的报文数量

int c_tx_fast_interval;  // fast start报文发送间隔

#endif

int c_tx_hold;  /* Transmit hold */

int c_bond_slave_src_mac_type; /* Src mac type in lldp frames over bond slaves */

};

如果一个“新邻居”被识别,将会启用快速发送机制,在很短的时间内连续发送指定数量(txFastInit,默认值为4)的LLDPDU,以确保“新邻居”能被快速更新。

如果远端系统MIB信息库因为过载(tooManyNeighbors)而不能容纳新的邻居信息,则会为了避免过多的PDU传输而抑制快速发送行为。

同时为了防止在有多个端口需要发送LLDPDU的系统中,所有的端口的定时器都在同一时间到期,因而标准建议将采用某种机制将多个发送实例的定时器到期时间给错开,以避免一个系统在同一时刻发送大量的LLDPDU

最新文章

  1. img.width一直是0的问题--记录(二)
  2. framebuff 显示子系统
  3. 深入理解java虚拟机【Java虚拟机类生命周期】
  4. javaweb回顾第三篇数据库访问
  5. IOS导航栏的使用方法
  6. 【转】How-To-Ask-Questions-The-Smart-Way
  7. mysql创建远程用户
  8. UI基础视图----UIView总结
  9. U盘重装系统win7
  10. python字符串中的中文处理
  11. 四、I/O
  12. 尝试造了个工具类库,名为 Diana
  13. python 创建一次性,快速的小型web服务
  14. C#中利用LightningChart绘制曲线图表
  15. 5: EL 表达式小结
  16. modelsim编译altera的库
  17. 用Spider引擎解决数据库垂直和水平拆分的问题
  18. 【jq】插件—缓存jquery.cookie.js
  19. C#设置System.Net.ServicePointManager.DefaultConnectionLimit,突破Http协议的并发连接数限制
  20. LintCode-371.用递归打印数字

热门文章

  1. MFC 控件用法
  2. css display属性介绍
  3. C++虚函数继承的bug
  4. JavaScript 属性操作
  5. linux下安装php的oracle拓展
  6. Shell错误[: missing `]'
  7. Linux权限解释
  8. iOS开发The Operation couldn't be completed.(LaunchServicesError error 0.)的解决方法
  9. 在Wamp 添加站点和域名
  10. LeetCode OJ 121. Best Time to Buy and Sell Stock