atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
utils.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 utils.h
15  * @brief Contains utility functions available to users of the api.
16  *
17  * @author Brian Geffon
18  * @author Manjesh Nilange
19  */
20 
21 #pragma once
22 #ifndef ATSCPPAPI_UTILS_H_
23 #define ATSCPPAPI_UTILS_H_
24 
25 #include <string>
26 #include <arpa/inet.h>
27 #include <stdint.h>
28 
29 namespace atscppapi {
30 namespace utils {
31 
32 /**
33  * @brief Returns a pretty printed string of a sockaddr *
34  *
35  * @param sockaddr* A pointer to a sockaddr *
36  * @return a string which is the pretty printed address
37  */
38 std::string getIpString(const sockaddr *);
39 
40 /**
41  * @brief Returns just the port portion of the sockaddr *
42  *
43  * @param sockaddr* A pointer to a sockaddr *
44  * @return a uint16_t which is the port from the sockaddr *
45  */
46 uint16_t getPort(const sockaddr *);
47 
48 /**
49  * @brief Returns a pretty printed string of a sockaddr * including port
50  *
51  * @param sockaddr* A pointer to a sockaddr *
52  * @return a string which is the pretty printed address including port
53  */
54 std::string getIpPortString(const sockaddr *);
55 
56 /**
57  * @brief This is the environment variable that disables caching in all
58  * types including InitializableValue.
59  */
60 extern const std::string DISABLE_DATA_CACHING_ENV_FLAG;
61 
62 }
63 }
64 
65 #endif /* ATSCPPAPI_UTILS_H_ */