crtd_message.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_SSL_CRTD_MESSAGE_H
10 #define SQUID_SRC_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 
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_SRC_SSL_CRTD_MESSAGE_H */
109 
size_t body_size
The body size if exist or 0.
Definition: crtd_message.h:99
static const std::string param_SetValidAfter
Parameter name for passing SetValidAfter cert adaptation variable.
Definition: crtd_message.h:80
static const std::string param_host
Parameter name for passing hostname.
Definition: crtd_message.h:78
void parseBody(BodyParams &map, std::string &other_part) const
std::string current_block
Current block buffer.
Definition: crtd_message.h:103
static const std::string param_SetValidBefore
Parameter name for passing SetValidBefore cert adaptation variable.
Definition: crtd_message.h:82
void composeBody(BodyParams const &map, std::string const &other_part)
std::map< std::string, std::string > BodyParams
Definition: crtd_message.h:27
const std::string & getCode() const
Current response/request code. If parsing is not finished the method may return incompleted code.
static const std::string code_new_certificate
String code for "new_certificate" messages.
Definition: crtd_message.h:76
ParseState state
Parsing state.
Definition: crtd_message.h:100
std::string compose() const
std::string code
Current response/request code.
Definition: crtd_message.h:102
Definition: Xaction.cc:39
std::string body
Current body.
Definition: crtd_message.h:101
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.
void composeRequest(Ssl::CertificateProperties const &)
ParseResult parse(const char *buffer, size_t len)
Definition: crtd_message.cc:23
static const std::string param_Sign
Parameter name for passing signing algorithm.
Definition: crtd_message.h:86
void parseRequest(CertificateProperties &)
orchestrates entire request parsing
void clear()
Reset the class.
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:19
const std::string & getBody() const
Current body. If parsing is not finished the method returns incompleted body.

 

Introduction

Documentation

Support

Miscellaneous