-
Notifications
You must be signed in to change notification settings - Fork 17
/
XMPPClient.h
54 lines (41 loc) · 944 Bytes
/
XMPPClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _H_XMPP_CLIENT
#define _H_XMPP_CLIENT
#include <Base64.h>
#include <Ethernet.h>
#include <string.h>
#include <stdarg.h>
#include <avr/pgmspace.h>
enum XMPPState {
INIT,
AUTH,
AUTH_STREAM,
BIND,
SESS,
READY,
WAIT
};
class XMPPClient {
private:
Client client;
char *username;
char *server;
char *password;
char *resource;
XMPPState state;
int sendTemplate(const prog_char *strTemplate, int fillLen, ...);
int openStream(char *server);
int authenticate(char *username, char *password);
int bindResource(char *resource);
int openSession(char *server);
void processInput();
int stateAction();
public:
XMPPClient();
XMPPClient(uint8_t *ip, uint16_t port);
int connect(char *username, char *server, char *resource, char *password);
int connect(char *jid, char *password);
int sendMessage(char *recipientJid, char *message);
int sendPresence();
int close();
};
#endif /* _H_XMPP_CLIENT */