分类号:TN915UDC:D10621-408-(2010)0951-0密级:公开编号:2006101138成都信息工程学院学位论文UPnP协议的分析及实现论文作者姓名:蔡凤梅申请学位专业:通信工程申请学位类别:工学学士指导教师姓名(职称):杜鸿(副教授)论文提交日期:2010年06月4日UPnP协议的分析及实现摘要随着计算机产业以及计算机网络技术的迅猛发展,使得嵌入式系统和家庭网络通信成为了热门的研究领域。由于越来越多的嵌入式设备的出现和家庭网络的发展,实现家庭网络中的各种嵌入式设备互联互通已经成为人们的迫切需求。而实现家庭网络的关键是家庭网络中间件技术。现今世界各著名设备厂商纷纷提出了各自的新技术和解决方案,其中,微软提出的UPnP技术最有发展前途,得到了最广泛的支持,是当今各国研究的热点。UPnP是通用即插即用(UniversalPlugandPlay)的缩写,它主要用于实现设备的智能互联互通。使用UPnP协议不需要设备驱动程序,它可以运行在几乎所有的操作系统平台之上,使得在办公室、家庭和其它公共场所方便地构建设备相互联通的网络环境。本文介绍了UPnP所使用的基本协议(如SSDP、GENA、SOAP等),重点分析了UPnP实现的基本工作流程。然后,论文在剖析了当前最常用的IntelSDK的结构和功能后,以TV控制点和TV设备的开发为例,给出了如何应用该SDK实现UPnP设备和控制点的设计开发技术。最后,利用WiresharkPortable工具捕获数据包,对各流程传递的消息包进行了详尽分析。关键词:UPnP;家庭网络;XMl;工作流程;IntelSDK;数据包AnalysisandrealizationofUPnPprotocolAbstractWiththegreatdevelopmentofcomputerindustryandcomputernetworktechnology,embeddedsystemandthehomenetworkingcommunicationisbecomingapopularresearchfieldnow.Atthesametime,duetothedevelopmentofhomenetworkingandthemoreembeddeddevicesinuse,itisurgenttoexploreanewwaytoconnectallkindsofembeddeddevicesinthehomenetworking.Thekeyofhomenetworkrealizationisthehomenetworkmiddlewaretechnology.Manyfamousinformationdevicecorporationshaveprovidedtheirownnewtechnologyandnewmeanstoresolveit,Especially,UPnPprovidedbyMicrosoft,thehotspotofresearchineverycountrynow,getsthemostextensivesupportandpossesestheenormousdevelopprospect.UPnPistheabbreviationofUniversalPlugandPlay.Itismostlyusedforimplementingintellectualinterconnectingbetweendevices.UsingUPnPprotocoldoesn’tneedthedevicedrivingprograms.Itcanrunoveralmostalloperatingsystems.UPnPwillmakeiteasytobuildthenetworkenvironmentfordevicesinterconnectingintheofficeorhome.Firstly,thepaperintroducesontheprotocolsUPnPrefersto(suchasSSDP,GENA,SOAP)andfocusesontheanalysisofthetechnologicalprocesstoimplementUPnP.Secondly,basedontheanalysisofthestructureandfunctionalityofthemostcommonlyusedIntelSDK,thepapersummarizesthedesignanddevelopmenttechniquesforUPnPdeviceandcontrolpointusingthisSDKwiththeexampleofdevelopingTVcontrolpointandTVdevice.Finally,utilizingthedatapacketscaughtbytheWiresharkPortable,thepaperanalysesexhaustivelythemessagepacketsofeveryprocess.Keywords:UPnP;homenetwork;XML;workprocess;IntelSDK;datapackets目录论文总页数:33页1引言...........................................................................12UPnP的结构规范.................................................................12.1UPnP的基本组件.............................................................12.2UPnP部分术语...............................................................22.3UPnP设备协议栈.............................................................32.3.1SSDP协议...............................................................32.3.2SOAP协议...............................................................32.3.3GENA协议...............................................................32.4基于XML的upnp描述.........................................................42.4.1XML简介[2]..............................................................42.4.2TV设备的设备描述编写...................................................53UPnP实现的工作流程.............................................................73.1寻址(Addressing)..........................................................83.2发现(Discovery)...........................................................83.3描述(Description).........................................................93.4控制(Control)............................................................103.5事件(Eventing)...........................................................103.6展示(Presentation).......................................................114基于Linux的UPnP协议实现的源代码模块..........................................124.1设备/控制点...............................................................124.2UPnP软件开发包API(upnpSDKAPI)...........................................124.3WEBServer................................................................134.4库模块....................................................................134.4.1XML解析模块...........................................................134.4.2SDK中的线程库.........................................................134.4.3HTTP解析器............................................................134.4.4微型服务器(MiniServer)..............................................135TV控制点及设备的代码实现......................................................145.1TV控制点的代码实现........................................................145.1.1发现、描述的代码实现...................................................145.1.2订阅服务的代码实现.....................................................175.1.3控制服务的代码实现.....................................................185.1.4退出..................................................................205.2TV设备的代码实现..........................................................215.2.1设置和初始化设备.......................................................215.2.2处理异步请求...........................................................225.2.3发送事件通知...........................................................235.2.4关闭设备..............................................................246UPnP协议