d6d9a6ea29919db845ec5c4777c56b28698adda1
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / StreamlineSetup.h
1 /**
2  * Copyright (C) ARM Limited 2010-2013. 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 "OlySocket.h"
13
14 // Commands from Streamline
15 enum {
16         COMMAND_REQUEST_XML = 0,
17         COMMAND_DELIVER_XML = 1,
18         COMMAND_APC_START   = 2,
19         COMMAND_APC_STOP    = 3,
20         COMMAND_DISCONNECT  = 4,
21         COMMAND_PING            = 5
22 };
23
24 class StreamlineSetup {
25 public:
26         StreamlineSetup(OlySocket *socket);
27         ~StreamlineSetup();
28 private:
29         OlySocket* mSocket;
30
31         char* readCommand(int*);
32         void handleRequest(char* xml);
33         void handleDeliver(char* xml);
34         void sendData(const char* data, uint32_t length, char type);
35         void sendString(const char* string, int type) {sendData(string, strlen(string), type);}
36         void sendEvents();
37         void sendConfiguration();
38         void sendDefaults();
39         void sendCounters();
40         void writeConfiguration(char* xml);
41
42         // Intentionally unimplemented
43         StreamlineSetup(const StreamlineSetup &);
44         StreamlineSetup &operator=(const StreamlineSetup &);
45 };
46
47 #endif  //__STREAMLINE_SETUP_H__