Merge branch develop-3.10 into develop-3.10-next
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / StreamlineSetup.h
1 /**
2  * Copyright (C) ARM Limited 2010-2014. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #ifndef __STREAMLINE_SETUP_H__
10 #define __STREAMLINE_SETUP_H__
11
12 #include <stdint.h>
13 #include <string.h>
14
15 class OlySocket;
16
17 // Commands from Streamline
18 enum {
19         COMMAND_REQUEST_XML = 0,
20         COMMAND_DELIVER_XML = 1,
21         COMMAND_APC_START   = 2,
22         COMMAND_APC_STOP    = 3,
23         COMMAND_DISCONNECT  = 4,
24         COMMAND_PING        = 5
25 };
26
27 class StreamlineSetup {
28 public:
29         StreamlineSetup(OlySocket *socket);
30         ~StreamlineSetup();
31 private:
32         OlySocket* mSocket;
33
34         char* readCommand(int*);
35         void handleRequest(char* xml);
36         void handleDeliver(char* xml);
37         void sendData(const char* data, uint32_t length, char type);
38         void sendString(const char* string, int type) {sendData(string, strlen(string), type);}
39         void sendEvents();
40         void sendConfiguration();
41         void sendDefaults();
42         void sendCounters();
43         void writeConfiguration(char* xml);
44
45         // Intentionally unimplemented
46         StreamlineSetup(const StreamlineSetup &);
47         StreamlineSetup &operator=(const StreamlineSetup &);
48 };
49
50 #endif //__STREAMLINE_SETUP_H__