Transcript JABBER

경희대학교 KHLUG
한국외국어대학교 GNUVILL
JABBER?



XMPP 기반의 Protocol
Instant Messenger들이 가져야 할 모든
프로토콜 요소를 포함
\Jabber를 지원하는 Client는 모든 공개
Jabber 서버에 접속 가능
JABBER의 구조





C1, C2, C3 = XMPP Client
S1, S2 = XMPP Server
G1 = XMPP와 외부 메시징 네트워크에서
사용되는 프로토콜들 사이의 Gateway
FN1 = 외부 메시징 네트워크
FC1 = 외부 메시징 네트워크의 클라이언트
JABBER의 구조
어떠한 Jabber public server에 위치하고 있더
라도 다른 server에 있는 사용자와 대화 가능
PROTOCOL의 예
Server advertises resource binding feature to client:
<stream:stream
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
id='c2s_345'
from='example.com'
version='1.0'>
<stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
</stream:features>
Client asks server to bind a resource:
<iq type='set' id='bind_1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</iq>
JABBER의 장점
전 세계 Jabber User와 대화 가능
 Google talk와 연동 가능(예정)
 인증 protocol로 messenger 신뢰성 향상
 기존 messenger와의 차별화
 Server 및 Client Libraries 제공
 Protocol만 활용하는 것이 가능
 Protocol로 인한 문제를 미연에 방지
 XML 표준화로 타 기능과 연동에 용이

향후 전망



Google talk의 public server로 전환 예고
국제 인터넷 표준 기술 협회(IETF)의 인스
턴트 메신저 표준 후보 중 하나
인텔, HP, AT&T 등의 지원
JABBER의 특징
Open
JABBER의 특징
Extension
JABBER의 특징
Security
JABBER의 특징
Presence
JABBER의 특징
XML
JABBER의 구현
XMPP 메시징 프로토콜의 정의
- Messege 교환
- Log-in 정보 교환
- User 초대 및 수락
- Budy List 관리
- 특정 User block
JABBER의 구현
스키마의 종류
 namespace  jabber:client
jabber:server
 type
 chat, error, groupchat , headline, normal
 <subject/>  언어 인코딩 설정. xml:lang
 <body/> 읽을 수 있는 메시지
 <thread/>
 읽을 수 없는 메시지, 암호화된 코드
JABBER의 구현
Presence의 종류(type)
 unavailable : 통신 불가
 subscribe : 수락요청 메시지
 subscribed : User의 친구요청 수락 메시지
 unsubscribe : User 제거
 unsubscribed : User의 친구요청 거부 메시지
 probe : User간의 관계 정보
 error : 패킷 전송 중 일어날 수 있는 에러
JABBER의 구현
show의 종류(my Status)
 away: 자리비움
 chat : 채팅 중
 dnd: Busy
 xa : 아주 멀리 갔을때 (extended away)
 status : User의 행동 상태 대한 설명
 priority : -128~127까지 int 형 등급 변수
 Iq : 구조화된 요청/반응 메카니즘을 증명
JABBER의 구현
1. Session 설정
 보통 클라이언트와 서버가 연결되면 세
션이 설정
 Stream 증명: 클라이언트는 세션이 연결
되거나, 메시지 전송전 에 인증
 Resource Binding
ex) [email protected]/resource
JABBER의 구현
1. Session 설정
서버가 클라이언트에게 세션설립을 위한 특징을 알린다.
<stream:stream
xmlns='jabber:client' // 클라이언트에게
xmlns:stream='http://etherx.jabber.org/streams'
id='c2s_345' // 서버의 누군가의 아이디
from='example.com' // 서버 주소
version='1.0'> // 버전
<stream:features> // 즉 이 안에 있는게 필요하다
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
<session xmlns='urn:ietf:params:xml:ns:xmppsession'/>
</stream:features>
JABBER의 구현
1. Session 설정
Step 1: Client requests session with server: exa
mple.com 서버에게 sess_1 유저가 세션 연결
요청을 한다.
<iq to='example.com' type='set' id='sess_1'>
<session xmlns='urn:ietf:params:xml:ns:xmpp
-session'/>
</iq>
JABBER의 구현
1. Session 설정
Step 2: Server informs client that session has
been created: 서버가 sess_1 유저에게 세션
이 생성되었다고 알린다.
<iq from='example.com' type='result' id='sess
_1'/>
JABBER의 구현
1. Session 설정
Step 3: 만약 세션연결이 실패하면 실패 메시지를 반드시
보내야 한다.
<iq from='example.com' type='error' id='sess_1'>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'
/>
<error type='wait'>
<internal-server-error xmlns='urn:ietf:params:xml:ns:x
mpp-stanzas'/> // 서버에러
</error>
</iq>
JABBER의 구현
1. Session 설정
Step 4: 잘못된 아이디나 패스워드에 의해 세션연결이 안될
경우
<iq from='example.com' type='error' id='sess_1'>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
<error type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas
'/>
</error>
</iq>
// resource 란 패스워드같은 것 을 뜻함.
// 즉 [email protected]/password
JABBER의 구현
2. 메세지 교환
<message
to='[email protected]' // romeo에게
from='[email protected]/balcony'
// juliet로부터
user_id@address/resource //ID 및 Password
type='chat' // 유형은 채팅
xml:lang='en'> // 메시지 인코딩 유형
<body>Wherefore art thou, Romeo?</body>
// 메시지 바디
</message>
JABBER의 구현
3. Presence에 대한 Client와 Server
<presence xml:lang='en'>
<show>dnd</show>
<status>Wooing Juliet</status>
<status xml:lang='cz'>Ja dvo&#x0159;
&#x00ED;m Juliet</status>
<priority>1</priority> //가중치 부여
</presence>
JABBER의 구현
4. Subscription
- 다른 Client User에 친구 요청
<presence to='[email protected]' type='subscribe'/>
- 친구요청 메시지 승낙
<presence to='[email protected]' type='subscribed'/>
- 친구요청 메시지 거부
<presence to='[email protected]' type='unsubscribed'/>
- 친구 삭제 메시지 (클라이언트)
<presence to='[email protected]' type='unsubscribe'/>
JABBER의 구현
5. Roster 관리 ( 친구관리)
// 서버에 현재 친구리스트를 달라고 요청한다.
<iq from='[email protected]/balcony'
type='get'
id='roster_1'>
<query xmlns='jabber:iq:roster'/>
</iq>
JABBER의 구현
5. Roster 관리 ( 친구관리)
// 서버로부터 받은 친구 리스트 메시지
<iq to='[email protected]/balcony' type='result' id='roster_1'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]‘ name='Romeo‘ subscription='bot
h'>
<group>Friends</group> </item>
<item jid='[email protected]‘ name='Mercutio‘ subscription='
from'>
<group>Friends</group></item>
<item jid='[email protected]‘ name='Benvolio‘ subscription='
both'>
<group>Friends</group>
</item></query></iq>
JABBER의 구현
5. Roster 관리 ( 친구관리)
//친구 추가하기
<iq from='[email protected]/balcony' type='set' i
d='roster_2'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]'
name='Nurse'>
<group>Servants</group>
</item>
</query>
</iq>
JABBER의 구현
5. Roster 관리 ( 친구관리)
//이미 존재하는 친구 그룹
<iq from='[email protected]/balcony'
type='set' id='roster_2'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]‘ name='Nurse'>
<group>Friends</group>
<group>Lovers</group>
</item>
</query>
</iq>
JABBER의 구현
5. Roster 관리 ( 친구관리)
// 서버는 모든 이용가능한 리소스에게 이 수정된 정보를 전송한다.
<iq to='[email protected]/balcony‘ type='set‘ id='a78b4q6ha463'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]‘ name='Nurse’ subscription='none'>
<group>Servants</group>
</item></query></iq>
<iq to='[email protected]/chamber‘ type='set‘ id='a78b4q6ha464'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]‘ name='Nurse‘ subscription='none'>
<group>Servants</group>
</item></query></iq>
// 전송이 되면 결과 메시지를 클라이언트에게 전송한다.
<iq to='[email protected]/balcony' type='result' id='roster_2'/>
JABBER의 구현
5. Roster 관리 ( 친구관리)
//[email protected] 이란 친구 삭제하기
<iq from='[email protected]/balcony'
type='set'
id='roster_4'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]'
subscription='remove'/>
</query>
</iq>
Thank you!!