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

📄 x1234.htm

📁 Its a xmpp protocol book
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<HTML
><HEAD
><TITLE
>An Overview of the Server Architecture</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="Programming Jabber"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Server Architecture and Configuration"
HREF="c1223.htm"><LINK
REL="PREVIOUS"
TITLE="Server Architecture and Configuration"
HREF="c1223.htm"><LINK
REL="NEXT"
TITLE="Server Configuration"
HREF="x1581.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Programming Jabber</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c1223.htm"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Server Architecture and Configuration</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x1581.htm"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="JABTDG-CH-4-SECT-4.1"
>An Overview of the Server Architecture</A
></H1
><P
>In order to understand the configuration directives and how they work, 
it is necessary to take a step back and look what the Jabber Server 
really is. </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-4-SECT-4.1.1"
><B
CLASS="COMMAND"
>jabberd</B
> and Components</A
></H2
><P
>The Jabber Server is a <I
CLASS="EMPHASIS"
>daemon</I
>
<B
CLASS="COMMAND"
>jabberd</B
> that manages
the flow of data between various <I
CLASS="EMPHASIS"
>components</I
>, components
which collectively
make up the <I
CLASS="EMPHASIS"
>Jabber service</I
>.
There are different components, each of which
perform different kinds of tasks, and there is a basic set of components
that are required for a simple Jabber Server such as the one we configured
and installed in the previous chapter. </P
><P
>The following list shows what the basic Jabber components are and what
services they provide. It's worth considering the original and most well-known
application of Jabber&mdash;instant messaging&mdash;and a Jabber design 
feature (distributed server architecture) to put this list into context and
make better sense of it.</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Session management</DT
><DD
><P
>We need to be able to manage users' sessions while they're connected to
the server. The component that does this is called the Jabber Session
Manager (JSM), and provides IM features such as message store and forward
and roster management as well as managing sessions.</P
></DD
><DT
>Client (to server) connections</DT
><DD
><P
>This is the component that manages the connections between clients and
the server. It is known internally as '<TT
CLASS="LITERAL"
>c2s</TT
>'.</P
></DD
><DT
>Server (to server) connections</DT
><DD
><P
>If there's a requirement to send a message from a user on 
one Jabber server to a user on another Jabber server, we need a way for the
servers to connect to each other. This component establishes and manages
server-to-server connections, and is known internally as 
'<TT
CLASS="LITERAL"
>s2s</TT
>'.</P
></DD
><DT
>Logging</DT
><DD
><P
>As in any server system, the ability to log events (error messages, notices,
alerts and so on) is essential. The logging component allows us to effect
such logging. </P
></DD
><DT
>Data storage</DT
><DD
><P
>There will be some server-side storage requirements, for example, to hold
authentication information and data such as last connect time; not to
mention storage of rosters, personal details, and private data. The Data
storage component does this for us. It is known internally as the 
'<TT
CLASS="LITERAL"
>xdb</TT
>' component.  <TT
CLASS="LITERAL"
>xdb</TT
> stands for 
<I
CLASS="EMPHASIS"
>X</I
>ML <I
CLASS="EMPHASIS"
>D</I
>ata <I
CLASS="EMPHASIS"
>B</I
>ase.</P
></DD
><DT
>Hostname resolution</DT
><DD
><P
>Last but not least, we may need some way to resolve names of hosts that
the Jabber server doesn't recognize as "local", as in the Server (to Server)
Connection context. This component is known internally as
'<TT
CLASS="LITERAL"
>dnsrv</TT
>'.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-4-SECT-4.1.2"
>Component types</A
></H2
><P
><A
HREF="x1234.htm#JABTDG-CH-4-FIG-1"
>Figure 4-1</A
> shows the relationship between 
<B
CLASS="COMMAND"
>jabberd</B
> and the components. These components are
the engines that serve and process XML messages, providing their 
services, and <B
CLASS="COMMAND"
>jabberd</B
> is the backbone along which
messages are routed.</P
><DIV
CLASS="FIGURE"
><A
NAME="JABTDG-CH-4-FIG-1"
></A
><P
><B
>Figure 4-1. <B
CLASS="COMMAND"
>jabberd</B
> and the components</B
></P
><PRE
CLASS="SCREEN"
>&#13;                             +---+
                             |   |
            +-------------+  | &#60;----- jabberd backbone
            | Client (to  |  |   |                        
            | server)     |==|   |                  
            | connections |  |   |  +-------------+
            +-------------+  |   |  | Session     |
                             |   |==| management  |
            +-------------+  |   |  |             |
            | Logging     |  |   |  +-------------+
            |             |==|   |
            |             |  |   |  +-------------+
            +-------------+  |   |  | Server (to  |
                             |   |==| server)     |
            +-------------+  |   |  | connections |
            | Data        |  |   |  +-------------+
            | storage     |==|   |
            |             |  |   |  +-------------+
            +-------------+  |   |  | Hostname    |
                             |   |==| resolution  |
            +.............+  |   |  |             |
            :             :  |   |  +-------------+
            : ...         :==|   |
            :             :  :   :
            +.............+  :   :
                             :   :
                             +---+</PRE
></DIV
><P
>As seen in <A
HREF="x1234.htm#JABTDG-CH-4-FIG-1"
>Figure 4-1</A
>, the <B
CLASS="COMMAND"
>jabberd</B
>
backbone acts as the central artery or "hub", managing the "peripheral" 
components that are attached to it. The management of these components
encompasses controlling and overseeing how they connect and coordinating
the flow of data between them. Certain types of components receive only
certain types of data. There is a distinction made between three different
<I
CLASS="EMPHASIS"
>types</I
> of component:</P
><P
></P
><UL
><LI
><P
>log</P
></LI
><LI
><P
>xdb</P
></LI
><LI
><P
>service</P
></LI
></UL
><P
>The different component types handle different types of data packets. Each
packet is in the form of a distinct, fully-formed XML fragment and is
identified by the outermost element name in the XML fragment. This element
name is matched up to a particular component type.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="JABTDG-CH-4-SECT-4.1.2.1"
><I
CLASS="EMPHASIS"
>log</I
> components</A
></H3
><P
><I
CLASS="EMPHASIS"
>log</I
> components handle
<TT
CLASS="LITERAL"
>&#60;log/&#62;</TT
> packets; you can 
guess that these are the components that provide <I
CLASS="EMPHASIS"
>logging</I
>
services. </P
><P
>On receipt of a 
<TT
CLASS="LITERAL"
>&#60;log/&#62;</TT
> data packet
a logging component will (hopefully) do something useful with it, 
like write it to a file or to STDERR.</P
><P
>The <TT
CLASS="LITERAL"
>&#60;log/&#62;</TT
> packet shown in 
<A
HREF="x1234.htm#JABTDG-CH-4-EX-1"
>Example 4-1</A
>
is being used to record the successful connection and authentication
of user <I
CLASS="EMPHASIS"
>dj</I
>,
on <TT
CLASS="FILENAME"
>yak</TT
>, using the Jabber client JabberIM.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-4-EX-1"
></A
><P
><B
>Example 4-1. A <TT
CLASS="LITERAL"
>&#60;log/&#62;</TT
> packet</B
></P
><P
><PRE
CLASS="SCREEN"
>&#60;log type='record' from='dj@yak'&#62;login ok 192.168.0.1 JabberIM&#60;/log&#62;</PRE
></P
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="JABTDG-CH-4-SECT-4.1.2.2"
><I
CLASS="EMPHASIS"
>xdb</I
> components</A
></H3
><P
><I
CLASS="EMPHASIS"
>xdb</I
> components handle 
<TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
> packets.
The <TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
> packets carry 
data and storage/retrieval requests to and from the xdb components which
provide the <I
CLASS="EMPHASIS"
>Data Storage</I
> services.</P
><P
>On receipt of an 
<TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
> data packet
an xdb component will retrieve data from or write data to a storage system
such as a collection of flat files or an RDBMS. </P
><P
>The 
<TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
>
packet shown in 
<A
HREF="x1234.htm#JABTDG-CH-4-EX-2"
>Example 4-2</A
>
is carrying a request from the session manager to retrieve the preferences
stored in a private namespace for the user <I
CLASS="EMPHASIS"
>dj</I
>
(on Jabber server <TT
CLASS="FILENAME"
>yak </TT
> by the Jabber client JabberIM).</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-4-EX-2"
></A
><P
><B
>Example 4-2. An <TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
> data packet</B
></P
><P
><PRE
CLASS="SCREEN"
>&#60;xdb type='get' to='dj@yak' from='sessions' ns='jabberim:prefs' id='5'/&#62;</PRE
></P
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="JABTDG-CH-4-SECT-4.1.2.3"
><I
CLASS="EMPHASIS"
>service</I
> components</A
></H3
><P
><I
CLASS="EMPHASIS"
>service</I
> components handle the three main building
blocks on which the Jabber functionality is based (the 
<TT
CLASS="LITERAL"
>&#60;message/&#62;</TT
>,
<TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
>, and
<TT
CLASS="LITERAL"
>&#60;iq/&#62;</TT
> packets). You can find 
out more about these building blocks in Part II of this book.</P
><P
>In addition, the <I
CLASS="EMPHASIS"
>service</I
> component also handles the 
<TT
CLASS="LITERAL"
>&#60;route/&#62;</TT
> packets, which are
used internally by <B
CLASS="COMMAND"
>jabberd</B
> to move packets around between
components. For example, the <I
CLASS="EMPHASIS"
>Session Management</I
>
component is the component that usually handles client authentication. It 
receives any incoming authorization requests received by and
passed on from
the <I
CLASS="EMPHASIS"
>Client (to Server) Connections</I
> component. However,
it may be that the administrator has configured the Jabber server to use
a different (third party) component, developed by another group or company,
to handle the authorizations. In this
case the request is <I
CLASS="EMPHASIS"
>routed</I
> from one component
(<I
CLASS="EMPHASIS"
>Session Management</I
>) to another (the third-party
authorization component).</P
><P
>So unlike the log and xdb components, which handle data packets
whose element names match the component type
(<TT
CLASS="LITERAL"
>&#60;log/&#62;</TT
> and
<TT
CLASS="LITERAL"
>&#60;xdb/&#62;</TT
>), 
the service component is an umbrella component designed to handle
packets with different element names. </P
><P
><A
HREF="x1234.htm#JABTDG-CH-4-EX-3"
>Example 4-3</A
> shows two typical service packets.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-4-EX-3"
></A
><P
><B
>Example 4-3. Two service packets</B
></P
><P
><PRE
CLASS="SCREEN"

⌨️ 快捷键说明

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