Revision 1772a358 include/IPAMRequest.h

View differences:

include/IPAMRequest.h
17 17
#ifndef IPAM_REQUEST_H_
18 18
#define IPAM_REQUEST_H_
19 19

  
20
#include <time.h>
21
#include <set>
22

  
23
#include "ActionManager.h"
24
#include "IPAMManager.h"
25
#include "NebulaUtil.h"
26

  
27 20
#include "SyncRequest.h"
28

  
29
using namespace std;
21
#include "NebulaUtil.h"
30 22

  
31 23
/**
32
 *  The IPAMRequest class is used to pass an Authorization or Authentication
24
 *  The IPAMRequest class represents a request for the IPAM driver. The request
25
 *  is in the form
33 26
 *  request to the AuthManager. The result of the request will be stored
34 27
 *  in the result and message attributes of this class.
35 28
 */
36 29
class IPAMRequest : public SyncRequest
37 30
{
38 31
public:
39
    IPAMRequest(string _params): params(_params){};
32
    /* ---------------------------------------------------------------------- */
33
    /* IPAM Request constructors                                              */
34
    /* ---------------------------------------------------------------------- */
35
    IPAMRequest(const std::string& _ar_xml) :
36
        ar_xml(_ar_xml), address_xml("<ADDRESS></MAC></IP></IP6_GLOBAL>"
37
                "</IP6_ULA></SIZE></ADDRESS>"){};
40 38

  
41
    ~IPAMRequest(){};
39
    IPAMRequest(const std::string& _ar_xml, const std::string& _address_xml) :
40
        ar_xml(_ar_xml), address_xml(_address_xml){};
42 41

  
43
private:
42
    virtual ~IPAMRequest(){};
43

  
44
    /* ---------------------------------------------------------------------- */
45
    /* Driver message formatting and processing                               */
46
    /* ---------------------------------------------------------------------- */
47
    std::string& to_xml64(std::string& action_data) const
48
    {
49
        std::ostringstream oss;
50
        std::string * aux_str;
44 51

  
45
    friend class IPAMManager;
52
        oss << "<IPAM_DRIVER_ACTION_DATA>"
53
            << ar_xml
54
            << address_xml
55
            << "</IPAM_DRIVER_ACTION_DATA>";
46 56

  
57
        aux_str     = one_util::base64_encode(oss.str());
58
        action_data = *aux_str;
59

  
60
        free(aux_str);
61

  
62
        return action_data;
63
    }
64

  
65
private:
47 66
    /**
48
     *  The params for this request
67
     *  XML representation for this request <AR>...</AR>
49 68
     */
50
    string    params;
69
    string ar_xml;
51 70

  
71
    /**
72
     * Address request representation
73
     */
74
    string address_xml;
52 75
};
53 76

  
54 77
#endif

Also available in: Unified diff