corso di applicazioni telematiche
play

Corso di Applicazioni Telematiche A.A. 2009-10 Prof. Simon Pietro - PowerPoint PPT Presentation

XMPP Extensible Messaging and Presence Protocol Corso di Applicazioni Telematiche A.A. 2009-10 Prof. Simon Pietro Romano Universit degli Studi di Napoli Federico II Facolt di Ingegneria XMPP: eXtensible Messaging and Presence Protocol


  1. XMPP Extensible Messaging and Presence Protocol Corso di Applicazioni Telematiche A.A. 2009-10 Prof. Simon Pietro Romano Università degli Studi di Napoli Federico II Facoltà di Ingegneria

  2. XMPP: eXtensible Messaging and Presence Protocol • Formerly known as Jabber • Jeremie Miller began the project in 1998 • first release in May 2000 • The project's main product was jabberd • XML-based • Extensible to other features • Open • open standard • open source implementations • open system

  3. XMPP: eXtensible Messaging and Presence Protocol • Standardization • IETF XMPP Working Group (2002) • RFC 3920 : Core features • RFC 3921 : Instant Messaging and Presence

  4. RFC 3920: Overview and Architecture • … is a protocol for streaming Extensible Markup Language (XML) elements in order to exchange structured information in close to real time between any two network endpoints… • Architecture ��� ���� ���� ���� ���� ���� ���� ���� • XMPP servers • XMPP servers ������ ������ ������ ������ ������ ������ ������ ������ • Manage TCP connections • route messages ������� ������� ������� ������� • server-to-server (5269) ���� ������� ������� ��������� ������ �� • XMPP clients ���� ������ ������� • connect to server (5222) • multiple resources simultaneously • Gateway • translates XMPP into the protocol used by a foreign (non-XMPP) messaging system

  5. RFC 3920: Addressing Scheme • All XMPP entities are uniquely addressable • JID (Jabber Identifier) [ node "@" ] domain [ "/" resource ] • domain identifier: FQDN / address-literal • FQDN ( Fu lly Q ualified D omain N ame ): (sub-domain_1)".“(sub- domain) domain) • address-literal: IPv4address / IPv6address • usually represents servers or gateways (REQUIRED) • node identifier • a simple string • usually represents a client (OPTIONAL) • resource identifier • usually represents a specific session , connection or object belonging to the entity associated with a node identifier (OPTIONAL).

  6. JID: examples • domain meetecho.com • node@domain tcastaldi@meetecho.com • node@domain/resource tcastaldi@meetecho.com/Spark tcastaldi@meetecho.com/iMeetecho 6

  7. XML example • ��������� �������������

  8. RFC 3920: XML Stream • XML Stream • container for the exchange of XML Stanzas between any two entities over a network • start � � � <stream> tag with appropriate attributes � and namespace • end � • end � � </stream> tag � � � </stream> tag � � • the stream enables unidirectional communication • qualified by the default namespace for the stream • jabber:client (client and server ) • jabber:server (server-to-server)

  9. Stream example 1. Client initiates stream to server <?xml version='1.0'?> <stream:stream to='example.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'> 2. Server responds by sending a stream tag to 2. Server responds by sending a stream tag to client <?xml version='1.0'?> <stream:stream from='example.com' id='someid' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'> …encryption, authentication, and resource binding… 9

  10. Encryption: use of TLS • Method for securing the stream • Transport Layer Security (TLS) protocol • "STARTTLS" extension • namespace name – 'urn:ietf:params:xml:ns:xmpp-tls‘ 3. Server sends the STARTTLS extension to client 3. Server sends the STARTTLS extension to client <stream:features> <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'> <required/> </starttls> <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> <mechanism>DIGEST-MD5</mechanism> <mechanism>PLAIN</mechanism> </mechanisms> </stream:features> 10

  11. Use of TLS (2) 4. Client sends the STARTTLS command to server <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> 5. Server informs client that it is allowed to proceed <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> 6. Client and server attempt to complete TLS negotiation over the existing TCP connection negotiation over the existing TCP connection 7. If TLS negotiation is successful, client initiates a new stream to server 8. Server responds by sending a stream header to client along with any available stream features 9. Client continues with SASL negotiation 11

  12. RFC 3920: XML Stanza • XML Stanza • discrete semantic unit of structured information that is sent over an XML stream • exists at the direct child level of the root • exists at the direct child level of the root <stream> element

  13. XMPP stanzas • defined stanzas are: • <message> entity pushes information to another entity • <presence> availaibility information info/query request-response mechanism • <iq> • qualified by the default namespace for the stream • qualified by the default namespace for the stream • Common Attributes • to, from, type, id, xml:lang <message type='chat' from='juliet@exmpl.com' to='romeo@exmpl.net'> <body>Art thou not Romeo, and a Montague?</body> </message> 13

  14. RFC 3921: Instant Messaging and Presence • Describes extensions to and applications of the core features XMPP that provide the basic instant messaging (IM) and presence functionality • Requirements • Requirements • Exchange messages with other users • Exchange presence information with other users • Manage subscriptions to and from other users • Manage items in a contact list (in XMPP this is called a " roster ") • Block communications to or from specific other users

  15. RFC 3921: Message Syntax • Possible values of types for Message packets • chat : sent in the context of a one-to-one chat • groupchat: sent in the context of a multi-user chat • Child Elements • <subject/> contains the topic of the message • <body/> the textual content of the message • <body/> the textual content of the message • <thread/> identifier that is used for tracking a conversation thread <message to='romeo@ex.net' from='juliet@exm.com/balcony' type='chat' xml:lang='en'> <subject>The balcony scene!</subject> <subject xml:lang=‘it'>La scena del balcone!</subject> <body>Wherefore art thou, Romeo?</body> <body xml:lang=‘it'>Perché sei tu, Romeo?</body> </message>

  16. RFC 3921: Presence Syntax Possible values of types for Presence packets • • subscribe : the sender wishes to subscribe to the recipient's presence • unavailable : signals that the entity is no longer available • probe : request for an entity's current presence • Child Elements • <show/> specifies the particular availability status • <show/> specifies the particular availability status • away, chat, dnd = "Do Not Disturb“ and xa = "eXtended Away" • <status/> a description of availability status • <priority/> the priority level of the resource [-128, +127] <presence xml:lang='en'> <show>dnd</show> <status>Wooing Rupert</status> <priority>1</priority> </presence>

  17. RFC 3921: IQ Syntax • Extended namespace • defines all data contained within the child element Possible values of types for IQ packets • • get • set • result • Use case: retrieving One's Roster on Login • 'jabber:iq:roster' namespace • 'jabber:iq:roster' namespace <iq from='juliet@example.com/balcony' type='get' id='roster_1'> <query xmlns='jabber:iq:roster'/> </iq> <iq to='juliet@example.com/balcony' type='result' id='roster_1'> <query xmlns='jabber:iq:roster'> <item jid='romeo@example.net' name='Romeo‘ subscription='both'> <group>Friends</group> </item> </query> </iq>

  18. XEP: XMPP Extension Protocol ���� !""#$%����� • Is a pure XMPP signalling protocol • Designed to interwork with SIP • Initiating and managing media sessions between two XMPP entities • negotiation occurs over the XMPP "channel" • media is exchanged outside the XMPP using RTP, UDP…. • • How it works: File transfer How it works: File transfer &���� %����� ���������������� ��� �������������� ��� ������������� ����������������� ���

Recommend


More recommend