Click Notes II - Click Script Language

Click编程语言主要用于配置Click路由器,同时也可用于编写Click元件的测试案例。该语言定义了一种配置图,由相互连接的元件组成。每个元件都有一个指定的元件类别,并通过输入和输出端口进行连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The Click programming language was developed to configure Click routers, but nowadays you also can use it to write test cases for Click elements.

  1. Basic Syntax
  2. Element Group
  3. Compound Element
  4. Script
  5. Testie

Basic Syntax

The Click Script Language defines a configuration graph, which consists of connected elements. Each element has an element class specified by class name. Elements are connected through their input and output ports. Input and output ports are distinguished by number, while elements are distinguished by name.

Click configuration strings are comma-separated lists of arguments delimited by parentheses. The fundamental syntax of Click Script Language is:

 
  1. name :: class(config-string); // declare element object
  2. name1, name2, ..., nameN :: class(config); // declaration shorhand
  3. name1[port1] -> [port2]name2; // connect two elements
  4. name1[port1] -> [port2a]name2[port2b] -> [port3]name3; // piggyback connections
  5. name1 -> name2 :: class(config-string) -> name3; // declaring elements inside connections is allowed
  6. name1 -> class(config-string) -> name3; // anonymous element
  7. require(requirement[, requirement …]); // list config requirements
  8. n1, n2 :: class -> n3; // many-to-one connections
  9. // many-to-many connections:
  10. // A many-to-many connection matches output ports to input ports.
  11. // There must be as many ports on the left as on the right.
  12. // '=>' is the many-to-many connector.
  13. c[0], c[1], c[2] => Paint(0), Paint(1), Paint(2) -> next;
  14. c => Paint(0), Paint(1), Paint(2) -> next;

- See more at: http://www.bo-yang.net/2015/01/07/click-notes-click-language/#sthash.ayG2hR5q.dpuf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值