atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Response.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 LinkedIn Corp. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of the license at
5  * http://www.apache.org/licenses/LICENSE-2.0
6  *
7  * Unless required by applicable law or agreed to in writing, software distributed under the
8  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9  * either express or implied.
10  *
11  */
12 
13 /**
14  * @file Response.h
15  * @author Brian Geffon
16  * @author Manjesh Nilange
17  */
18 
19 #pragma once
20 #ifndef ATSCPPAPI_RESPONSE_H_
21 #define ATSCPPAPI_RESPONSE_H_
22 
23 #include <atscppapi/Headers.h>
24 #include <atscppapi/HttpVersion.h>
25 #include <atscppapi/HttpStatus.h>
26 
27 namespace atscppapi {
28 
29 // forward declarations
30 struct ResponseState;
31 namespace utils { class internal; }
32 
33 /**
34  * @brief Encapsulates a response.
35  */
36 class Response: noncopyable {
37 public:
38  Response();
39 
40  /** @return HTTP version of the response */
41  HttpVersion getVersion() const;
42 
43  /** @return Status code of the response */
44  HttpStatus getStatusCode() const;
45 
46  /** @param New status code to set */
47  void setStatusCode(HttpStatus);
48 
49  /** @return Reason phrase of the response */
50  const std::string &getReasonPhrase() const;
51 
52  /** @param New reason phrase to set */
53  void setReasonPhrase(const std::string &);
54 
55  /** @return Headers of the response */
56  Headers &getHeaders() const;
57 
58  ~Response();
59 private:
60  ResponseState *state_;
61  void init(void *hdr_buf, void *hdr_loc);
62  friend class Transaction;
63  friend class utils::internal;
64 };
65 
66 }
67 
68 #endif