|
| 1 | +// Copyright (c) Glyn Matthews 2010. |
| 2 | +// Distributed under the Boost Software License, Version 1.0. |
| 3 | +// (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | +// http://www.boost.org/LICENSE_1_0.txt) |
| 5 | + |
| 6 | + |
| 7 | +#ifndef __BOOST_NETWORK_PROTOCOL_XMPP_CLIENT_INC__ |
| 8 | +#define__BOOST_NETWORK_PROTOCOL_XMPP_CLIENT_INC__ |
| 9 | + |
| 10 | + |
| 11 | +#include<boost/utility/noncopyable.hpp> |
| 12 | +#include<boost/network/traits/string.hpp> |
| 13 | +#include<boost/cstdint.hpp> |
| 14 | +#include<boost/network/protocol/xmpp/message.hpp> |
| 15 | +#include<boost/network/protocol/xmpp/presence.hpp> |
| 16 | +#include<boost/network/protocol/xmpp/iq.hpp> |
| 17 | + |
| 18 | + |
| 19 | +namespaceboost { |
| 20 | +namespacenetwork { |
| 21 | +namespacexmpp { |
| 22 | +template< |
| 23 | +classHandler, |
| 24 | +classTag |
| 25 | + > |
| 26 | +classbasic_client : boost::noncopyable { |
| 27 | +public: |
| 28 | + |
| 29 | +typedeftypename string<Tag>::type string_type; |
| 30 | + |
| 31 | +typedef basic_message<Tag> message; |
| 32 | +typedef basic_presence<Tag> presence; |
| 33 | +typedef basic_iq<Tag> iq; |
| 34 | + |
| 35 | +explicitbasic_client(Handler handler); |
| 36 | + |
| 37 | +~basic_client(); |
| 38 | + |
| 39 | +voidconnect(const string_type &proxy_host, |
| 40 | +const string_type &proxy_port); |
| 41 | + |
| 42 | +voiddisconnect(); |
| 43 | + |
| 44 | +voidauthenticate(const string_type &jid, |
| 45 | +const string_type &password); |
| 46 | + |
| 47 | +voidsend_message(const message_type &message); |
| 48 | + |
| 49 | +voidsend_presence(const presence_type &presence); |
| 50 | + |
| 51 | +voidsend_iq(const iq_type &iq); |
| 52 | + |
| 53 | + string_typejid()const; |
| 54 | + |
| 55 | + string_typebound_jid()const; |
| 56 | + |
| 57 | +private: |
| 58 | + |
| 59 | +// tcp socket |
| 60 | +// tls |
| 61 | +// sasl |
| 62 | + |
| 63 | +// parameters, such as jid, bound_jid, domain, port etc. |
| 64 | + |
| 65 | +// io_service |
| 66 | + |
| 67 | +// xml parser |
| 68 | + |
| 69 | +// event handler |
| 70 | + |
| 71 | +// stream open handler |
| 72 | + |
| 73 | +// connection event handlers |
| 74 | + |
| 75 | + Handler handler_; |
| 76 | + |
| 77 | +}; |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +template< |
| 82 | +classHandler |
| 83 | + > |
| 84 | +structclient : basic_client<tags::default_> { |
| 85 | + |
| 86 | +explicitclient(Handler handler) : basic_client<tags::default_>(handler) { |
| 87 | + |
| 88 | + } |
| 89 | + |
| 90 | +}; |
| 91 | +}// namespace xmpp |
| 92 | +}// namespace network |
| 93 | +}// namespace boost |
| 94 | + |
| 95 | + |
| 96 | +#endif// __BOOST_NETWORK_PROTOCOL_XMPP_CLIENT_INC__ |