A thought of new exception handling; add entrypoint for FireFox
[gssweb.git] / json_gssapi / src / GSSRequest.h
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  *
4  * For license details, see the LICENSE file in the root of this project.
5  *
6  */
7
8 #ifndef GSSREQUEST_H
9 #define GSSREQUEST_H
10
11 #include <string>
12 #include "jsongssapi_export.h"
13 #include "commands/GSSCommand.h"
14 #include "util_json.h"
15
16 using std::string;
17
18 /* An exportable function to be called by firefox
19  * to process a JSON string
20  */
21 extern "C" {
22   char *gss_request(char *json_string);
23   void deallocate_reply(char *reply);
24 }
25
26 class GSSRequest
27 {
28 public:
29   JSONGSSAPI_EXPORT GSSRequest(string jsonString);
30   JSONGSSAPI_EXPORT ~GSSRequest();
31   
32   JSONGSSAPI_EXPORT void execute();
33   JSONGSSAPI_EXPORT string getResponse();
34   
35 private:
36   string      requestString;
37   JSONObject  request;
38   JSONObject  response;
39   GSSCommand *cmd;
40   
41   void getCommand();
42   void parseJSON();
43 };
44
45 #endif // GSSREQUEST_H