Sunteți pe pagina 1din 9

Simple Network Discovery Protocol (SNDP) Ver. 1.

02 May 28, 2011

Moe W eatley, !"#$%

& is speci'icatio( )escri*es a simple protocol t at ca( *e +se) to )iscover c+stom (etwork co((ecte) )evices +si(, a simple *roa)cast -DP sc eme.

&a*le o' .o(te(ts


1. Simple Network Discovery Protocol /verview...................................................................................................... 0 1.1. Concept............................................................................................................................................................... 3 1.2. Discovery Procedure........................................................................................................................................... 3 1.3. Modification Procedure....................................................................................................................................... 4 2. Network Discovery Messa,e 1ormat..................................................................................................................... 2 2.1. Overall Packet Format........................................................................................................................................ 5 2.1.1 Fixed Common Field Definitions.................................................................................................................... 5 2.1.2 Examples of Filling fixed common fields........................................................................................................ 6 2.1.3 Example of Modifying a Devices Settings using ead Modify !"ite..............................................................# 2.2. Custom Field Packet Formats............................................................................................................................. 2.2.1 SD $%& and 'etSd" Custom Field &ac(et Definitions....................................................................................) 2.2.2 SD $%* and SD $1+ ,sing Se"ve" Custom Field &ac(et Definitions............................................................-

.e". 1./2 2/11$/5$2)

1. Simple Network Discovery Protocol /verview


1.1. Concept
0 fundamental "e1ui"ement fo" connecting to a 2a"d3a"e device on a net3o"( is to (no3 t2e devices net3o"( pa"amete"s suc2 as %& add"ess4 po"t num5e"4 etc. Many devices do not 2ave any use" inte"face to allo3 setting o" c2anging t2e net3o"( pa"amete"s so some ot2e" means is "e1ui"ed. 62is p"otocol is a simple met2od to discove" net3o"(ed devices using 5"oadcast ,D& messages. 62e sc2eme uses t2e same 5asic ,D& 5"oadcast message sc2eme as D7C& except t2e messages a"e customi8ed to t2e specific devices suppo"ted 5y t2e p"otocol. 62e (ey is t2at t2e sc2eme uses ,D& 5"oadcast messages9%& add"ess 255.255.255.255: on a specific po"t. 62is allo3s communication 3it2 any device p2ysically connected to a net3o"( 5ut 32ose %& and po"t settings a"e un(no3n as 3ell as c2anging t2ese settings "emotely. 62ese messages 3ill only 3o"( on local net3o"(s.

1.2. Discovery Procedure

&C &o"t +)322

,D& <"oadcast Discove" e1uest Msg Device &o"t +)321 ,D& <"oadcast Discove" esponse Msg

&C &o"t +)322

62e se1uence of events a"e as follo3s fo" o5taining a devices pa"amete"s; 1. &C sends a ,D& 5"oadcast e1uest Message to a device t2at is listening on &o"t +)321. 2. 62e device t2en sends a ,D& 5"oadcast esponse Message to t2e &C 32ic2 is listening on &o"t +)322. 62e "esponse message contains its pe"tinent net3o"( pa"amete"s.

.e". 1./2 2/11$/5$2)

1.3. Modification Procedure


0 simila" means can 5e used to set a devices net3o"( pa"amete"s using a 5"oadcast ,D& message;

&C &o"t +)322

,D& <"oadcast Discove" Set Msg Device &o"t +)321

,D& <"oadcast &C &o"t +)322 Discove" esponse Msg


62e &C simply sends a ,D& 5"oadcast Set message t2at 32en t2e device "eceives it4 "econfigu"es its net3o"( to t2e pa"amete"s specified in t2e Set message. 62e device t2en sends a ,D& 5"oadcast esponse Message 5ac( to t2e &C containing t2e c2anged settings. 62is "esponse can 5e used as an ac(no3ledge as 3ell as a means to indicate any fields t2at could not 5e set. 62is sc2eme can 5e expanded to allo3 discove"ing and modifying ot2e" custom pa"amete"s depending on 32at t2e device is.

.e". 1./2 2/11$/5$2)

2. Network Discovery Messa,e 1ormat


62e discove"y message pac(ets a"e va"ia5le lengt2 pac(ets containing va"ious 5yte fields t2at contain message type info"mation as 3ell as t2e pa"amete"s of t2e specific device. 62e message is divided into t3o sections. 62e fi"st section is "e1ui"ed and its fields a"e fixed in lengt2 and its definitions a"e common to all discove"y messages and all devices suppo"ting t2e p"otocol. 62e second optional section is va"ia5le lengt2 and t2e 5yte fields a"e custom to t2e pa"ticula" device. Note! t"e term #little endian $yte order% refers to t"e order t"at multi $yte data items are stored in memory and is least si&nificant $yte first order. ' 1( $it )ord )ould $e stored as parameter*+,--$its ./+0 parameter*1,--$its 15/ .

2.1. Overall Packet Format


62e message pac(et contains a fixed 56 5yte field follo3ed 5y a va"ia5le lengt2 custom field t2at is specific to a pa"ticula" device. st"uct D%SC=.E >MS? @ AAfixed common 56 5yte fields unsigned c2a" lengt2B2CD AAlengt2 of total message in 5ytes 9little endian 5yte o"de": unsigned c2a" (eyB2CD AAfixed (ey (eyB/CEE/x50 (eyB1CEE/x05 unsigned c2a" opD AA/EE e1uest9to device: 1EE esponse9f"om device: 2 EESet9to device: c2a" nameB16CD AADevice name st"ing null te"minated c2a" snB16CD AASe"ial num5e" st"ing null te"minated unsigned c2a" ipadd"B16CD AAdevice %& add"ess 9little endian 5yte o"de": unsigned c2a" po"tB2CD AAdevice &o"t num5e" 9little endian 5yte o"de": unsigned c2a" customfieldD AASpecifies a custom data field fo" a pa"ticula" device .. AAsta"t of optional va"ia5le custom 5yte fields unsigned c2a" CustomB'CD F 2.1.1 1i3e) .ommo( 1iel) De'i(itio(s 62e fi"st 2 5yte 16 5it field Glengt2G is t2e total message lengt2 in little endian 5yte o"de". 62e second 2 5yte 16 5it field G(eyG is a fixed value used to identify t2is pac(et as a discove"y pac(et in t2e "a"e case t2e"e a"e ot2e" 5"oadcast pac(ets on t2is po"t. 62e t2i"d 1 5yte field GopG identifies t2e type of discove"y message. 0 value of / is defined as a e1uest message f"om t2e &C client to t2e device. 0 value of 1 is a esponse message f"om t2e device to t2e &C4 and a value of 2 is a Set message f"om t2e &C to t2e device. 0ll ot2e" values a"e "ese"ved. 62e fou"t2 fixed 16 5yte GnameG field is a va"ia5le 8e"o te"minated c2a"acte" st"ing identifying t2e exte"nal device. 0ny unused 5ytes in t2e 16 5yte field s2ould 5e set to 8e"o. 62is st"ing is t2e p"ima"y identifie" of t2e device on t2e net3o"(. 0 device must al3ays fill in t2is field 32en sending a "esponse message 5ac( to t2e &C. 62e &C can leave t2is field all 8e"os 32en sending a "e1uest message and all devices "ega"dless of t2ei" name to discove" all devices 3it2 any name on t2e net3o"(. 62e fift2 fixed 16 5yte GsnG field is a va"ia5le 8e"o te"minated c2a"acte" st"ing identifying t2e se"ial num5e" of t2e exte"nal device. 0ny unused 5ytes in t2e 16 5yte field s2ould 5e set to 8e"o. 62is st"ing can 5e used to distinguis2 multiple devices 3it2 t2e same name on t2e net3o"(. 0 device must al3ays fill in t2is field 32en sending a "esponse message 5ac( to t2e &C. 62e &C can leave t2is field all 8e"os 32en sending a "e1uest message to discove" all devices 3it2 t2e same name on t2e net3o"(.

.e". 1./2 2/11$/5$2)

62e sixt2 fixed 16 5yte Gipadd"G field is t2e %& add"ess of t2e device in little endian 5yte o"de". %f t2is is a "e1uest message4 t2e field is igno"ed 5y t2e device. %f it is a set message t2en t2is is t2e %& add"ess t2at t2e device s2ould c2ange to. %f it is a "esponse message f"om t2e device4 t2is is t2e cu""ent %& add"ess of t2e device. 62e sevent2 fixed 2 5yte Gpo"tG field is t2e po"t num5e" of t2e device in little endian 5yte o"de". %f t2is is a "e1uest message4 t2e field is igno"ed 5y t2e device. %f it is a set message t2en t2is is t2e po"t num5e" t2at t2e device s2ould c2ange to. %f it is a "esponse message f"om t2e device4 t2is is t2e cu""ent po"t num5e" of t2e device. 62e last 5yte of t2e fixed common field can 5e used to specify diffe"ent custom field fo"mats fo" t2e same device. 2.1.2 "3amples o' 1illi(, 'i3e) commo( 'iel)s.

D%SC=.E >MS? msgD E ample PC re!uest messa"e for any devices on net#ork$ memset99voidH:Imsg4 /4 si8eof9D%SC=.E >MS?::D AA8e"o out all fields msg.(eyB/C E /x50D AAfill in (ey values msg.(eyB1C E /x05D msg.op E /D AA"e1uest message msg.lengt2B/C E 56D AAset message lengt2 of Just t2e fixed section E ample PC re!uest messa"e for any device #it% t%e name &MyDevice' on t%e net#ork$ memset99voidH:Imsg4 /4 si8eof9D%SC=.E >MS?::D AA8e"o out all fields msg.(eyB/C E /x50D AAfill in (ey values msg.(eyB1C E /x05D msg.op E /D AA"e1uest message st"cpy9 msg.name4 KMyDeviceL :D AAfill in name st"ing field msg.lengt2B/C E 56D AAset message lengt2 of Just t2e fixed section E ample simple Device response messa"e #it% t%e name &MyDevice' on t%e net#ork$ memset99voidH:Imsg4 /4 si8eof9D%SC=.E >MS?::D AA8e"o out all fields msg.(eyB/C E /x50D AAfill in (ey values msg.(eyB1C E /x05D msg.op E 1D AA"esponse message st"cpy9 msg.name4 KMyDeviceL :D AAfill in name st"ing field AAassume device %& add"ess is 1-2.16-.1.1// on po"t 123+5 msg.ipadd"B/C E 1//D AAdevice %& add"ess9 little endian 5yte o"de": msg.ipadd"B1C E 1D msg.ipadd"B2C E 16)D msg.ipadd"B3C E 1-2D msg.po"tB/C E 123+5I/x//FFD AAdevice &o"t 'um5e"9 little endian 5yte o"de": msg.po"tB1C E 123+5MM)D msg.lengt2B/C E 56D AAset message lengt2 of Just t2e fixed section E ample PC set messa"e for device #it% t%e name &MyDevice' on t%e net#ork$ memset99voidH:Imsg4 /4 si8eof9D%SC=.E >MS?::D AA8e"o out all fields msg.(eyB/C E /x50D AAfill in (ey values msg.(eyB1C E /x05D msg.op E 2D AAset message st"cpy9 msg.name4 KMyDeviceL :D AAfill in name st"ing field AAassume 3ant to set device %& add"ess to 1-2.16-.5.32 on po"t 5+321 msg.ipadd"B/C E 32D AAdevice %& add"ess9 little endian 5yte o"de": msg.ipadd"B1C E 5D msg.ipadd"B2C E 16)D msg.ipadd"B3C E 1-2D msg.po"tB/C E 5+321I/x//FFD AAdevice &o"t num5e"9 little endian 5yte o"de":

.e". 1./2 2/11$/5$2)

msg.po"tB1C E 5+321MM)D msg.lengt2B/C E 56D 2.1.0

AAset message lengt2 of Just t2e fixed section

"3ample o' Mo)i'yi(, a Devices Setti(,s +si(, 4ea) Mo)i'y Write.

=ne can save 3o"( 5y fi"st "eading all t2e devices settings4 modify t2e fields t2at need to c2ange4 t2en send t2e message 5ac( out as a Set message to t2e device.

&C Discove" e1uest Msg Device &C Discove" esponse Msg

?ot filled in fields f"om device so only update fields t2at a"e to 5e c2anged t2en send Set message 3it2 modified fields. &C Discove" Set Msg Device

&C

Discove"

esponse Msg

.e". 1./2 2/11$/5$2)

2.2. Custom Field Packet Formats


62e custom fields a"e defined fo" specific devices as t2ey contain info"mation uni1ue to t2at device. 62ese fields a"e appended afte" t2e fixed common fields of t2e discove" message 3it2 t2e total lengt2 of t2e message adJusted to include t2e ext"a 5ytes of t2e custom fields. 62e follo3ing sections desc"i5e cu""ently suppo"ted devices. 2.2.1 SD456P a() NetS)r .+stom 1iel) Packet De'i(itio(s

st"uct >D%SC=.E >MS?>'E6SD @ AAfixed common 56 5yte fields unsigned c2a" lengt2B2CD AAlengt2 of total message in 5ytes 9little endian 5yte o"de": unsigned c2a" (eyB2CD AAfixed (ey (eyB/CEE/x50 (eyB1CEE/x05 unsigned c2a" opD AA/EE e1uest9to device: 1EE esponse9f"om device: 2 EESet9to device: c2a" nameB16CD AADevice name st"ing null te"minated c2a" snB16CD AASe"ial num5e" st"ing null te"minated unsigned c2a" ipadd"B16CD AAdevice %& add"ess 9little endian 5yte o"de": unsigned c2a" po"tB2CD AAdevice &o"t num5e" 9little endian 5yte o"de": unsigned c2a" customfieldD AASpecify a custom data field fo" a pa"ticula" device AAsta"t of optional va"ia5le custom 5yte fields unsigned c2a" macadd"B6CD AA7! mac add"ess 9little endian 5yte o"de": 9"ead only: unsigned c2a" 23ve"B2CD AA7a"d3a"e ve"sionH1// 9little endian 5yte o"de": 9"ead only: unsigned c2a" f3ve"B2CD AAFi"m3a"e ve"sionH1// 9little endian 5yte o"de":9"ead only: unsigned c2a" 5tve"B2CD AA<oot ve"sionH1// 9little endian 5yte o"de": 9"ead only: unsigned c2a" fpgaidD AAF&?0 %D 9"ead only: unsigned c2a" fpga"evD AAF&?0 "evision 9"ead only: unsigned c2a" optsD AA=ptions 9"ead only: unsigned c2a" modeD AA/ EE ,se D7C& 1EEmanual 2EEmanual 0lte"nate data add"ess unsigned c2a" su5netB+CD AA%& su5net mas( 9little endian 5yte o"de": unsigned c2a" g3add"B+CD AAgate3ay add"ess 9little endian 5yte o"de": unsigned c2a" dataipadd"B+CD AA 0lte"nate data %& add"ess fo" ,D& data 9little endian 5yte o"de": unsigned c2a" datapo"tB2CD AA 0lte"nate data &o"t add"ess fo" ,D& 9little endian 5yte o"de": unsigned c2a" fpgaD AA/ EE default cfg 1EEcustom1 2EEcustom2 unsigned c2a" statusD AA<it / EE 6C& Connected4 <it 1 EE unning4 <its 2$# not defined 9"ead only: unsigned c2a" futu"eB15CD AAfutu"e use F

.e". 1./2 2/11$/5$2)

2.2.2 SD4567 a() SD451# -si(, Server .+stom 1iel) Packet De'i(itio(s st"uct >D%SC=.E >MS?>SD NN @ AAfixed common 56 5yte fields unsigned c2a" lengt2B2CD AAlengt2 of total message in 5ytes 9little endian 5yte o"de": unsigned c2a" (eyB2CD AAfixed (ey (eyB/CEE/x50 (eyB1CEE/x05 unsigned c2a" opD AA/EE e1uest9to device: 1EE esponse9f"om device: 2 EESet9to device: c2a" nameB16CD AADevice name st"ing null te"minated c2a" snB16CD AASe"ial num5e" st"ing null te"minated unsigned c2a" ipadd"B16CD AAdevice %& add"ess 9little endian 5yte o"de": unsigned c2a" po"tB2CD AAdevice &o"t num5e" 9little endian 5yte o"de": unsigned c2a" customfieldD AASpecify a custom data field fo" a pa"ticula" device AAsta"t of optional va"ia5le custom 5yte fields unsigned c2a" f3ve"B2CD AAFi"m3a"e ve"sionH1// 9little endian 5yte o"de":9"ead only: unsigned c2a" 5tve"B2CD AA<oot ve"sionH1// 9little endian 5yte o"de": 9"ead only: unsigned c2a" su5netB+CD AA%& su5net mas( 9little endian 5yte o"de": unsigned c2a" g3add"B+CD AAgate3ay add"ess 9little endian 5yte o"de": c2a" connectionB32CD AAinte"face connection st"ing null te"minated9ex; C=M34 DE.66O54 etc: unsigned c2a" statusD AA<it / EE 6C& Connected4 <its 1$# not defined 9"ead only: unsigned c2a" futu"eB15CD AAfutu"e use F

.e". 1./2 2/11$/5$2)

S-ar putea să vă placă și