atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Request.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 Request.h
15  * @author Brian Geffon
16  * @author Manjesh Nilange
17  */
18 
19 #pragma once
20 #ifndef ATSCPPAPI_REQUEST_H_
21 #define ATSCPPAPI_REQUEST_H_
22 
23 #include <atscppapi/Headers.h>
24 #include <atscppapi/HttpVersion.h>
25 #include <atscppapi/HttpMethod.h>
26 #include <atscppapi/Url.h>
27 #include <atscppapi/noncopyable.h>
28 
29 namespace atscppapi {
30 
31 class Transaction;
32 struct RequestState;
33 
34 /**
35  * @brief Encapsulates a request.
36  */
37 class Request: noncopyable {
38 public:
39  Request();
40 
41  /**
42  * Constructed with an initial URL.
43  */
44  Request(const std::string &url, HttpMethod method = HTTP_METHOD_GET, HttpVersion version = HTTP_VERSION_1_1);
45 
46  /** @return HTTP method of the request */
47  HttpMethod getMethod() const;
48 
49  /** @return URL of the request */
50  Url &getUrl();
51 
52  /** @return HTTP version of the request */
53  HttpVersion getVersion() const;
54 
55  /** @return Headers of the request */
56  Headers &getHeaders() const;
57 
58  ~Request();
59 private:
60  Request(void *hdr_buf, void *hdr_loc);
61  RequestState *state_;
62  void init(void *hdr_buf, void *hdr_loc);
63  friend class Transaction;
64  friend class ClientRequest;
65 };
66 
67 }
68 
69 #endif