⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 architecture.tex.svn-base

📁 在Diameter3588协议的基础上开发的软件
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
to a session. This involves enqueuing the message to the job queue ofthat session. Again, a new thread pool job request is created andinjected into the thread pool job request queue. Once dequeued by thenext available thread, the job performs all necessary update to thesession state machine based on the outgoing message if necessary andthen enqueues the message to the job queue of the peer thread where thismessage is destined for. The job queues for the peer threads, also knownas transmit queue as shown in Figure~\ref{fig:architecture} is thelogical boundary between the session manager and the transport manageron the egress path. This same job determines which transmit queue themessage is to be injected to by querying the transport manager peertable. Once enqueued into the transmitt queue of the peer thread, thepeer thread can compose the message into a raw buffer and transmit itvia it's established connection.Internally, each peer thread has an internal pending message queue inaddition to it's transmitt queue. The pending message queue shown inFigure~\ref{fig:architecture}, is where all transmitted butun-acknowledge messages are stored, i.e. transmitted request messagesthat is still awaiting a correspoding answer message. As specified inSection 5.5.4 of the Diameter draft \cite{basep}, this is used infailover procedure. Since each peer connection resides within it's ownthread context, detection of transport failure with the remote peer andimmediate failover is done internally within the thread. Failover iseasily accomplised simply by flaging and transferring all the messagesin the pending message queue into the transmitt queue of the peer threadof an alternative server. However, the architecture dictates that once atransport connection for a peer thread closes or fails, the peer threadhas to exit. This means that in order to perform failback, the peerthread schedules a connection retry with the factory request before thepeer thread exits. The scheduling is done via timer request. Once thetimer event occurs, a connection attempt is made by the factory. Once aconnection is re-established with the peer, a new peer thread is startedby the factory and communication with the remote peer is once againpossible. If the re-connection attempt fails, another connection retryis scheduled and the process is repeated.\subsection{Message Parsing\label{sec:msgparsing}}Diameter message parsing can occur at least in the following cases.\begin{itemize} \item When a Diameter message is received from a peer, the transport manager needs to parse the message in order to determine whether the message should be queued in the message parsing queue for further processing by the session manager or forwarded to another Diameter node.  In this case, only specific AVPs such as Destination-Host AVP and Destination-Realm AVP need to be parsed instead of fully parsing against the command dictionary. \item When a received Diameter message is processed by the session manager, the message is fully parsed against the dictionary by the session manager and passed to an appropriate application message subscription handler for application specific processing. \item When a Diameter message is generated by the application via an application subscription handler or by the transport manager, the message needs to be constructed by using the message parser module.  In this case, the message is fully parsed against the dictionary and passed to the transport module. \item When a Diameter message generated by the application is sent to a peer, the message needs to be parsed by the transport manager in order to determine the peer to send the message.  In this case, only specific AVPs such as Destination-Host AVP and Destination-Realm AVP need to be parsed.\end{itemize}For all of above cases, the same date structures are used regardless ofwhether parsing is performed for message assemble or disassemble.  Thedata structures used for message parsing are container list ({\ttAAAAvpContainerList}), container\\ ({\tt AAAAvpContainer}) and containerentry ({\tt AAAAvpContainerEntry}).  An example pointer chains of thosedata structures are shown in Figure~\ref{fig:parser}.When assembling or disassembling a message, a container is assigned foreach type of AVP and attached to a container list.  Also, a distinctcontainer entry is assigned for each AVP that is included (whendisassembling) or to be included (when assembling) in the message andattached to the container of the corresponding AVP type.  The parentcontainer list needs to be provided by the application.  Whendisassembling a message, either the application or the parser module hasthe responsibility of assignment and attachment of containers, but onlythe parser module has the responsibility of assignment and attachment ofcontainer entries.  On the other hand, when assembling a message,applications have the responsibility of assignment and attachment ofcontainers and container entries.  In any cases, application is the onlyentity that have the responsibility of releasing and detachingcontainers and container entries.Assignment and release of containers and container entries is done viacontainer manager ({\tt AAAAvpContainerManager}) and container entrymanager\\ ({\tt AAAAvpContainerEntryManager}), respectively.  Resourcemanagement for containers and container entries is based onpre-allocation (instead of on-demand allocation via malloc() systemcall) in order to avoid frequent memory allocation/deallocation.AVP data in a Grouped AVP is stored in a distinct container list forwhich a pointer is stored in the container entry for the Grouped AVP.In other words, a Diameter message payload and a Grouped AVP is treatedin the same manner.  It is also possible to process nested Grouped AVPsin which a Grouped AVP contains another Grouped AVP as its element AVP.The Open Diameter thread architecture is designed such that a message isalways exclusively processed by a single thread.  Resource accesscontention among multiple threads for message parsing is only possiblewhen assigning and releasing containers and container entries.  Toeliminate the contention, mutex protection is provided inside thecontainer and container entry managers.  Thus, applications are notrequired to provide their own mutex protection mechanism for messageparsing.\begin{figure}[htbp]\center{\leavevmode\includegraphics[scale=0.8]{figs/parser_structure.eps}\caption{Diameter Message Payload Parsing Structure\label{fig:parser}}}\end{figure}Open Diameter defines a template parser class named {\tt AAAParser}which provides a unified way to parse any data structure.  Any {\ttAAAParser} class object consists of the following members.\begin{description} \item[Raw data] less-structured data such as string buffers. \item[Application data] structured representation of raw data, such as	    AVP container list. \item[Dictionary data] Data that describes a rule for data conversion between raw data and application data.  Dictionary data can be null. \item[Data set/get functions] A set of functions used for setting/getting raw data, application data and dictionary data to/from the parser. \item[Message parsing and data conversion functions] A pair of functions used for data parsing and conversion between raw data and application data.\end{description}In fact, a number of parser classes are defined for parsing differentobjects including Diameter header, Diameter payload, AVP header and AVPpayload of each data type, by specializing the template {\tt AAAParser}class.\subsubsection{Registering New AVP Types\label{sec:avpparsing}}Open Diameter parser library defines an API to define a new AVP type anda parser to parse the new type, in addition to the default supported AVPtypes such as Integer32, Unsigned32, OctetString, UTF8String, Groupedand IPAddress.  This feature is particularly important not only fordeveloping new Diameter applications and but also for developing a newprotocol that uses Diameter AVP formats.  PANA (Protocol for carryingAuthentication for Network Access) is an example of the latter case.Registration of a new AVP type can be done via adding a new AVP typeentry called {\tt AvpType}, where an AVP type entry consists of thefollowing members.\begin{description} \item[Type name] the name of this AVP type. \item[Type code] an integer that is used by the parser library for distinguishing this AVP type.  The type code must be unique among all the types in the system.  The type code is used only inside the library and never carried in Diameter messages. \item[Type size] the minimum size of the data of this AVP type.  This information is used for creating an placeholder AVP when a certain class of error occurs. \item[Dictionary data] data that describes a rule for data conversion between raw data and application data.  Dictionary data can be null. \item[Parser creator] a function object or a functor that is used for creating a parser class instance that parses the data of the AVP type. \item[Container entry creator] a function object or a functor that is used for creating a container entry that contains the data of the AVP type.\end{description}The list of {\tt AVPType} instances are retained in an AVP type list{\tt AAAAvpTypeList}, which is a singleton.\subsection{Configuration\label{sec:configuration}}All configuration files for the Open Diameter library, as with theparser library, are stored in XML format. The root configuration file,configuration.xml, contains references to other configuration fileswhich are also in XML format such as the peer and routing databases. Aswith the message parser library, the Open Diameter library uses theXerces C++ XML library to parse the local configuration files. Mostentries in the configuration files directly reflects the parameterstated in the Diameter draft \cite{basep} and are self explanatory.\begin{thebibliography}{Bibliography}\bibitem[ACE]{ace}Douglas C. Schmidt, ``The ADAPTIVE CommunicationsEnvironment, An Object-Oriented Network Programming Toolkit forDeveloping Communications Software,'' June 1993.\bibitem[BASE-P]{basep}P. Calhoun, et al., ``Diameter Base Protocol,''Internet-Draft, Work in Progress, December 2002.\bibitem[API]{api} Y. Ohba and V. Fajordo ``Diameter C++ API'',http://www.opendiameter.org/.\end{thebibliography}\end{document}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -