ospf-ism-and-nsm-code-printf

2024-01-06 14:30
文章标签 code ospf printf ism nsm

本文主要是介绍ospf-ism-and-nsm-code-printf,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

ospf 不同状态机起的定时器:

ism: ospf-ifp ism_down  ->(event:l3-ifp-up)-> ism_waiting ->  等待ism选举【起waiting等待定时器】nsm->down ->(event:hello-PacketReceived)-> nsm_init 【接收处理hello报文,OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_OneWayReceived); 知道hello报文发现对端邻居Active Neighbor: 4.4.4.4-> OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_TwoWayReceived);【直到ism选举出来drX/bdrX出来, nsm其状态发生变化】 ->(adj【bdrX/drX选举成功进入exStart否则进入twoway等待ism选举】 ? NSM_ExStart : NSM_TwoWay);  -> ism选举未成功,nsm状态切换到two-way,等待ism选举。 -> 选举成功进入到nsm-exstart, db-desc报文交互,目的协商主从关系,协商序列号,同时起db-desc定时器发送,直到nsm-exstart切换到下一个状态则取消其定时器发送db-desc报文。-> 如果邻居router-id > self-router-id, 则邻居是master. --> 主从关系协商ok,产生self-lsa安装在database中 -> 状态切换到nsm-exchange, 起定期器更新邻居状态数据库LSAstatic void
nsm_timer_set (struct ospf_neighbor *nbr)
{switch (nbr->state){case NSM_Deleted:case NSM_Down:OSPF_NSM_TIMER_OFF (nbr->t_inactivity);OSPF_NSM_TIMER_OFF (nbr->t_hello_reply);case NSM_Attempt:case NSM_Init:case NSM_TwoWay:OSPF_NSM_TIMER_OFF (nbr->t_db_desc);OSPF_NSM_TIMER_OFF (nbr->t_ls_upd);OSPF_NSM_TIMER_OFF (nbr->t_ls_req);break;case NSM_ExStart:OSPF_NSM_TIMER_ON (nbr->t_db_desc, ospf_db_desc_timer, nbr->v_db_desc);OSPF_NSM_TIMER_OFF (nbr->t_ls_upd);OSPF_NSM_TIMER_OFF (nbr->t_ls_req);break;case NSM_Exchange:OSPF_NSM_TIMER_ON (nbr->t_ls_upd, ospf_ls_upd_timer, nbr->v_ls_upd);if (!IS_SET_DD_MS (nbr->dd_flags))OSPF_NSM_TIMER_OFF (nbr->t_db_desc);break;case NSM_Loading:case NSM_Full:default:OSPF_NSM_TIMER_OFF (nbr->t_db_desc);break;}
}static void
ism_timer_set (struct ospf_interface *oi)
{switch (oi->state){case ISM_Down:/* First entry point of ospf interface state machine. In this stateinterface parameters must be set to initial values, and timers arereset also. */OSPF_ISM_TIMER_OFF (oi->t_hello);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_OFF (oi->t_ls_ack);break;case ISM_Loopback:/* In this state, the interface may be looped back and will beunavailable for regular data traffic. */OSPF_ISM_TIMER_OFF (oi->t_hello);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_OFF (oi->t_ls_ack);break;case ISM_Waiting:/* The router is trying to determine the identity of DRouter andBDRouter. The router begin to receive and send Hello Packets. *//* send first hello immediately */OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);if (OSPF_IF_PARAM_CONFIGURED (oi->params, fast_hello))OSPF_ISM_TIMER_ON (oi->t_wait, ospf_wait_timer, 10);elseOSPF_ISM_TIMER_ON (oi->t_wait, ospf_wait_timer, (OSPF_IF_PARAM (oi, v_hello)*4));OSPF_ISM_TIMER_OFF (oi->t_ls_ack);break;case ISM_PointToPoint:/* The interface connects to a physical Point-to-point network orvirtual link. The router attempts to form an adjacency withneighboring router. Hello packets are also sent. *//* send first hello immediately */OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);break;case ISM_DROther:/* The network type of the interface is broadcast or NBMA network,and the router itself is neither Designated Router norBackup Designated Router. */OSPF_HELLO_TIMER_ON (oi);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);break;case ISM_Backup:/* The network type of the interface is broadcast os NBMA network,and the router is Backup Designated Router. */OSPF_HELLO_TIMER_ON (oi);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);break;case ISM_DR:/* The network type of the interface is broadcast or NBMA network,and the router is Designated Router. */OSPF_HELLO_TIMER_ON (oi);OSPF_ISM_TIMER_OFF (oi->t_wait);OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);break;}
}     

NSM: 邻居状态机

在这里插入图片描述

ISM 接口状态机

在这里插入图片描述


/* Interface State Machine */
struct {int (*func) (struct ospf_interface *);int next_state;
} ISM [OSPF_ISM_STATE_MAX][OSPF_ISM_EVENT_MAX] =
{{/* DependUpon: dummy state. */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_DependUpon },    /* InterfaceUp    */{ ism_ignore,          ISM_DependUpon },    /* WaitTimer      */{ ism_ignore,          ISM_DependUpon },    /* BackupSeen     */{ ism_ignore,          ISM_DependUpon },    /* NeighborChange */{ ism_ignore,          ISM_DependUpon },    /* LoopInd        */{ ism_ignore,          ISM_DependUpon },    /* UnloopInd      */{ ism_ignore,          ISM_DependUpon },    /* InterfaceDown  */},{/* Down:*/{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_interface_up,    ISM_DependUpon },    /* InterfaceUp    */{ ism_ignore,          ISM_Down },          /* WaitTimer      */{ ism_ignore,          ISM_Down },          /* BackupSeen     */{ ism_ignore,          ISM_Down },          /* NeighborChange */{ ism_loop_ind,        ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_Down },          /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* Loopback: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_Loopback },      /* InterfaceUp    */{ ism_ignore,          ISM_Loopback },      /* WaitTimer      */{ ism_ignore,          ISM_Loopback },      /* BackupSeen     */{ ism_ignore,          ISM_Loopback },      /* NeighborChange */{ ism_ignore,          ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_Down },          /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* Waiting: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_Waiting },       /* InterfaceUp    */{ ism_wait_timer,	   ISM_DependUpon },    /* WaitTimer      */{ ism_backup_seen,     ISM_DependUpon },    /* BackupSeen     */{ ism_ignore,          ISM_Waiting },       /* NeighborChange */{ ism_loop_ind,	   ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_Waiting },       /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* Point-to-Point: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_PointToPoint },  /* InterfaceUp    */{ ism_ignore,          ISM_PointToPoint },  /* WaitTimer      */{ ism_ignore,          ISM_PointToPoint },  /* BackupSeen     */{ ism_ignore,          ISM_PointToPoint },  /* NeighborChange */{ ism_loop_ind,	   ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_PointToPoint },  /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* DROther: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_DROther },       /* InterfaceUp    */{ ism_ignore,          ISM_DROther },       /* WaitTimer      */{ ism_ignore,          ISM_DROther },       /* BackupSeen     */{ ism_neighbor_change, ISM_DependUpon },    /* NeighborChange */{ ism_loop_ind,        ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_DROther },       /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* Backup: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_Backup },        /* InterfaceUp    */{ ism_ignore,          ISM_Backup },        /* WaitTimer      */{ ism_ignore,          ISM_Backup },        /* BackupSeen     */{ ism_neighbor_change, ISM_DependUpon },    /* NeighborChange */{ ism_loop_ind,        ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_Backup },        /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},{/* DR: */{ ism_ignore,          ISM_DependUpon },    /* NoEvent        */{ ism_ignore,          ISM_DR },            /* InterfaceUp    */{ ism_ignore,          ISM_DR },            /* WaitTimer      */{ ism_ignore,          ISM_DR },            /* BackupSeen     */{ ism_neighbor_change, ISM_DependUpon },    /* NeighborChange */{ ism_loop_ind,        ISM_Loopback },      /* LoopInd        */{ ism_ignore,          ISM_DR },            /* UnloopInd      */{ ism_interface_down,  ISM_Down },          /* InterfaceDown  */},
};/* Neighbor State Machine */
struct {int (*func) (struct ospf_neighbor *);int next_state;
} NSM [OSPF_NSM_STATE_MAX][OSPF_NSM_EVENT_MAX] =
{{/* DependUpon: dummy state. */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ NULL,                    NSM_DependUpon }, /* PacketReceived    */{ NULL,                    NSM_DependUpon }, /* Start             */{ NULL,                    NSM_DependUpon }, /* 2-WayReceived     */{ NULL,                    NSM_DependUpon }, /* NegotiationDone   */{ NULL,                    NSM_DependUpon }, /* ExchangeDone      */{ NULL,                    NSM_DependUpon }, /* BadLSReq          */{ NULL,                    NSM_DependUpon }, /* LoadingDone       */{ NULL,                    NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_DependUpon }, /* SeqNumberMismatch */{ NULL,                    NSM_DependUpon }, /* 1-WayReceived     */{ NULL,                    NSM_DependUpon }, /* KillNbr           */{ NULL,                    NSM_DependUpon }, /* InactivityTimer   */{ NULL,                    NSM_DependUpon }, /* LLDown            */},{/* Deleted: dummy state. */{ NULL,                    NSM_Deleted    }, /* NoEvent           */{ NULL,                    NSM_Deleted    }, /* PacketReceived    */{ NULL,                    NSM_Deleted    }, /* Start             */{ NULL,                    NSM_Deleted    }, /* 2-WayReceived     */{ NULL,                    NSM_Deleted    }, /* NegotiationDone   */{ NULL,                    NSM_Deleted    }, /* ExchangeDone      */{ NULL,                    NSM_Deleted    }, /* BadLSReq          */{ NULL,                    NSM_Deleted    }, /* LoadingDone       */{ NULL,                    NSM_Deleted    }, /* AdjOK?            */{ NULL,                    NSM_Deleted    }, /* SeqNumberMismatch */{ NULL,                    NSM_Deleted    }, /* 1-WayReceived     */{ NULL,                    NSM_Deleted    }, /* KillNbr           */{ NULL,                    NSM_Deleted    }, /* InactivityTimer   */{ NULL,                    NSM_Deleted    }, /* LLDown            */},{/* Down: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Init       }, /* PacketReceived    */{ nsm_start,               NSM_Attempt    }, /* Start             */{ NULL,                    NSM_Down       }, /* 2-WayReceived     */{ NULL,                    NSM_Down       }, /* NegotiationDone   */{ NULL,                    NSM_Down       }, /* ExchangeDone      */{ NULL,                    NSM_Down       }, /* BadLSReq          */{ NULL,                    NSM_Down       }, /* LoadingDone       */{ NULL,                    NSM_Down       }, /* AdjOK?            */{ NULL,                    NSM_Down       }, /* SeqNumberMismatch */{ NULL,                    NSM_Down       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* Attempt: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Init       }, /* PacketReceived    */{ NULL,                    NSM_Attempt    }, /* Start             */{ NULL,                    NSM_Attempt    }, /* 2-WayReceived     */{ NULL,                    NSM_Attempt    }, /* NegotiationDone   */{ NULL,                    NSM_Attempt    }, /* ExchangeDone      */{ NULL,                    NSM_Attempt    }, /* BadLSReq          */{ NULL,                    NSM_Attempt    }, /* LoadingDone       */{ NULL,                    NSM_Attempt    }, /* AdjOK?            */{ NULL,                    NSM_Attempt    }, /* SeqNumberMismatch */{ NULL,                    NSM_Attempt    }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* Init: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Init      }, /* PacketReceived    */{ NULL,                    NSM_Init       }, /* Start             */{ nsm_twoway_received,     NSM_DependUpon }, /* 2-WayReceived     */{ NULL,                    NSM_Init       }, /* NegotiationDone   */{ NULL,                    NSM_Init       }, /* ExchangeDone      */{ NULL,                    NSM_Init       }, /* BadLSReq          */{ NULL,                    NSM_Init       }, /* LoadingDone       */{ NULL,                    NSM_Init       }, /* AdjOK?            */{ NULL,                    NSM_Init       }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* 2-Way: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_TwoWay     }, /* HelloReceived     */{ NULL,                    NSM_TwoWay     }, /* Start             */{ NULL,                    NSM_TwoWay     }, /* 2-WayReceived     */{ NULL,                    NSM_TwoWay     }, /* NegotiationDone   */{ NULL,                    NSM_TwoWay     }, /* ExchangeDone      */{ NULL,                    NSM_TwoWay     }, /* BadLSReq          */{ NULL,                    NSM_TwoWay     }, /* LoadingDone       */{ nsm_adj_ok,              NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_TwoWay     }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* ExStart: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_ExStart    }, /* PacaketReceived   */{ NULL,                    NSM_ExStart    }, /* Start             */{ NULL,                    NSM_ExStart    }, /* 2-WayReceived     */{ nsm_negotiation_done,    NSM_Exchange   }, /* NegotiationDone   */{ NULL,                    NSM_ExStart    }, /* ExchangeDone      */{ NULL,                    NSM_ExStart    }, /* BadLSReq          */{ NULL,                    NSM_ExStart    }, /* LoadingDone       */{ nsm_adj_ok,              NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_ExStart    }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* Exchange: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Exchange   }, /* PacketReceived    */{ NULL,                    NSM_Exchange   }, /* Start             */{ NULL,                    NSM_Exchange   }, /* 2-WayReceived     */{ NULL,                    NSM_Exchange   }, /* NegotiationDone   */{ nsm_exchange_done,       NSM_DependUpon }, /* ExchangeDone      */{ NULL,                    NSM_ExStart    }, /* BadLSReq          */{ NULL,                    NSM_Exchange   }, /* LoadingDone       */{ nsm_adj_ok,              NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_ExStart    }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{/* Loading: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Loading    }, /* PacketReceived    */{ NULL,                    NSM_Loading    }, /* Start             */{ NULL,                    NSM_Loading    }, /* 2-WayReceived     */{ NULL,                    NSM_Loading    }, /* NegotiationDone   */{ NULL,                    NSM_Loading    }, /* ExchangeDone      */{ NULL,                    NSM_ExStart    }, /* BadLSReq          */{ NULL,                    NSM_Full       }, /* LoadingDone       */{ nsm_adj_ok,              NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_ExStart    }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},{ /* Full: */{ NULL,                    NSM_DependUpon }, /* NoEvent           */{ nsm_packet_received,     NSM_Full       }, /* PacketReceived    */{ NULL,                    NSM_Full       }, /* Start             */{ NULL,                    NSM_Full       }, /* 2-WayReceived     */{ NULL,                    NSM_Full       }, /* NegotiationDone   */{ NULL,                    NSM_Full       }, /* ExchangeDone      */{ NULL,                    NSM_ExStart    }, /* BadLSReq          */{ NULL,                    NSM_Full       }, /* LoadingDone       */{ nsm_adj_ok,              NSM_DependUpon }, /* AdjOK?            */{ NULL,                    NSM_ExStart    }, /* SeqNumberMismatch */{ NULL,                    NSM_Init       }, /* 1-WayReceived     */{ nsm_kill_nbr,            NSM_Deleted    }, /* KillNbr           */{ nsm_kill_nbr,            NSM_Deleted    }, /* InactivityTimer   */{ nsm_kill_nbr,            NSM_Deleted    }, /* LLDown            */},
};

这篇关于ospf-ism-and-nsm-code-printf的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/576633

相关文章

Debugging Lua Project created in Cocos Code IDE creates “Waiting for debugger to connect” in Win-7

转自 I Installed Cocos Code IDE and created a new Lua Project. When Debugging the Project(F11) the game window pops up and gives me the message waiting for debugger to connect and then freezes. Also a

LLVM入门2:如何基于自己的代码生成IR-LLVM IR code generation实例介绍

概述 本节将通过一个简单的例子来介绍如何生成llvm IR,以Kaleidoscope IR中的例子为例,我们基于LLVM接口构建一个简单的编译器,实现简单的语句解析并转化为LLVM IR,生成对应的LLVM IR部分,代码如下,文件名为toy.cpp,先给出代码,后面会详细介绍每一步分代码: #include "llvm/ADT/APFloat.h"#include "llvm/ADT/S

VS Code 调试go程序的相关配置说明

用 VS code 调试Go程序需要在.vscode/launch.json文件中增加如下配置:  // launch.json{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information,

code: 400, msg: Required request body is missing 错误解决

引起这个错误的原因是,请求参数按照get方式给。 应该给json字符串才对 补充: 1. @RequestBody String resource 加@RequestBody必须给json字符串,否则会报错400,记如标题错误。 不加这个的进行请求的话,其实post和get就没有什么区别了。 2. List<String> indexCodes=(List<String>)json.

iOS项目发布提交出现invalid code signing entitlements错误。

1、进入开发者账号,选择App IDs,找到自己项目对应的AppId,点击进去编辑, 2、看下错误提示出现  --Specifically, value "CVYZ6723728.*" for key "com.apple.developer.ubiquity-container-identifiers" in XX is not supported.-- 这样的错误提示 将ubiquity

解决服务器VS Code中Jupyter突然崩溃的问题

问题 本来在服务器Anaconda的Python环境里装其他的包,装完了想在Jupyter里写代码验证一下有没有装好,一运行发现Jupyter崩溃了!?报错如下所示 Failed to start the Kernel. ImportError: /home/hujh/anaconda3/envs/mia/lib/python3.12/lib-dynload/_sqlite3.cpython-

H3C SR-MPLS通过OSPF通告SID配置

首先在配置前理解几个基本概念 Prefix SID配置 统一分配和配置(全局规划)loopback和prefix sidPrefix SID=SRGB Base(16000)+index Adj SID自动生成 对应SR节点间的互联链路SR节点本地标识,从设备本地Segment池中动态分配设备会为其IGP中的链路自动分配Adj SID,并通过IGP进行广播 IGP SID的分发与传递

Behind the Code:与 Rakic 和 Todorovic 对话 OriginTrail 如何实现 AI 去中心化

原文:https://www.youtube.com/watch?v=ZMuLyLCtE3s&list=PLtyd7v_I7PGnko80O0LCwQQsvhwAMu9cv&index=12 作者:The Kusamarian 编译:OneBlock+ 随着人工智能技术的飞速发展,一系列前所未有的挑战随之而来:模型的衰退与互联网的潜在威胁愈发明显。AI 的增长曲线可能因训练过程中的瓶颈而趋于平

冒泡排序和鸡尾酒排序(code)

昨天回顾了下冒泡排序和鸡尾酒排序,用面向对象的方式写了一下,并且优化了代码,记录一下~ 一、冒泡排序 # 冒泡排序class BubbleSort(object):def __init__(self, data_list):self.data_list = data_listself.length = len(data_list)# 简单粗暴的排序方式def b_sort(self):d

编译时出现错误 -- clang: error: linker command failed with exit code 1 (use -v to see invocation)

出现这个错误的原因有多种,常见的是因为某些文件的缺失或者是文件的重复导致的。 这类错误查看的关键在于其上一行的文字。 对于文件缺少而导致错误的情况: 例如上图中的示例,其上一行文字为 ld:library not found for -lrxl,可以看出是缺失了某一文件而导致的错误,这行文字中的最后“ -lrxl ”:-l 代表着其前缀是“lib”,连着后面的 rxl,其名称为 libr