libzypp 17.37.17
sockaddr.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* You have been warned!
12*
13*/
14#ifndef ZYPPNG_IO_SOCKADDR_H_DEFINED
15#define ZYPPNG_IO_SOCKADDR_H_DEFINED
16
17#include <cstddef>
18#include <sys/socket.h>
19#include <memory>
20#include <string>
21
22struct sockaddr_un;
23
24namespace zyppng {
25
26 class SockAddr {
27 public:
28 virtual ~SockAddr(){};
29 virtual struct ::sockaddr* nativeSockAddr () const = 0;
30 virtual std::size_t size () const = 0;
31 protected:
32
33 };
34
35 class UnixSockAddr : public SockAddr
36 {
37 public:
38
39 using Ptr = std::shared_ptr<UnixSockAddr>;
40
41 UnixSockAddr( const std::string &path, bool abstract );
42
43 // SockAddr interface
44 sockaddr *nativeSockAddr() const override;
45 std::size_t size() const override;
46
47 bool isAbstract () const;
48
49 private:
50 std::shared_ptr<struct sockaddr_un> _data;
51 };
52}
53
54#endif // SOCKADDR_H
virtual struct::sockaddr * nativeSockAddr() const =0
virtual std::size_t size() const =0
virtual ~SockAddr()
Definition sockaddr.h:28
std::shared_ptr< UnixSockAddr > Ptr
Definition sockaddr.h:39
bool isAbstract() const
Definition sockaddr.cpp:27
std::size_t size() const override
Definition sockaddr.cpp:22
sockaddr * nativeSockAddr() const override
Definition sockaddr.cpp:17
UnixSockAddr(const std::string &path, bool abstract)
Definition sockaddr.cpp:6
std::shared_ptr< struct sockaddr_un > _data
Definition sockaddr.h:50