summaryrefslogtreecommitdiffstats
path: root/socket_channel.hpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2018-10-12 13:20:49 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2018-11-02 15:44:15 -0700
commit9e801a2b5b36acd307606af5eafdb885dfe8daee (patch)
tree87d6cdef2c9008d76e9a99784e83f2b3af90ebc0 /socket_channel.hpp
parentf6110552bd0e940efe51eb11c0415bebb2ab883f (diff)
downloadphosphor-net-ipmid-9e801a2b5b36acd307606af5eafdb885dfe8daee.tar.gz
phosphor-net-ipmid-9e801a2b5b36acd307606af5eafdb885dfe8daee.zip
netipmid: apply clang-format rules
Lots of whitespace change. Let clang-format do its job and keep the code looking nice. Change-Id: Idfcad1a99cab8170d55a06163de8ad3f420b68b7 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'socket_channel.hpp')
-rw-r--r--socket_channel.hpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/socket_channel.hpp b/socket_channel.hpp
index 5996b62..8a2edce 100644
--- a/socket_channel.hpp
+++ b/socket_channel.hpp
@@ -17,107 +17,107 @@ namespace udpsocket
*/
class Channel
{
- public:
- struct SockAddr_t
+ public:
+ struct SockAddr_t
+ {
+ union
{
- union
- {
- sockaddr sockAddr;
- sockaddr_in6 inAddr;
- };
- socklen_t addrSize;
+ sockaddr sockAddr;
+ sockaddr_in6 inAddr;
};
+ socklen_t addrSize;
+ };
- /**
- * @brief Constructor
- *
- * Initialize the IPMI socket object with the socket descriptor
- *
- * @param [in] File Descriptor for the socket
- * @param [in] Timeout parameter for the select call
- *
- * @return None
- */
- Channel(int insockfd, timeval& inTimeout)
- {
- sockfd = insockfd;
- timeout = inTimeout;
- }
+ /**
+ * @brief Constructor
+ *
+ * Initialize the IPMI socket object with the socket descriptor
+ *
+ * @param [in] File Descriptor for the socket
+ * @param [in] Timeout parameter for the select call
+ *
+ * @return None
+ */
+ Channel(int insockfd, timeval& inTimeout)
+ {
+ sockfd = insockfd;
+ timeout = inTimeout;
+ }
- /**
- * @brief Fetch the IP address of the remote peer
- *
- * Returns the IP address of the remote peer which is connected to this
- * socket
- *
- * @return IP address of the remote peer
- */
- std::string getRemoteAddress() const;
+ /**
+ * @brief Fetch the IP address of the remote peer
+ *
+ * Returns the IP address of the remote peer which is connected to this
+ * socket
+ *
+ * @return IP address of the remote peer
+ */
+ std::string getRemoteAddress() const;
- /**
- * @brief Fetch the port number of the remote peer
- *
- * Returns the port number of the remote peer
- *
- * @return Port number
- *
- */
- auto getPort() const
- {
- return address.inAddr.sin6_port;
- }
+ /**
+ * @brief Fetch the port number of the remote peer
+ *
+ * Returns the port number of the remote peer
+ *
+ * @return Port number
+ *
+ */
+ auto getPort() const
+ {
+ return address.inAddr.sin6_port;
+ }
- /**
- * @brief Read the incoming packet
- *
- * Reads the data available on the socket
- *
- * @return A tuple with return code and vector with the buffer
- * In case of success, the vector is populated with the data
- * available on the socket and return code is 0.
- * In case of error, the return code is < 0 and vector is set
- * to size 0.
- */
- std::tuple<int, std::vector<uint8_t>> read();
+ /**
+ * @brief Read the incoming packet
+ *
+ * Reads the data available on the socket
+ *
+ * @return A tuple with return code and vector with the buffer
+ * In case of success, the vector is populated with the data
+ * available on the socket and return code is 0.
+ * In case of error, the return code is < 0 and vector is set
+ * to size 0.
+ */
+ std::tuple<int, std::vector<uint8_t>> read();
- /**
- * @brief Write the outgoing packet
- *
- * Writes the data in the vector to the socket
- *
- * @param [in] inBuffer
- * The vector would be the buffer of data to write to the socket.
- *
- * @return In case of success the return code is 0 and return code is
- * < 0 in case of failure.
- */
- int write(const std::vector<uint8_t>& inBuffer);
+ /**
+ * @brief Write the outgoing packet
+ *
+ * Writes the data in the vector to the socket
+ *
+ * @param [in] inBuffer
+ * The vector would be the buffer of data to write to the socket.
+ *
+ * @return In case of success the return code is 0 and return code is
+ * < 0 in case of failure.
+ */
+ int write(const std::vector<uint8_t>& inBuffer);
- /**
- * @brief Returns file descriptor for the socket
- */
- auto getHandle(void) const
- {
- return sockfd;
- }
+ /**
+ * @brief Returns file descriptor for the socket
+ */
+ auto getHandle(void) const
+ {
+ return sockfd;
+ }
- ~Channel() = default;
- Channel(const Channel& right) = delete;
- Channel& operator=(const Channel& right) = delete;
- Channel(Channel&&) = default;
- Channel& operator=(Channel&&) = default;
+ ~Channel() = default;
+ Channel(const Channel& right) = delete;
+ Channel& operator=(const Channel& right) = delete;
+ Channel(Channel&&) = default;
+ Channel& operator=(Channel&&) = default;
- private:
- /*
- * The socket descriptor is the UDP server socket for the IPMI port.
- * The same socket descriptor is used for multiple ipmi clients and the
- * life of the descriptor is lifetime of the net-ipmid server. So we
- * do not need to close the socket descriptor in the cleanup of the
- * udpsocket class.
- */
- int sockfd;
- SockAddr_t address;
- timeval timeout;
+ private:
+ /*
+ * The socket descriptor is the UDP server socket for the IPMI port.
+ * The same socket descriptor is used for multiple ipmi clients and the
+ * life of the descriptor is lifetime of the net-ipmid server. So we
+ * do not need to close the socket descriptor in the cleanup of the
+ * udpsocket class.
+ */
+ int sockfd;
+ SockAddr_t address;
+ timeval timeout;
};
} // namespace udpsocket
OpenPOWER on IntegriCloud