ndp.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. // Copyright 2012 Google, Inc. All rights reserved.
  2. //
  3. // Use of this source code is governed by a BSD-style license
  4. // that can be found in the LICENSE file in the root of the source
  5. // tree.
  6. // Enum types courtesy of...
  7. // http://anonsvn.wireshark.org/wireshark/trunk/epan/dissectors/packet-ndp.c
  8. package layers
  9. import (
  10. "fmt"
  11. "github.com/google/gopacket"
  12. "net"
  13. )
  14. type NDPChassisType uint8
  15. // Nortel Chassis Types
  16. const (
  17. NDPChassisother NDPChassisType = 1
  18. NDPChassis3000 NDPChassisType = 2
  19. NDPChassis3030 NDPChassisType = 3
  20. NDPChassis2310 NDPChassisType = 4
  21. NDPChassis2810 NDPChassisType = 5
  22. NDPChassis2912 NDPChassisType = 6
  23. NDPChassis2914 NDPChassisType = 7
  24. NDPChassis271x NDPChassisType = 8
  25. NDPChassis2813 NDPChassisType = 9
  26. NDPChassis2814 NDPChassisType = 10
  27. NDPChassis2915 NDPChassisType = 11
  28. NDPChassis5000 NDPChassisType = 12
  29. NDPChassis2813SA NDPChassisType = 13
  30. NDPChassis2814SA NDPChassisType = 14
  31. NDPChassis810M NDPChassisType = 15
  32. NDPChassisEthercell NDPChassisType = 16
  33. NDPChassis5005 NDPChassisType = 17
  34. NDPChassisAlcatelEWC NDPChassisType = 18
  35. NDPChassis2715SA NDPChassisType = 20
  36. NDPChassis2486 NDPChassisType = 21
  37. NDPChassis28000series NDPChassisType = 22
  38. NDPChassis23000series NDPChassisType = 23
  39. NDPChassis5DN00xseries NDPChassisType = 24
  40. NDPChassisBayStackEthernet NDPChassisType = 25
  41. NDPChassis23100series NDPChassisType = 26
  42. NDPChassis100BaseTHub NDPChassisType = 27
  43. NDPChassis3000FastEthernet NDPChassisType = 28
  44. NDPChassisOrionSwitch NDPChassisType = 29
  45. NDPChassisDDS NDPChassisType = 31
  46. NDPChassisCentillion6slot NDPChassisType = 32
  47. NDPChassisCentillion12slot NDPChassisType = 33
  48. NDPChassisCentillion1slot NDPChassisType = 34
  49. NDPChassisBayStack301 NDPChassisType = 35
  50. NDPChassisBayStackTokenRingHub NDPChassisType = 36
  51. NDPChassisFVCMultimediaSwitch NDPChassisType = 37
  52. NDPChassisSwitchNode NDPChassisType = 38
  53. NDPChassisBayStack302Switch NDPChassisType = 39
  54. NDPChassisBayStack350Switch NDPChassisType = 40
  55. NDPChassisBayStack150EthernetHub NDPChassisType = 41
  56. NDPChassisCentillion50NSwitch NDPChassisType = 42
  57. NDPChassisCentillion50TSwitch NDPChassisType = 43
  58. NDPChassisBayStack303304Switches NDPChassisType = 44
  59. NDPChassisBayStack200EthernetHub NDPChassisType = 45
  60. NDPChassisBayStack25010100EthernetHub NDPChassisType = 46
  61. NDPChassisBayStack450101001000Switches NDPChassisType = 48
  62. NDPChassisBayStack41010100Switches NDPChassisType = 49
  63. NDPChassisPassport1200L3Switch NDPChassisType = 50
  64. NDPChassisPassport1250L3Switch NDPChassisType = 51
  65. NDPChassisPassport1100L3Switch NDPChassisType = 52
  66. NDPChassisPassport1150L3Switch NDPChassisType = 53
  67. NDPChassisPassport1050L3Switch NDPChassisType = 54
  68. NDPChassisPassport1051L3Switch NDPChassisType = 55
  69. NDPChassisPassport8610L3Switch NDPChassisType = 56
  70. NDPChassisPassport8606L3Switch NDPChassisType = 57
  71. NDPChassisPassport8010 NDPChassisType = 58
  72. NDPChassisPassport8006 NDPChassisType = 59
  73. NDPChassisBayStack670wirelessaccesspoint NDPChassisType = 60
  74. NDPChassisPassport740 NDPChassisType = 61
  75. NDPChassisPassport750 NDPChassisType = 62
  76. NDPChassisPassport790 NDPChassisType = 63
  77. NDPChassisBusinessPolicySwitch200010100Switches NDPChassisType = 64
  78. NDPChassisPassport8110L2Switch NDPChassisType = 65
  79. NDPChassisPassport8106L2Switch NDPChassisType = 66
  80. NDPChassisBayStack3580GigSwitch NDPChassisType = 67
  81. NDPChassisBayStack10PowerSupplyUnit NDPChassisType = 68
  82. NDPChassisBayStack42010100Switch NDPChassisType = 69
  83. NDPChassisOPTeraMetro1200EthernetServiceModule NDPChassisType = 70
  84. NDPChassisOPTera8010co NDPChassisType = 71
  85. NDPChassisOPTera8610coL3Switch NDPChassisType = 72
  86. NDPChassisOPTera8110coL2Switch NDPChassisType = 73
  87. NDPChassisOPTera8003 NDPChassisType = 74
  88. NDPChassisOPTera8603L3Switch NDPChassisType = 75
  89. NDPChassisOPTera8103L2Switch NDPChassisType = 76
  90. NDPChassisBayStack380101001000Switch NDPChassisType = 77
  91. NDPChassisEthernetSwitch47048T NDPChassisType = 78
  92. NDPChassisOPTeraMetro1450EthernetServiceModule NDPChassisType = 79
  93. NDPChassisOPTeraMetro1400EthernetServiceModule NDPChassisType = 80
  94. NDPChassisAlteonSwitchFamily NDPChassisType = 81
  95. NDPChassisEthernetSwitch46024TPWR NDPChassisType = 82
  96. NDPChassisOPTeraMetro8010OPML2Switch NDPChassisType = 83
  97. NDPChassisOPTeraMetro8010coOPML2Switch NDPChassisType = 84
  98. NDPChassisOPTeraMetro8006OPML2Switch NDPChassisType = 85
  99. NDPChassisOPTeraMetro8003OPML2Switch NDPChassisType = 86
  100. NDPChassisAlteon180e NDPChassisType = 87
  101. NDPChassisAlteonAD3 NDPChassisType = 88
  102. NDPChassisAlteon184 NDPChassisType = 89
  103. NDPChassisAlteonAD4 NDPChassisType = 90
  104. NDPChassisPassport1424L3Switch NDPChassisType = 91
  105. NDPChassisPassport1648L3Switch NDPChassisType = 92
  106. NDPChassisPassport1612L3Switch NDPChassisType = 93
  107. NDPChassisPassport1624L3Switch NDPChassisType = 94
  108. NDPChassisBayStack38024FFiber1000Switch NDPChassisType = 95
  109. NDPChassisEthernetRoutingSwitch551024T NDPChassisType = 96
  110. NDPChassisEthernetRoutingSwitch551048T NDPChassisType = 97
  111. NDPChassisEthernetSwitch47024T NDPChassisType = 98
  112. NDPChassisNortelNetworksWirelessLANAccessPoint2220 NDPChassisType = 99
  113. NDPChassisPassportRBS2402L3Switch NDPChassisType = 100
  114. NDPChassisAlteonApplicationSwitch2424 NDPChassisType = 101
  115. NDPChassisAlteonApplicationSwitch2224 NDPChassisType = 102
  116. NDPChassisAlteonApplicationSwitch2208 NDPChassisType = 103
  117. NDPChassisAlteonApplicationSwitch2216 NDPChassisType = 104
  118. NDPChassisAlteonApplicationSwitch3408 NDPChassisType = 105
  119. NDPChassisAlteonApplicationSwitch3416 NDPChassisType = 106
  120. NDPChassisNortelNetworksWirelessLANSecuritySwitch2250 NDPChassisType = 107
  121. NDPChassisEthernetSwitch42548T NDPChassisType = 108
  122. NDPChassisEthernetSwitch42524T NDPChassisType = 109
  123. NDPChassisNortelNetworksWirelessLANAccessPoint2221 NDPChassisType = 110
  124. NDPChassisNortelMetroEthernetServiceUnit24TSPFswitch NDPChassisType = 111
  125. NDPChassisNortelMetroEthernetServiceUnit24TLXDCswitch NDPChassisType = 112
  126. NDPChassisPassport830010slotchassis NDPChassisType = 113
  127. NDPChassisPassport83006slotchassis NDPChassisType = 114
  128. NDPChassisEthernetRoutingSwitch552024TPWR NDPChassisType = 115
  129. NDPChassisEthernetRoutingSwitch552048TPWR NDPChassisType = 116
  130. NDPChassisNortelNetworksVPNGateway3050 NDPChassisType = 117
  131. NDPChassisAlteonSSL31010100 NDPChassisType = 118
  132. NDPChassisAlteonSSL31010100Fiber NDPChassisType = 119
  133. NDPChassisAlteonSSL31010100FIPS NDPChassisType = 120
  134. NDPChassisAlteonSSL410101001000 NDPChassisType = 121
  135. NDPChassisAlteonSSL410101001000Fiber NDPChassisType = 122
  136. NDPChassisAlteonApplicationSwitch2424SSL NDPChassisType = 123
  137. NDPChassisEthernetSwitch32524T NDPChassisType = 124
  138. NDPChassisEthernetSwitch32524G NDPChassisType = 125
  139. NDPChassisNortelNetworksWirelessLANAccessPoint2225 NDPChassisType = 126
  140. NDPChassisNortelNetworksWirelessLANSecuritySwitch2270 NDPChassisType = 127
  141. NDPChassis24portEthernetSwitch47024TPWR NDPChassisType = 128
  142. NDPChassis48portEthernetSwitch47048TPWR NDPChassisType = 129
  143. NDPChassisEthernetRoutingSwitch553024TFD NDPChassisType = 130
  144. NDPChassisEthernetSwitch351024T NDPChassisType = 131
  145. NDPChassisNortelMetroEthernetServiceUnit12GACL3Switch NDPChassisType = 132
  146. NDPChassisNortelMetroEthernetServiceUnit12GDCL3Switch NDPChassisType = 133
  147. NDPChassisNortelSecureAccessSwitch NDPChassisType = 134
  148. NDPChassisNortelNetworksVPNGateway3070 NDPChassisType = 135
  149. NDPChassisOPTeraMetro3500 NDPChassisType = 136
  150. NDPChassisSMBBES101024T NDPChassisType = 137
  151. NDPChassisSMBBES101048T NDPChassisType = 138
  152. NDPChassisSMBBES102024TPWR NDPChassisType = 139
  153. NDPChassisSMBBES102048TPWR NDPChassisType = 140
  154. NDPChassisSMBBES201024T NDPChassisType = 141
  155. NDPChassisSMBBES201048T NDPChassisType = 142
  156. NDPChassisSMBBES202024TPWR NDPChassisType = 143
  157. NDPChassisSMBBES202048TPWR NDPChassisType = 144
  158. NDPChassisSMBBES11024T NDPChassisType = 145
  159. NDPChassisSMBBES11048T NDPChassisType = 146
  160. NDPChassisSMBBES12024TPWR NDPChassisType = 147
  161. NDPChassisSMBBES12048TPWR NDPChassisType = 148
  162. NDPChassisSMBBES21024T NDPChassisType = 149
  163. NDPChassisSMBBES21048T NDPChassisType = 150
  164. NDPChassisSMBBES22024TPWR NDPChassisType = 151
  165. NDPChassisSMBBES22048TPWR NDPChassisType = 152
  166. NDPChassisOME6500 NDPChassisType = 153
  167. NDPChassisEthernetRoutingSwitch4548GT NDPChassisType = 154
  168. NDPChassisEthernetRoutingSwitch4548GTPWR NDPChassisType = 155
  169. NDPChassisEthernetRoutingSwitch4550T NDPChassisType = 156
  170. NDPChassisEthernetRoutingSwitch4550TPWR NDPChassisType = 157
  171. NDPChassisEthernetRoutingSwitch4526FX NDPChassisType = 158
  172. NDPChassisEthernetRoutingSwitch250026T NDPChassisType = 159
  173. NDPChassisEthernetRoutingSwitch250026TPWR NDPChassisType = 160
  174. NDPChassisEthernetRoutingSwitch250050T NDPChassisType = 161
  175. NDPChassisEthernetRoutingSwitch250050TPWR NDPChassisType = 162
  176. )
  177. type NDPBackplaneType uint8
  178. // Nortel Backplane Types
  179. const (
  180. NDPBackplaneOther NDPBackplaneType = 1
  181. NDPBackplaneEthernet NDPBackplaneType = 2
  182. NDPBackplaneEthernetTokenring NDPBackplaneType = 3
  183. NDPBackplaneEthernetFDDI NDPBackplaneType = 4
  184. NDPBackplaneEthernetTokenringFDDI NDPBackplaneType = 5
  185. NDPBackplaneEthernetTokenringRedundantPower NDPBackplaneType = 6
  186. NDPBackplaneEthernetTokenringFDDIRedundantPower NDPBackplaneType = 7
  187. NDPBackplaneTokenRing NDPBackplaneType = 8
  188. NDPBackplaneEthernetTokenringFastEthernet NDPBackplaneType = 9
  189. NDPBackplaneEthernetFastEthernet NDPBackplaneType = 10
  190. NDPBackplaneEthernetTokenringFastEthernetRedundantPower NDPBackplaneType = 11
  191. NDPBackplaneEthernetFastEthernetGigabitEthernet NDPBackplaneType = 12
  192. )
  193. type NDPState uint8
  194. // Device State
  195. const (
  196. NDPStateTopology NDPState = 1
  197. NDPStateHeartbeat NDPState = 2
  198. NDPStateNew NDPState = 3
  199. )
  200. // NortelDiscovery is a packet layer containing the Nortel Discovery Protocol.
  201. type NortelDiscovery struct {
  202. BaseLayer
  203. IPAddress net.IP
  204. SegmentID []byte
  205. Chassis NDPChassisType
  206. Backplane NDPBackplaneType
  207. State NDPState
  208. NumLinks uint8
  209. }
  210. // LayerType returns gopacket.LayerTypeNortelDiscovery.
  211. func (c *NortelDiscovery) LayerType() gopacket.LayerType {
  212. return LayerTypeNortelDiscovery
  213. }
  214. func decodeNortelDiscovery(data []byte, p gopacket.PacketBuilder) error {
  215. c := &NortelDiscovery{}
  216. if len(data) < 11 {
  217. return fmt.Errorf("Invalid NortelDiscovery packet length %d", len(data))
  218. }
  219. c.IPAddress = data[0:4]
  220. c.SegmentID = data[4:7]
  221. c.Chassis = NDPChassisType(data[7])
  222. c.Backplane = NDPBackplaneType(data[8])
  223. c.State = NDPState(data[9])
  224. c.NumLinks = uint8(data[10])
  225. p.AddLayer(c)
  226. return nil
  227. }
  228. func (t NDPChassisType) String() (s string) {
  229. switch t {
  230. case NDPChassisother:
  231. s = "other"
  232. case NDPChassis3000:
  233. s = "3000"
  234. case NDPChassis3030:
  235. s = "3030"
  236. case NDPChassis2310:
  237. s = "2310"
  238. case NDPChassis2810:
  239. s = "2810"
  240. case NDPChassis2912:
  241. s = "2912"
  242. case NDPChassis2914:
  243. s = "2914"
  244. case NDPChassis271x:
  245. s = "271x"
  246. case NDPChassis2813:
  247. s = "2813"
  248. case NDPChassis2814:
  249. s = "2814"
  250. case NDPChassis2915:
  251. s = "2915"
  252. case NDPChassis5000:
  253. s = "5000"
  254. case NDPChassis2813SA:
  255. s = "2813SA"
  256. case NDPChassis2814SA:
  257. s = "2814SA"
  258. case NDPChassis810M:
  259. s = "810M"
  260. case NDPChassisEthercell:
  261. s = "Ethercell"
  262. case NDPChassis5005:
  263. s = "5005"
  264. case NDPChassisAlcatelEWC:
  265. s = "Alcatel Ethernet workgroup conc."
  266. case NDPChassis2715SA:
  267. s = "2715SA"
  268. case NDPChassis2486:
  269. s = "2486"
  270. case NDPChassis28000series:
  271. s = "28000 series"
  272. case NDPChassis23000series:
  273. s = "23000 series"
  274. case NDPChassis5DN00xseries:
  275. s = "5DN00x series"
  276. case NDPChassisBayStackEthernet:
  277. s = "BayStack Ethernet"
  278. case NDPChassis23100series:
  279. s = "23100 series"
  280. case NDPChassis100BaseTHub:
  281. s = "100Base-T Hub"
  282. case NDPChassis3000FastEthernet:
  283. s = "3000 Fast Ethernet"
  284. case NDPChassisOrionSwitch:
  285. s = "Orion switch"
  286. case NDPChassisDDS:
  287. s = "DDS"
  288. case NDPChassisCentillion6slot:
  289. s = "Centillion (6 slot)"
  290. case NDPChassisCentillion12slot:
  291. s = "Centillion (12 slot)"
  292. case NDPChassisCentillion1slot:
  293. s = "Centillion (1 slot)"
  294. case NDPChassisBayStack301:
  295. s = "BayStack 301"
  296. case NDPChassisBayStackTokenRingHub:
  297. s = "BayStack TokenRing Hub"
  298. case NDPChassisFVCMultimediaSwitch:
  299. s = "FVC Multimedia Switch"
  300. case NDPChassisSwitchNode:
  301. s = "Switch Node"
  302. case NDPChassisBayStack302Switch:
  303. s = "BayStack 302 Switch"
  304. case NDPChassisBayStack350Switch:
  305. s = "BayStack 350 Switch"
  306. case NDPChassisBayStack150EthernetHub:
  307. s = "BayStack 150 Ethernet Hub"
  308. case NDPChassisCentillion50NSwitch:
  309. s = "Centillion 50N switch"
  310. case NDPChassisCentillion50TSwitch:
  311. s = "Centillion 50T switch"
  312. case NDPChassisBayStack303304Switches:
  313. s = "BayStack 303 and 304 Switches"
  314. case NDPChassisBayStack200EthernetHub:
  315. s = "BayStack 200 Ethernet Hub"
  316. case NDPChassisBayStack25010100EthernetHub:
  317. s = "BayStack 250 10/100 Ethernet Hub"
  318. case NDPChassisBayStack450101001000Switches:
  319. s = "BayStack 450 10/100/1000 Switches"
  320. case NDPChassisBayStack41010100Switches:
  321. s = "BayStack 410 10/100 Switches"
  322. case NDPChassisPassport1200L3Switch:
  323. s = "Passport 1200 L3 Switch"
  324. case NDPChassisPassport1250L3Switch:
  325. s = "Passport 1250 L3 Switch"
  326. case NDPChassisPassport1100L3Switch:
  327. s = "Passport 1100 L3 Switch"
  328. case NDPChassisPassport1150L3Switch:
  329. s = "Passport 1150 L3 Switch"
  330. case NDPChassisPassport1050L3Switch:
  331. s = "Passport 1050 L3 Switch"
  332. case NDPChassisPassport1051L3Switch:
  333. s = "Passport 1051 L3 Switch"
  334. case NDPChassisPassport8610L3Switch:
  335. s = "Passport 8610 L3 Switch"
  336. case NDPChassisPassport8606L3Switch:
  337. s = "Passport 8606 L3 Switch"
  338. case NDPChassisPassport8010:
  339. s = "Passport 8010"
  340. case NDPChassisPassport8006:
  341. s = "Passport 8006"
  342. case NDPChassisBayStack670wirelessaccesspoint:
  343. s = "BayStack 670 wireless access point"
  344. case NDPChassisPassport740:
  345. s = "Passport 740"
  346. case NDPChassisPassport750:
  347. s = "Passport 750"
  348. case NDPChassisPassport790:
  349. s = "Passport 790"
  350. case NDPChassisBusinessPolicySwitch200010100Switches:
  351. s = "Business Policy Switch 2000 10/100 Switches"
  352. case NDPChassisPassport8110L2Switch:
  353. s = "Passport 8110 L2 Switch"
  354. case NDPChassisPassport8106L2Switch:
  355. s = "Passport 8106 L2 Switch"
  356. case NDPChassisBayStack3580GigSwitch:
  357. s = "BayStack 3580 Gig Switch"
  358. case NDPChassisBayStack10PowerSupplyUnit:
  359. s = "BayStack 10 Power Supply Unit"
  360. case NDPChassisBayStack42010100Switch:
  361. s = "BayStack 420 10/100 Switch"
  362. case NDPChassisOPTeraMetro1200EthernetServiceModule:
  363. s = "OPTera Metro 1200 Ethernet Service Module"
  364. case NDPChassisOPTera8010co:
  365. s = "OPTera 8010co"
  366. case NDPChassisOPTera8610coL3Switch:
  367. s = "OPTera 8610co L3 switch"
  368. case NDPChassisOPTera8110coL2Switch:
  369. s = "OPTera 8110co L2 switch"
  370. case NDPChassisOPTera8003:
  371. s = "OPTera 8003"
  372. case NDPChassisOPTera8603L3Switch:
  373. s = "OPTera 8603 L3 switch"
  374. case NDPChassisOPTera8103L2Switch:
  375. s = "OPTera 8103 L2 switch"
  376. case NDPChassisBayStack380101001000Switch:
  377. s = "BayStack 380 10/100/1000 Switch"
  378. case NDPChassisEthernetSwitch47048T:
  379. s = "Ethernet Switch 470-48T"
  380. case NDPChassisOPTeraMetro1450EthernetServiceModule:
  381. s = "OPTera Metro 1450 Ethernet Service Module"
  382. case NDPChassisOPTeraMetro1400EthernetServiceModule:
  383. s = "OPTera Metro 1400 Ethernet Service Module"
  384. case NDPChassisAlteonSwitchFamily:
  385. s = "Alteon Switch Family"
  386. case NDPChassisEthernetSwitch46024TPWR:
  387. s = "Ethernet Switch 460-24T-PWR"
  388. case NDPChassisOPTeraMetro8010OPML2Switch:
  389. s = "OPTera Metro 8010 OPM L2 Switch"
  390. case NDPChassisOPTeraMetro8010coOPML2Switch:
  391. s = "OPTera Metro 8010co OPM L2 Switch"
  392. case NDPChassisOPTeraMetro8006OPML2Switch:
  393. s = "OPTera Metro 8006 OPM L2 Switch"
  394. case NDPChassisOPTeraMetro8003OPML2Switch:
  395. s = "OPTera Metro 8003 OPM L2 Switch"
  396. case NDPChassisAlteon180e:
  397. s = "Alteon 180e"
  398. case NDPChassisAlteonAD3:
  399. s = "Alteon AD3"
  400. case NDPChassisAlteon184:
  401. s = "Alteon 184"
  402. case NDPChassisAlteonAD4:
  403. s = "Alteon AD4"
  404. case NDPChassisPassport1424L3Switch:
  405. s = "Passport 1424 L3 switch"
  406. case NDPChassisPassport1648L3Switch:
  407. s = "Passport 1648 L3 switch"
  408. case NDPChassisPassport1612L3Switch:
  409. s = "Passport 1612 L3 switch"
  410. case NDPChassisPassport1624L3Switch:
  411. s = "Passport 1624 L3 switch"
  412. case NDPChassisBayStack38024FFiber1000Switch:
  413. s = "BayStack 380-24F Fiber 1000 Switch"
  414. case NDPChassisEthernetRoutingSwitch551024T:
  415. s = "Ethernet Routing Switch 5510-24T"
  416. case NDPChassisEthernetRoutingSwitch551048T:
  417. s = "Ethernet Routing Switch 5510-48T"
  418. case NDPChassisEthernetSwitch47024T:
  419. s = "Ethernet Switch 470-24T"
  420. case NDPChassisNortelNetworksWirelessLANAccessPoint2220:
  421. s = "Nortel Networks Wireless LAN Access Point 2220"
  422. case NDPChassisPassportRBS2402L3Switch:
  423. s = "Passport RBS 2402 L3 switch"
  424. case NDPChassisAlteonApplicationSwitch2424:
  425. s = "Alteon Application Switch 2424"
  426. case NDPChassisAlteonApplicationSwitch2224:
  427. s = "Alteon Application Switch 2224"
  428. case NDPChassisAlteonApplicationSwitch2208:
  429. s = "Alteon Application Switch 2208"
  430. case NDPChassisAlteonApplicationSwitch2216:
  431. s = "Alteon Application Switch 2216"
  432. case NDPChassisAlteonApplicationSwitch3408:
  433. s = "Alteon Application Switch 3408"
  434. case NDPChassisAlteonApplicationSwitch3416:
  435. s = "Alteon Application Switch 3416"
  436. case NDPChassisNortelNetworksWirelessLANSecuritySwitch2250:
  437. s = "Nortel Networks Wireless LAN SecuritySwitch 2250"
  438. case NDPChassisEthernetSwitch42548T:
  439. s = "Ethernet Switch 425-48T"
  440. case NDPChassisEthernetSwitch42524T:
  441. s = "Ethernet Switch 425-24T"
  442. case NDPChassisNortelNetworksWirelessLANAccessPoint2221:
  443. s = "Nortel Networks Wireless LAN Access Point 2221"
  444. case NDPChassisNortelMetroEthernetServiceUnit24TSPFswitch:
  445. s = "Nortel Metro Ethernet Service Unit 24-T SPF switch"
  446. case NDPChassisNortelMetroEthernetServiceUnit24TLXDCswitch:
  447. s = " Nortel Metro Ethernet Service Unit 24-T LX DC switch"
  448. case NDPChassisPassport830010slotchassis:
  449. s = "Passport 8300 10-slot chassis"
  450. case NDPChassisPassport83006slotchassis:
  451. s = "Passport 8300 6-slot chassis"
  452. case NDPChassisEthernetRoutingSwitch552024TPWR:
  453. s = "Ethernet Routing Switch 5520-24T-PWR"
  454. case NDPChassisEthernetRoutingSwitch552048TPWR:
  455. s = "Ethernet Routing Switch 5520-48T-PWR"
  456. case NDPChassisNortelNetworksVPNGateway3050:
  457. s = "Nortel Networks VPN Gateway 3050"
  458. case NDPChassisAlteonSSL31010100:
  459. s = "Alteon SSL 310 10/100"
  460. case NDPChassisAlteonSSL31010100Fiber:
  461. s = "Alteon SSL 310 10/100 Fiber"
  462. case NDPChassisAlteonSSL31010100FIPS:
  463. s = "Alteon SSL 310 10/100 FIPS"
  464. case NDPChassisAlteonSSL410101001000:
  465. s = "Alteon SSL 410 10/100/1000"
  466. case NDPChassisAlteonSSL410101001000Fiber:
  467. s = "Alteon SSL 410 10/100/1000 Fiber"
  468. case NDPChassisAlteonApplicationSwitch2424SSL:
  469. s = "Alteon Application Switch 2424-SSL"
  470. case NDPChassisEthernetSwitch32524T:
  471. s = "Ethernet Switch 325-24T"
  472. case NDPChassisEthernetSwitch32524G:
  473. s = "Ethernet Switch 325-24G"
  474. case NDPChassisNortelNetworksWirelessLANAccessPoint2225:
  475. s = "Nortel Networks Wireless LAN Access Point 2225"
  476. case NDPChassisNortelNetworksWirelessLANSecuritySwitch2270:
  477. s = "Nortel Networks Wireless LAN SecuritySwitch 2270"
  478. case NDPChassis24portEthernetSwitch47024TPWR:
  479. s = "24-port Ethernet Switch 470-24T-PWR"
  480. case NDPChassis48portEthernetSwitch47048TPWR:
  481. s = "48-port Ethernet Switch 470-48T-PWR"
  482. case NDPChassisEthernetRoutingSwitch553024TFD:
  483. s = "Ethernet Routing Switch 5530-24TFD"
  484. case NDPChassisEthernetSwitch351024T:
  485. s = "Ethernet Switch 3510-24T"
  486. case NDPChassisNortelMetroEthernetServiceUnit12GACL3Switch:
  487. s = "Nortel Metro Ethernet Service Unit 12G AC L3 switch"
  488. case NDPChassisNortelMetroEthernetServiceUnit12GDCL3Switch:
  489. s = "Nortel Metro Ethernet Service Unit 12G DC L3 switch"
  490. case NDPChassisNortelSecureAccessSwitch:
  491. s = "Nortel Secure Access Switch"
  492. case NDPChassisNortelNetworksVPNGateway3070:
  493. s = "Nortel Networks VPN Gateway 3070"
  494. case NDPChassisOPTeraMetro3500:
  495. s = "OPTera Metro 3500"
  496. case NDPChassisSMBBES101024T:
  497. s = "SMB BES 1010 24T"
  498. case NDPChassisSMBBES101048T:
  499. s = "SMB BES 1010 48T"
  500. case NDPChassisSMBBES102024TPWR:
  501. s = "SMB BES 1020 24T PWR"
  502. case NDPChassisSMBBES102048TPWR:
  503. s = "SMB BES 1020 48T PWR"
  504. case NDPChassisSMBBES201024T:
  505. s = "SMB BES 2010 24T"
  506. case NDPChassisSMBBES201048T:
  507. s = "SMB BES 2010 48T"
  508. case NDPChassisSMBBES202024TPWR:
  509. s = "SMB BES 2020 24T PWR"
  510. case NDPChassisSMBBES202048TPWR:
  511. s = "SMB BES 2020 48T PWR"
  512. case NDPChassisSMBBES11024T:
  513. s = "SMB BES 110 24T"
  514. case NDPChassisSMBBES11048T:
  515. s = "SMB BES 110 48T"
  516. case NDPChassisSMBBES12024TPWR:
  517. s = "SMB BES 120 24T PWR"
  518. case NDPChassisSMBBES12048TPWR:
  519. s = "SMB BES 120 48T PWR"
  520. case NDPChassisSMBBES21024T:
  521. s = "SMB BES 210 24T"
  522. case NDPChassisSMBBES21048T:
  523. s = "SMB BES 210 48T"
  524. case NDPChassisSMBBES22024TPWR:
  525. s = "SMB BES 220 24T PWR"
  526. case NDPChassisSMBBES22048TPWR:
  527. s = "SMB BES 220 48T PWR"
  528. case NDPChassisOME6500:
  529. s = "OME 6500"
  530. case NDPChassisEthernetRoutingSwitch4548GT:
  531. s = "Ethernet Routing Switch 4548GT"
  532. case NDPChassisEthernetRoutingSwitch4548GTPWR:
  533. s = "Ethernet Routing Switch 4548GT-PWR"
  534. case NDPChassisEthernetRoutingSwitch4550T:
  535. s = "Ethernet Routing Switch 4550T"
  536. case NDPChassisEthernetRoutingSwitch4550TPWR:
  537. s = "Ethernet Routing Switch 4550T-PWR"
  538. case NDPChassisEthernetRoutingSwitch4526FX:
  539. s = "Ethernet Routing Switch 4526FX"
  540. case NDPChassisEthernetRoutingSwitch250026T:
  541. s = "Ethernet Routing Switch 2500-26T"
  542. case NDPChassisEthernetRoutingSwitch250026TPWR:
  543. s = "Ethernet Routing Switch 2500-26T-PWR"
  544. case NDPChassisEthernetRoutingSwitch250050T:
  545. s = "Ethernet Routing Switch 2500-50T"
  546. case NDPChassisEthernetRoutingSwitch250050TPWR:
  547. s = "Ethernet Routing Switch 2500-50T-PWR"
  548. default:
  549. s = "Unknown"
  550. }
  551. return
  552. }
  553. func (t NDPBackplaneType) String() (s string) {
  554. switch t {
  555. case NDPBackplaneOther:
  556. s = "Other"
  557. case NDPBackplaneEthernet:
  558. s = "Ethernet"
  559. case NDPBackplaneEthernetTokenring:
  560. s = "Ethernet and Tokenring"
  561. case NDPBackplaneEthernetFDDI:
  562. s = "Ethernet and FDDI"
  563. case NDPBackplaneEthernetTokenringFDDI:
  564. s = "Ethernet, Tokenring and FDDI"
  565. case NDPBackplaneEthernetTokenringRedundantPower:
  566. s = "Ethernet and Tokenring with redundant power"
  567. case NDPBackplaneEthernetTokenringFDDIRedundantPower:
  568. s = "Ethernet, Tokenring, FDDI with redundant power"
  569. case NDPBackplaneTokenRing:
  570. s = "Token Ring"
  571. case NDPBackplaneEthernetTokenringFastEthernet:
  572. s = "Ethernet, Tokenring and Fast Ethernet"
  573. case NDPBackplaneEthernetFastEthernet:
  574. s = "Ethernet and Fast Ethernet"
  575. case NDPBackplaneEthernetTokenringFastEthernetRedundantPower:
  576. s = "Ethernet, Tokenring, Fast Ethernet with redundant power"
  577. case NDPBackplaneEthernetFastEthernetGigabitEthernet:
  578. s = "Ethernet, Fast Ethernet and Gigabit Ethernet"
  579. default:
  580. s = "Unknown"
  581. }
  582. return
  583. }
  584. func (t NDPState) String() (s string) {
  585. switch t {
  586. case NDPStateTopology:
  587. s = "Topology Change"
  588. case NDPStateHeartbeat:
  589. s = "Heartbeat"
  590. case NDPStateNew:
  591. s = "New"
  592. default:
  593. s = "Unknown"
  594. }
  595. return
  596. }