blob: 741f4c892b364cd9ce0986d15b63abd7940f625b [file] [log] [blame]
Nathan Bullockbdabded2015-02-10 20:15:53 -05001// Copyright 2015 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BUFFET_XMPP_XMPP_CONNECTION_H_
6#define BUFFET_XMPP_XMPP_CONNECTION_H_
7
8#include <string>
9
10#include <base/macros.h>
11
12namespace buffet {
13
14class XmppConnection {
15 public:
16 XmppConnection() {}
17 virtual ~XmppConnection();
18
19 // Initialize the XMPP client. (Connects to talk.google.com:5222).
20 virtual bool Initialize();
21
22 int GetFileDescriptor() const { return fd_; }
23
24 // Needs to be called when new data is available from the connection.
25 virtual bool Read(std::string* msg) const;
26
27 // Start talking to the XMPP server (authenticate, etc.)
28 virtual bool Write(const std::string& msg) const;
29
30 private:
31 // The file descriptor for the connection.
32 int fd_{-1};
33
34 DISALLOW_COPY_AND_ASSIGN(XmppConnection);
35};
36
37} // namespace buffet
38
39#endif // BUFFET_XMPP_XMPP_CONNECTION_H_
40