# @(#)pinfo.tcl	1.3

array set pinfoHelp {

packet	"\nDescription: packet\n\nPackets are stored in a internal variable structure.  They consist of a\ndata part, a protocol table, and a length.  The data part consists simply\nof the bytes of the packet in network order.  The protocol table contains\na list of (protocol name, byte offset) entries which describe each portion\nof the packet the Packet Shell is able to identify.  This data can be\naccessed to help identify or process the packet."

protocol	"\nDescription: protocol\n\n"

prlayer	"\nDescription: prlayer\n\nWherever <prlayer> is indicated it means that it may be a protocol name,\nfollowed by a colon and a number.  If just a protocol name is supplied,\nit means the first instance in the packet of that protocol name.  If the\nform is a number, it means the n-th protocol layer in the packet.  It is\nzero indexed, so 0 indicates the first layer of the packet, one indicates\nthe second layer, etc.  If the protocol:number form is used, it means the\nnumbered instance of the indicated protocol in the packet.  This can be\nuseful in situations such as tunneling encapsulation where you might find\nan IP header inside an IP header to specify which IP header you want."

popen	"\nUsage: popen <protocol> <ep> ...\n\nOpen an end-point to send and receive packets of the given protocol, <ep>\nis the name of a descriptor which names the end-point.  By convention all\noperations on this end-point will be Tcl commands of the form <ep>.operation.\nNote that the operation names are determined by the protocol library."

pclose	"\nUsage: pclose <protocol> <ep> ...\n\nClose a previously opened end-point."

pinit	"\nUsage: pinit <protocol> <pkt> [<max. length> [<structure length>]] ...\n\nInitialize a new packet named <pkt> of the protocol specified.  Optional\nare <max. length> which represents the size in bytes of the buffer space\nto be allocated, as well as <structure length> which represents the size in\nbytes of the protocol/structure.  Any additional options are passed on to\nthe protocol itself, and may be used to initialize the packet in a suitable\nway for that protocol.\n\nIf a Tcl procedure has been defined for pinit (see pdefine), the Tcl procedure\nwill be invoked instead of the protocol library.\n\nA Tcl variable, pktlength, exists that defines the value for <max. length>\nby default.  It is currently set to 1600.  You can change it by entering\nset pktlength <value>."

pfree	"\nUsage: pfree <pkt> ...\n\nDelete and free the packet indicated.  Any additional options are passed on\nto the first protocol in the packet itself, and may be used to remove the\npacket in a suitable way for that protocol. "

plist	"\nUsage: plist <pkt> [<prlayer>] ...\n\nProvides a convenient listing of the contents of the indicated packet,\nor optionally the protocol layer named <prlayer>.  Any additional options\nare passed on to the protocol itself, and may be used to list the packet\nin a suitable way for that protocol.\n\nIf a Tcl procedure has been defined for plist (see pdefine), the Tcl\nprocedure will be invoked instead of the protocol library.\n\nWherever <prlayer> is indicated it means that it may be a protocol name,\nor a number, or a protocol name followed by a colon and a number.  If just\na protocol name is supplied, it means the first instance in the packet of\nthat protocol name.  If the form is a number, it means the n-th protocol\nlayer in the packet.  It is zero indexed, so 0 indicates the first layer\n of the packet, etc.  If the protocol:number form is used, it means the\nnumbered instance of the indicated protocol in the packet."

pset	"\nUsage: pset <pkt> <prlayer> <fieldname> [<value>] ...\n\nSet the indicated field in the indicated packet and protocol layer.\nNormally, a value is not optional, however some options have a boolean\nsense.  Any additional options are passed on to the protocol itself, and\nmay be used to set the field in a suitable way for that protocol.\n\nFor dynamically created protocols (see pdefine), the logic for setting\nvalues is the following:\n\n\tIf a Tcl procedure is defined for that field, then the Tcl procedure\n\tis executed.\n\n\tIf a C function is defined for that field, then the C function is\n\texecuted.\n\n\tOtherwise the pset function in that protocol library is executed\n\tif it exists (older model).\n\nFor more information on <prlayer>, enter pinfo prlayer at the prompt."

pget	"\nUsage: pget <pkt> <prlayer> <fieldname> ...\n\nReturn a string representation of the field of the indicated protocol.\nThis command is useful to extract parts of the packet into Tcl variables\nand provides more detail than the plist command.  Any additional options\nare passed on to the protocol itself, and may be used to get the field\nin a suitable way for that protocol.\n\nFor dynamically created protocols (see pdefine), the logic for getting\nvalues is the following:\n\n\tIf a Tcl procedure is defined for that field, then the Tcl procedure\n\tis executed.\n\n\tIf a C function is defined for that field, then the C function is\n\texecuted.\n\n\tOtherwise the pset function in that protocol library is executed\n\tif it exists (older model).\n\nFor more information on <prlayer>, enter pinfo prlayer at the prompt."

protocols	"\nUsage: protocols\n\nList of all protocols currently defined."

packets	"\nUsage: packets\n\nList of all initialized packets, their current packet length and\nmaximum packet length."

pcopy		"\nUsage: pcopy <dstpkt> <srcpkt1> [<srcpkt2>...]\n\nCopy one or more source packets into another packet.\nEach pkt component is of the form packet/prlayer.  If the prlayer is the\nspecial string 'all' then the entire packet is identified to participate.\nA sample use:\n\tpcopy dpkt/end spkt1/ip spkt2/icmp\n\nmeans append (copy over prlayer 'end') the ip segment from packet spkt1\nand the icmp segment from the packet spkt2\n\n"

poffset		"\nUsage: poffset <pkt> <prlayer>\n\nReturn the offset of the named <prlayer> in <pkt>.\n\n"

pproto		"\nUsage: pproto <pkt> <prlayer>\n\nReturn the protocol name of the identified <prlayer> in packet <pkt>.\n\n"

plen		"\nUsage: plen <pkt> <prlayer> [<length>]\n\nGet or set the length of <prlayer>.\n\nIf the optional <length> argument is not present, returns the length of\n<prlayer>.  If <length> is present, the length of that <prlayer> is changed\nto <length>.\n\n"

pcast		"\nUsage: pcast <packet> <prlayer> <protocol>\n\nCast the indicated <prlayer> to <protocol>.  <protocol> must be a valid\nprotocol understood by the packet shell.  (See protocols command.)\nThe packet is re-decoded, from the new prlayer forward to the end of the packet\nto ensure that if a different layering is visible to <protocol> it can make that\n
happen.\n\n"

pread	"\nUsage: pread <pckt>[/<prlayer>] <b|w|l|p> <offset> <len>\n\n"

psleep	"\nUsage: psleep <time>\n\n"

pwrite	"\nUsage: pwrite <pckt>[/<prlayer>] <b|w|l|p> <offset> <value> ...\n\n"

pdump	"\nUsage: pdump <pckt>\n\n"

pcktime	"\nUsage: pcktime\n\tpcktime <pkt>\nFirst form - current time\nSecond form - arrival time of <pkt>\n\n"

ptbl	"\nUsage: ptbl <pckt>\nPrint the packet table for packet <pckt>\n\n"

packets	"\nUsage: packets\nList all currently active packet variables\n\n"

protocols	"\nUsage: protocols\nList all protocols currently defined.\n\n"

pdelete	"\nUsage: pdelete <protocol> [<fieldname>]\nDelete a pdefine'd protocol, or, if the optional <fieldname> argument is\nsupplied then delete that field's definition for the named protocol.\n\n"

pretrieve	"\nUsage: pretrieve <protocol>\n\tpretrieve <protocol> pinit\n\tpretrieve <protocol> decode\n\tpretrieve <protocol> list\n\tpretrieve <protocol> fieldnames\n\tpretrieve <protocol> <fieldname> desc\n\tpretrieve <protocol> <fieldname> offset\n\tpretrieve <protocol> <fieldname> size\n\tpretrieve <protocol> <fieldname> get\n\tpretrieve <protocol> <fieldname> set\n\n"

pdefine		"\nUsage: pdefine <protocol> <fieldname> <desc> <offset> <size> [<set> [<get>]]\n\tpdefine <protocol> <fieldname> desc <desc>\n\tpdefine <protocol> <fieldname> offset <offset>\n\tpdefine <protocol> <fieldname> size <size>\n\tpdefine <protocol> <fieldname> set [<set>]\n\tpdefine <protocol> <fieldname> get [<get>]\n\tpdefine <protocol> pinit <pinit>\n\tpdefine <protocol> decode <decode>\n\tpdefine <protocol> list <list>\n\n"

}


