home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / CHIPCD_2_2000.iso / software / testsoft / anasil / _SETUP.1 / TCPIP.DEC < prev    next >
Text File  |  1998-07-13  |  7KB  |  259 lines

  1. ; ************************************************************************
  2. ;
  3. ; Plik z definicjami dekodera ramek dla protokolu TCP/IP
  4. ;
  5. ; ************************************************************************
  6.  
  7. [# IP_PROT_TYPE ]
  8.    Translate( 0x00,"Unknown" )
  9.    @ipprot.dec
  10.  
  11. [# IP_OPT_TYPE ]
  12.    Translate( 0x07,"Record Route (0x07)" )
  13.    Translate( 0x44,"Timestamp (0x44)" )
  14.  
  15. [# TCP_OPT_TYPE ]
  16.    Translate( 0,"End of option list" )
  17.    Translate( 1,"No operation" )
  18.    Translate( 2,"Max. segment size" )
  19.    Translate( 3,"Window scale factor" )
  20.    Translate( 4,"TCP SACK Permitted" )
  21.    Translate( 5,"TCP SACK" )
  22.    Translate( 6,"TCP Echo request" )
  23.    Translate( 7,"TCP Echo reply" )
  24.    Translate( 8,"Timestamp" )
  25.    Translate( 11,"Probe MTU" )
  26.    Translate( 12,"Reply MTU" )
  27.  
  28. [# UDP_PORT_TABLE]
  29.    @udpport.dec
  30.  
  31. [# TCP_PORT_TABLE]
  32.    @tcpport.dec
  33.  
  34. [# OSPF_TYPES ]
  35.    Translate( 0x01,"Hello (0x01)" )
  36.    Translate( 0x02,"Database description (0x02)" )
  37.    Translate( 0x03,"Link state request (0x03)" )
  38.    Translate( 0x04,"Link state update (0x04)" )
  39.    Translate( 0x05,"Link state acknowledgment (0x05)" )
  40.  
  41.  
  42. ;-----------------------------------------------------------
  43. ;
  44. ;  Definicje fragmentow ramek
  45. ;
  46. ;  Kazda linia ma nastepujacy format:
  47. ;    Linia,Kolumna,Max.Szerokosc wartosci,Label,Format.Zmienna[,id tablicy translacji (tylko dla typow numerycznych)]
  48. ;
  49.  
  50.  
  51. [$ IP_Header ]
  52.   Layer( "IP header","IP" )
  53.   Field( 0,0,3,"Version", "%d", Byte(0,4,7) ) = IP_HEADER_OFFSET
  54.   Field( 0,1,3,"Header length", "%d", Byte(0,0,3) ) = IP_HEAD_LEN
  55.   Field( 1,0,3,"TOS", "%02X", Byte(1) )
  56.   Field( 1,1,5,"Total length", "%d", RWord(2) )
  57.   Field( 2,0,5,"Ident.", "%u", RWord(4) )
  58.   Field( 2,1,3,"Flags", "%X", RWord(6,13,15) )
  59.   Field( 3,0,5,"Fragment offset", "%d", RWord(6,0,12) )
  60.   Field( 3,1,3,"TTL", "%d", Byte(8) )
  61.   Field( 4,0,1,"Protocol", "%s", Byte(9), IP_PROT_TYPE ) = IP_PROT_OFF
  62.   Field( 5,0,5,"Checksum", "%04X", RWord(10) )
  63.  
  64. [$ IP_Header2 ]
  65.   Field( 0,0,15,"Source IP Address", "%s", DString(0,4,".") )
  66.   Field( 1,0,15,"Dest. IP Address", "%s", DString(4,4,".") )
  67.  
  68. [$ IP_Option_Header ]
  69.   Field( 0,0,2,"Option", "%s", Byte(0), IP_OPT_TYPE )
  70.   Field( 1,0,3,"Length", "%d", Byte(1) )
  71.   Field( 1,1,3,"Ptr", "%d", Byte(2) )
  72.   Field( 2,0,1,"Data", "%s", HString(3,(Byte(1)-3)," ") )
  73.  
  74. [$ TCP_Header ]
  75.   Layer( "TCP header","TCP" )
  76.   Field( 0,0,1,"Source port","%s", RWord(0), TCP_PORT_TABLE ) = TCP_HEAD_OFFSET
  77.   Field( 1,0,1,"Dest.  port","%s", RWord(2), TCP_PORT_TABLE ) = TCP_DEST_PORT
  78.   Field( 2,0,10,"Seq. number","%08X", RLong(4) )
  79.   Field( 2,1,10,"Ack. number","%08X", RLong(8) )
  80.  
  81. [$ TCP_Header2 ]
  82.   Field( 0,0,3,"Header len.", "%d", RWord(0,12,15) ) = TCP_HEAD_LEN
  83.   Field( 0,1,3,"Reserved", "%d", RWord(0,6,11) )
  84.   Field( 1,0,3,"Urgent", "%d", RWord(0,5,5) )
  85.   Field( 1,1,3,"ACK", "%d", RWord(0,4,4) )
  86.   Field( 2,0,3,"PSH", "%d", RWord(0,3,3) )
  87.   Field( 2,1,3,"RST", "%d", RWord(0,2,2) )
  88.   Field( 3,0,3,"SYN", "%d", RWord(0,1,1) )
  89.   Field( 3,1,3,"FIN", "%d", RWord(0,0,0) )
  90.   Field( 5,0,6,"Window size", "%d", RWord(2) )
  91.   Field( 6,0,6,"TCP Checksum", "%d", RWord(4) )
  92.   Field( 6,1,6,"Urgent pointer", "%d", RWord(6) )
  93.  
  94. [$ TCP_Option_Header ]
  95.   Field( 0,0,2,"Option", "%s", Byte(0), TCP_OPT_TYPE ) = TCP_OPTION
  96.  
  97. [$ TCP_OptionLen_Header ]
  98.   Field( 0,0,3,"Length", "%d", Byte(0) ) = TCP_OPTION_LEN
  99.   Field( 1,0,1,"Data", "%s", HString(1,(Byte(0)-2)," ") )
  100.  
  101. [$ UDP_Header ]
  102.   Layer( "UDP header","UDP" )
  103.   Field( 0,0,1,"Source port", "%s", RWord(0), UDP_PORT_TABLE ) = UDP_SOURCE_PORT
  104.   Field( 1,0,1,"Dest.  port", "%s", RWord(2), UDP_PORT_TABLE ) = UDP_DEST_PORT
  105.   Field( 2,0,5,"Length", "%d", RWord(4) )
  106.   Field( 2,1,5,"Checksum", "%d", RWord(6) )
  107.  
  108. [$ OSPF_Header ]
  109.   Layer( "OSPF header","OSPF" )
  110.   Field( 0,0,4,"Version:", "%d", Byte(0) )
  111.   Field( 0,1,1,"Type:", "%s", Byte(1), OSPF_TYPES ) = OSPF_TYPE_OFF
  112.   Field( 1,0,4,"Length :", "%d", RWord(2) )
  113.   Field( 3,0,3,"Router ID   :", "%s", DString(4,4,".") )
  114.   Field( 4,0,3,"Area ID     :", "%s", DString(8,4,".") )
  115.   Field( 5,0,1,"Checksum    :", "%04X", RWord(12) )
  116.   Field( 6,0,1,"Auth. type  :", "%d", RWord(14) )
  117.   Field( 8,0,1,"Auth (hex)  :", "%s", HString(16,8," ") )
  118.   Field( 9,0,1,"Auth (ascii):", "'%s'", String(16,8) )
  119.  
  120. [$ OSPF_HELLO_Header ]
  121.   Layer( "OSPF HELLO","OSPF-HELLO" )
  122.   Field( 0,0,3,"Network mask:", "%s", DString(0,4,".") )
  123.   Field( 2,0,3,"Interval :", "%d", RWord(4) )
  124.   Field( 3,0,3,"Options  :", "%d", Byte(6) )
  125.   Field( 4,0,3,"Priotity :", "%d", Byte(7) )
  126.   Field( 5,0,1,"Dead Interval:", "%d", RLong(8) )
  127.   Field( 7,0,1,"Designated router:", "%s", DString(12,4,".") )
  128.   Field( 8,0,1,"Backup router    :", "%s", DString(16,4,".") )
  129.  
  130. [$ IGMP_Header ]
  131.   Layer( "IGMP","IGMP" )
  132.   Field( 0,0,0,"Version       : ", "%d", Byte(0,4,7) )
  133.   Field( 1,0,0,"Type          : ", "%d", Byte(0,0,3) )
  134.   Field( 2,0,0,"Unused        : ", "%d", Byte(1) )
  135.   Field( 3,0,0,"Checksum      : ", "%d", RWord(2) )
  136.   Field( 4,0,0,"Group address : ", "%s", DString(4,4,".") )
  137.   
  138. ;-----------------------------------------------------------
  139. ;
  140. ;  Sekcje komend
  141. ;
  142.  
  143. [^ IP_Frame]
  144. expand(IP_Header)
  145. expand(IP_Header2)
  146.  
  147. On( Byte(IP_HEAD_LEN,0,3)>5 )
  148.    goto(IP_Option)
  149. OnEnd
  150.  
  151. goto(IP_End)
  152.  
  153.  
  154. [^ IP_Option ]
  155. expand(IP_Option_Header)
  156.  
  157. On( (IP_HEADER_OFFSET*(-1)+1) < (Byte(IP_HEAD_LEN,0,3)*4) )
  158.    goto(IP_Option)
  159. OnEnd
  160.  
  161. Skip( IP_HEADER_OFFSET+(Byte(IP_HEAD_LEN,0,3)*4) )
  162.  
  163. goto(IP_End)
  164.  
  165.  
  166. [^ IP_End ]
  167.  
  168. TableJump( Byte(IP_PROT_OFF) )
  169.    1,ICMP_Frame
  170.    2,IGMP_Frame
  171.    6,TCP_Frame
  172.   17,UDP_Frame
  173.   89,OSPF_Frame
  174. TableEnd 
  175.  
  176. goto(Undecoded)
  177.  
  178. ;-----------------------------------------------------------
  179. ;
  180. ;  Protokol TCP
  181. ;
  182.  
  183. [^ TCP_Frame ]
  184. expand(TCP_Header)
  185. expand(TCP_Header2)
  186.  
  187. On( RWord(TCP_HEAD_LEN,12,15)>5 )
  188.    goto(TCP_Option)
  189. OnEnd
  190.  
  191. goto(TCP_End)
  192.  
  193. [^ TCP_Option ]
  194. expand(TCP_Option_Header)
  195.  
  196. On( ( Byte(TCP_OPTION)<>0 )&( Byte(TCP_OPTION)<>1 ) )
  197.    expand(TCP_OptionLen_Header)
  198. OnEnd
  199.  
  200. On( (TCP_HEAD_OFFSET*(-1)+1) < (RWord(TCP_HEAD_LEN,12,15)*4) )
  201.    goto(TCP_Option)
  202. OnEnd
  203.  
  204. Skip( TCP_HEAD_OFFSET+(RWord(TCP_HEAD_LEN,12,15)*4) )
  205.  
  206. goto(TCP_End)
  207.  
  208. [^ TCP_End ]
  209.  
  210. On( (RWord(TCP_HEAD_OFFSET)==53)|(RWord(TCP_DEST_PORT)==53) )
  211.   goto(DNS_Frame)
  212. OnEnd
  213.  
  214. goto(Undecoded)
  215.  
  216.  
  217. ;-----------------------------------------------------------
  218. ;
  219. ;  Protokol UDP
  220. ;
  221.  
  222. [^ UDP_Frame ]
  223. expand(UDP_Header)
  224.  
  225. On( (RWord(UDP_SOURCE_PORT)==53)|(RWord(UDP_DEST_PORT)==53) )
  226.   goto(DNS_Frame)
  227. OnEnd
  228.  
  229. goto(Undecoded)
  230.  
  231. ;-----------------------------------------------------------
  232. ;
  233. ;  Protokol OSPF
  234. ;
  235.  
  236. [^ OSPF_Frame ]
  237. expand(OSPF_Header)
  238.  
  239. TableJump( Byte(OSPF_TYPE_OFF) )
  240.    1,OSPF_HELLO_Frame
  241. TableEnd 
  242.  
  243. goto(Undecoded)
  244.  
  245.  
  246. [^ OSPF_HELLO_Frame ]
  247. expand(OSPF_HELLO_Header)
  248. goto(Undecoded)
  249.  
  250. ;------------------------------------------------------------
  251. ;
  252. ;  Protokol IGMP
  253. ;
  254.  
  255. [^ IGMP_Frame ]
  256. expand(IGMP_Header)
  257. goto(Undecoded)
  258.  
  259.