crtd_message.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SSL_CRTD_MESSAGE_H
10 #define SQUID_SSL_CRTD_MESSAGE_H
11 
12 #include <map>
13 #include <string>
14 
15 namespace Ssl
16 {
17 class CertificateProperties;
18 
25 {
26 public:
27  typedef std::map<std::string, std::string> BodyParams;
29  enum ParseResult {
30  OK,
33  };
34  enum MessageKind {
37  };
44  ParseResult parse(const char * buffer, size_t len);
46  std::string const & getBody() const;
48  std::string const & getCode() const;
49  void setBody(std::string const & aBody);
50  void setCode(std::string const & aCode);
51  std::string compose() const;
52  void clear();
61  void parseBody(BodyParams & map, std::string & other_part) const;
69  void composeBody(BodyParams const & map, std::string const & other_part);
70 
72  bool parseRequest(Ssl::CertificateProperties &, std::string &error);
73  void composeRequest(Ssl::CertificateProperties const &); // throws
74 
76  static const std::string code_new_certificate;
78  static const std::string param_host;
80  static const std::string param_SetValidAfter;
82  static const std::string param_SetValidBefore;
84  static const std::string param_SetCommonName;
86  static const std::string param_Sign;
88  static const std::string param_SignHash;
89 protected:
90  enum ParseState {
98  };
99  size_t body_size;
101  std::string body;
102  std::string code;
103  std::string current_block;
104 };
105 
106 } //namespace Ssl
107 
108 #endif // SQUID_SSL_CRTD_MESSAGE_H
109 
static const std::string param_SetCommonName
Parameter name for passing SetCommonName cert adaptation variable.
Definition: crtd_message.h:84
void setBody(std::string const &aBody)
Set new body to encode.
CrtdMessage(MessageKind kind)
Definition: crtd_message.cc:17
static const std::string param_SetValidAfter
Parameter name for passing SetValidAfter cert adaptation variable.
Definition: crtd_message.h:80
std::string const & getBody() const
Current body. If parsing is not finished the method returns incompleted body.
void error(char *format,...)
std::string current_block
Current block buffer.
Definition: crtd_message.h:103
void composeBody(BodyParams const &map, std::string const &other_part)
std::string const & getCode() const
Current response/request code. If parsing is not finished the method may return incompleted code...
std::map< std::string, std::string > BodyParams
Definition: crtd_message.h:27
static const std::string param_SetValidBefore
Parameter name for passing SetValidBefore cert adaptation variable.
Definition: crtd_message.h:82
static const std::string code_new_certificate
String code for "new_certificate" messages.
Definition: crtd_message.h:76
std::string code
Current response/request code.
Definition: crtd_message.h:102
std::string body
Current body.
Definition: crtd_message.h:101
ParseState state
Parsing state.
Definition: crtd_message.h:100
static const std::string param_SignHash
The signing hash to use.
Definition: crtd_message.h:88
ParseResult
Parse result codes.
Definition: crtd_message.h:29
void setCode(std::string const &aCode)
Set new request/reply code to compose.
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
std::string compose() const
void composeRequest(Ssl::CertificateProperties const &)
void parseBody(BodyParams &map, std::string &other_part) const
static const std::string param_Sign
Parameter name for passing signing algorithm.
Definition: crtd_message.h:86
bool parseRequest(Ssl::CertificateProperties &, std::string &error)
orchestrates entire request parsing
ParseResult parse(const char *buffer, size_t len)
Definition: crtd_message.cc:21
size_t body_size
The body size if exist or 0.
Definition: crtd_message.h:99
static const std::string param_host
Parameter name for passing hostname.
Definition: crtd_message.h:78
void clear()
Reset the class.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors