⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.cc

📁 802.15.4 mac 协议源程序
💻 CC
📖 第 1 页 / 共 3 页
字号:
ParseTable::ParseTable(TraceEvent * _pending) {  TraceSyntax * ts;    syntax_list = NULL;  syntax_list_tail = NULL;  pending = _pending;  // Comment  ts = addTraceSyntax('#', "comment -- this line is ignored");  // Time sync dummy event  ts = addTraceSyntax('T', "Dummy event to be used in time synchronization");  ts->addAttribute('t', &pending->time, "time", "-1.0", true, "time");  // ---- Node ----  // Wireless node stuff seems to be wierd.  // A lot of the code dealing with wireless bases decisions on number of attributes  // and not a wireless attribute flag.   ts = addTraceSyntax('n', "node");  ts->addAttribute('t', &pending->time, "time", "-1.0", true, "time");  ts->addAttribute('s', &pending->ne.src, "int", "-1", true, "node id");   ts->addAttribute('u', &pending->ne.x_vel_, "double", "0.0", false, "x velocity");  ts->addAttribute('U', &pending->ne.x_vel_, "double", "0.0", false, "x velocity");  ts->addAttribute('V', &pending->ne.y_vel_, "double", "0.0", false, "y velocity");  // old nam syntax allowed for -v to also mean y velocity  ts->addAttribute('v', &pending->ne.mark.shape, "shape", "circle", false, "shape (circle, box, hexagon)", &pending->ne.y_vel_);  ts->addAttribute('c', &pending->ne.node.color, "color", "black", false, "color");   ts->addAttribute('z', &pending->ne.size, "double", "10.0", false, "size of node");   ts->addAttribute('a', &pending->ne.node.addr, "int", "0", false, "address");   ts->addAttribute('x', &pending->ne.x, "double", "0.0", false, "x location");   ts->addAttribute('y', &pending->ne.y, "double", "0.0", false, "y location");   ts->addAttribute('Z', &pending->ne.z, "double", "0.0", false, "z location (not supported)");   ts->addAttribute('i', &pending->ne.node.lcolor, "color", "black", false, "label color");  ts->addAttribute('b', &pending->ne.node.dlabel, "string", "", false, "label"); // Initialization  ts->addAttribute('l', &pending->ne.node.dlabel, "string", "", false, "label");  ts->addAttribute('o', &pending->ne.node.oldColor, "color", "gray", false, "previous color");  ts->addAttribute('S', &pending->ne.node.state, "string", "UP", false, "state (UP, DOWN, COLOR)");  ts->addAttribute('L', &pending->ne.node.odlabel, "string", "", false, "previous label");  ts->addAttribute('p', &pending->ne.node.direction, "string", "", false, "label location");  ts->addAttribute('P', &pending->ne.node.odirection, "string", "", false, "previous label location");  ts->addAttribute('i', &pending->ne.node.lcolor, "color", "black", false, "inside label color");  ts->addAttribute('I', &pending->ne.node.olcolor, "color", "black", false, "previous inside label color");  ts->addAttribute('e', &pending->ne.node.dcolor, "color", "black", false, "label color");  ts->addAttribute('E', &pending->ne.node.odcolor, "color", "black", false, "previous label color");  ts->addAttribute('T', &pending->ne.stoptime, "double", "0.0", false, "duration of movement");  ts->addAttribute('w', &pending->ne.wireless, "flag", "0", false, "wireless node");  // ---- Link ----  ts = addTraceSyntax('l', "link");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->le.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->le.dst, "int", "-1", true, "destination id");   ts->addAttribute('r', &pending->le.link.rate, "double", "1.0", false, "transmission rate");   ts->addAttribute('D', &pending->le.link.delay, "double", "1.0", false, "delay");   ts->addAttribute('h', &pending->le.link.length, "double", "1.0", false, "length");   ts->addAttribute('O', &pending->le.link.angle, "orientation", "1.0", false, "orientation");   ts->addAttribute('b', &pending->le.link.dlabel, "string", "", false, "label");  ts->addAttribute('c', &pending->le.link.color, "color", "black", false, "color");  // old nam syntax allowed for 'o' to be color or orientation  ts->addAttribute('o', &pending->le.link.oldColor, "color", "gray", false, "previous color", &pending->le.link.angle);    ts->addAttribute('S', &pending->le.link.state, "string", "UP", true, "state (UP, DOWN)");   // old nam syntax allowed for 'l' to be length or label  ts->addAttribute('l', &pending->le.link.dlabel, "string l", "", false, "label", &pending->le.link.length);   ts->addAttribute('L', &pending->le.link.odlabel, "string", "", false, "previous label");   ts->addAttribute('e', &pending->le.link.dcolor, "color", "", false, "label color");   ts->addAttribute('E', &pending->le.link.odcolor, "color", "", false, "previous label color");     // ---- Enqueue Packet ----  ts = addTraceSyntax('+', "enqueue packet");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "packet color attribute id");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   ts->addAttribute('y', &pending->pe.namgraph_flags, "comment", "{0 0}", false, "");  ts->addAttribute('S', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('m', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('f', &pending->pe.namgraph_flags.size, "int", "0", false, "");     // ---- Dequeue Packet ----  ts = addTraceSyntax('-', "dequeue packet");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   ts->addAttribute('y', &pending->pe.namgraph_flags, "comment", "{0 0}", false, "");  ts->addAttribute('S', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('m', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('f', &pending->pe.namgraph_flags.size, "int", "0", false, "");  // ---- Hop ----  ts = addTraceSyntax('h', "hop");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   ts->addAttribute('y', &pending->pe.namgraph_flags, "comment", "{0 0}", false, "");  ts->addAttribute('S', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('m', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('f', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('R', &pending->pe.pkt.wBcastRadius, "double", "0", false, "wireless broadcast radius");  ts->addAttribute('D', &pending->pe.pkt.wBcastDuration, "double", "0", false, "wireless broadcast duration");     // ---- Receive ----  ts = addTraceSyntax('r', "receive");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   ts->addAttribute('y', &pending->pe.namgraph_flags, "comment", "{0 0}", false, "");  ts->addAttribute('S', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('m', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('f', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('R', &pending->pe.pkt.wBcastRadius, "double", "0", false, "wireless broadcast radius");  ts->addAttribute('D', &pending->pe.pkt.wBcastDuration, "double", "0", false, "wireless broadcast duration");     // ---- Drop Line ----  ts = addTraceSyntax('d', "drop line");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   ts->addAttribute('y', &pending->pe.namgraph_flags, "comment", "{0 0}", false, "");  ts->addAttribute('S', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('m', &pending->pe.namgraph_flags.size, "int", "0", false, "");  ts->addAttribute('f', &pending->pe.namgraph_flags.size, "int", "0", false, "");     // ---- Session Enqueue ----  ts = addTraceSyntax('E', "session enqueue");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");      // ---- session dequeue ----  ts = addTraceSyntax('D', "session dequeue");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");      // ---- Session Drop ----  ts = addTraceSyntax('P', "session drop");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->pe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->pe.dst, "int", "-1", true, "destination id");   ts->addAttribute('e', &pending->pe.pkt.size, "int", "1", false, "extent");   ts->addAttribute('a', &pending->pe.pkt.attr, "int", "0", false, "attribute");   ts->addAttribute('i', &pending->pe.pkt.id, "int", "0", false, "id");   ts->addAttribute('l', &pending->pe.pkt.energy, "int", "0", false, "energy");   ts->addAttribute('c', &pending->pe.pkt.convid, "string", "", false, "conversation");   ts->addAttribute('x', &pending->pe.pkt, "comment", "{-1 -1 }", false, "comment");   ts->addAttribute('p', &pending->pe.pkt.type, "string", "", false, "packet type");   ts->addAttribute('k', &pending->pe.pkt.wtype, "string", "", false, "packet type");   // ---- Agent Event ----  ts = addTraceSyntax('a', "agent");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->ae.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->ae.dst, "int", "-1", false, "destination id");   ts->addAttribute('x', &pending->ae.agent.expired, "flag", "0", false, "remove agent"); //  ts->addAttribute('X', &pending->ae.agent.expired, "flag", "0", false, "remove agent");   ts->addAttribute('n', &pending->ae.agent.name, "string", "", false, "agent name");      // ---- Feature ----  ts = addTraceSyntax('f', "feature");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->fe.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->fe.dst, "int", "-1", false, "destination id");   ts->addAttribute('x', &pending->fe.feature.expired, "flag", "0", false, "remove feature");   ts->addAttribute('T', &pending->fe.feature.type, "char", "", true, "type");   ts->addAttribute('n', &pending->fe.feature.name, "string", "", true, "name");   ts->addAttribute('a', &pending->fe.feature.agent, "string", "", true, "agent");   ts->addAttribute('v', &pending->fe.feature.value, "string", "", true, "value");   ts->addAttribute('o', &pending->fe.feature.oldvalue, "string", "", false, "previous value");     // ---- Group ----  ts = addTraceSyntax('G', "group");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('n', &pending->ge.grp.name, "string", "", true, "name");   ts->addAttribute('i', &pending->ge.src, "int", "-1", true, "node id");   ts->addAttribute('a', &pending->ge.grp.mbr, "int", "-1", true, "group id");   ts->addAttribute('x', &pending->ge.grp.flag, "flag", "0", false, "remove from group");  // ---- LanLink ----  ts = addTraceSyntax('L', "lan link");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->lle.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->lle.dst, "int", "-1", true, "destination id");   ts->addAttribute('o', &pending->lle.angle, "orientation", "0.0", false, "orientation");   ts->addAttribute('O', &pending->lle.angle, "orientation", "0.0", false, "orientation");   // ---- Mark Node ----  ts = addTraceSyntax('m', "mark node");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('n', &pending->me.mark.name, "string", "", true, "name");   ts->addAttribute('s', &pending->me.src, "int", "-1", true, "node id");   ts->addAttribute('c', &pending->me.mark.color, "string", "black", false, "color");   ts->addAttribute('h', &pending->me.mark.shape, "string", "circle", false, "shape (circle, square, hexagon)");   ts->addAttribute('X', &pending->me.mark.expired, "flag", "0", false, "remove mark");     // ---- Routing Event ----  ts = addTraceSyntax('R', "routing event");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->re.src, "int", "-1", true, "source id");   ts->addAttribute('d', &pending->re.dst, "int", "-1", true, "destination id");   ts->addAttribute('g', &pending->re.route.group, "int", "-1", false, "multicast group");   ts->addAttribute('p', &pending->re.route.pktsrc, "packet source", "-1", false, "packet source id or *");   ts->addAttribute('n', &pending->re.route.neg, "flag", "0", false, "negative cache");   ts->addAttribute('x', &pending->re.route.expired, "flag", "0", false, "this route timed out");   ts->addAttribute('T', &pending->re.route.timeout, "double", "0.0", false, "timeout");   ts->addAttribute('m', &pending->re.route.mode, "string", "iif", false, "mode (iif or oif)");   // ---- Execute TCL Expression ----  ts = addTraceSyntax('v', "execute tcl expression");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('e', &pending->ve, "tcl expression", "\n", true, "tcl script");   // ---- Trace File Version ----  ts = addTraceSyntax('V', "set trace file version");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('v', &pending->version, "string", "", true, "time");   ts->addAttribute('a', &pending->dummy, "int", "0", true, "time");   // ---- Use Nam Graph ----  ts = addTraceSyntax('N', "use nam graph");    // ---- Wireless Range ----  ts = addTraceSyntax('W', "wireless range");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('x', &pending->we.x, "int", "100", true, "X");   ts->addAttribute('y', &pending->we.y, "int", "100", true, "Y");     // ---- Energy Status (Future Use) ----  ts = addTraceSyntax('g', "energy status -- for future use");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   // ---- Hierarchical Address Space Configuration ----  // initialized in tcl  ts = addTraceSyntax('A', "hierarchical address space configuration -- initilization only");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('n', &pending->hae.hierarchy, "int", "0", false, "hierarchy");   ts->addAttribute('p', &pending->hae.portshift, "int", "0", false, "port shift");   ts->addAttribute('o', &pending->hae.portmask, "hex", "0xffffffff", false, "port mask");   ts->addAttribute('c', &pending->hae.multicast_shift, "int", "0", false, "mulitcast shift");   ts->addAttribute('a', &pending->hae.multicast_mask, "int", "0", false, "multicast mask");   ts->addAttribute('h', &pending->hae.hierarchy, "int", "0", false, "hierarchy");   ts->addAttribute('m', &pending->hae.nodeshift, "int", "0", false, "node shift");   ts->addAttribute('s', &pending->hae.nodemask, "int", "0", false, "node mask");   // ---- Color Table Configuration ----  // initialized in tcl  ts = addTraceSyntax('c', "color table configuration -- initialization only");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('i', &pending->ce.id, "int", "1", true, "id");   ts->addAttribute('n', &pending->ce.color, "string", "black", true, "color");     // ---- Define Packet Queue ----  ts = addTraceSyntax('q', "create packet queue -- initialization only");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('s', &pending->qe.src, "int", "0", true, "source id");   ts->addAttribute('d', &pending->qe.dst, "int", "0", true, "destination id");   ts->addAttribute('a', &pending->qe.angle, "orientation", "0.0", true, "orientaion");   // ---- layout lan ----  ts = addTraceSyntax('X', "layout lan");  ts->addAttribute('t', &pending->time, "time", "0.0", true, "time");   ts->addAttribute('n', &pending->layoutle.name, "string", "", true, "name");   ts->addAttribute('r', &pending->layoutle.rate, "double", "10.0", true, "rate");   ts->addAttribute('D', &pending->layoutle.delay, "double", "0.0", true, "delay");   ts->addAttribute('o', &pending->layoutle.angle, "orientation", "0.0", false, "orientation");   ts->addAttribute('O', &pending->layoutle.angle, "orientation", "0.0", false, "orientation"); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -