4 //******************************************************************
6 // Copyright 2014 Intel Corporation.
8 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
14 // http://www.apache.org/licenses/LICENSE-2.0
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
22 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 #include "OICMiddle.h"
28 typedef vector<string> elements_t;
42 LineInput(MiddleClient *client);
43 void setServer(MiddleServer *server);
45 LineResult processLine(string command, stringstream& result, observecb_t cb);
48 MiddleClient *m_client;
49 MiddleServer *m_server;
50 vector<string> m_resourceList;
52 WrapResource *m_observer;
55 LineResult processHelp(elements_t& elems, stringstream& ss);
56 LineResult processUnrecognized(elements_t& elems, stringstream& ss);
57 LineResult processFind(elements_t& elems, stringstream& ss);
58 LineResult processShow(elements_t& elems, stringstream& ss);
59 LineResult processDetails(elements_t& elems, stringstream& ss);
60 LineResult processGet(elements_t& elems, stringstream& ss);
61 LineResult processPut(elements_t& elems, stringstream& ss);
62 LineResult processObserve(elements_t& elems, stringstream& ss, observecb_t cb);
63 LineResult processCancel(elements_t& elems, stringstream& ss);
64 WrapResource *resolveResource(string resID, stringstream& ss);
65 LineResult parseLine(string lineIn, elements_t& elems);
66 ParseState finishElem(char*& e, elements_t& elems);
67 ParseState putCharInElem(char c, char *& e, ParseState newState);
68 void obsCB(const token_t token, const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode, const int sequenceNumber);
69 void registerResourceWithServer(std::string &url);