summaryrefslogtreecommitdiff
path: root/libcult/cult/os/net/socket.hxx
blob: a4711860edf866a8a08f45b9b82a2a651f5fa375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// file      : cult/os/net/socket.hxx
// author    : Boris Kolpackov <boris@kolpackov.Net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef CULT_OS_NET_SOCKET_HXX
#define CULT_OS_NET_SOCKET_HXX

#include <cult/types.hxx>
#include <cult/os/exception.hxx>

#include <sys/socket.h> // sa_family_t

namespace Cult
{
  namespace OS
  {
    namespace Net
    {
      class Socket: public NonCopyable
      {
      public:
        struct Exception : virtual OS::Exception {};

        struct InvalidAddress : virtual Exception {};

      protected:
        Socket ();

        virtual
        ~Socket ();

      public:
        // AF_INET, AF_INET6, etc.
        //
        virtual sa_family_t
        familiy () const = 0;

        // SOCK_DGRAM, SOCK_STREAM, etc.
        //
        virtual Int
        type () const = 0;

        // IPPROTO_UDP, IPPROTO_TCP, IPPROTO_SCTP, etc.
        //
        virtual Int
        protocol () const = 0;
      };
    }
  }
}


#endif  // CULT_OS_NET_SOCKET_HXX