summaryrefslogtreecommitdiff
path: root/libcult/cult/os/net/datagram-socket.hxx
blob: 62d1a0733370d77f4c6b096a2411f38f8932b998 (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
55
56
57
// file      : cult/os/net/datagram-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_DATAGRAM_SOCKET_HXX
#define CULT_OS_NET_DATAGRAM_SOCKET_HXX

#include <cult/types.hxx>

#include <cult/os/net/address.hxx>
#include <cult/os/net/socket.hxx>

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

namespace Cult
{
  namespace OS
  {
    namespace Net
    {
      class DatagramSocket: public virtual Socket
      {
      protected:
        DatagramSocket ();

        virtual
        ~DatagramSocket ();

      public:
        virtual Int
        type () const
        {
          return SOCK_DGRAM;
        }

      public:
        virtual Size
        send (Void const* buf, Size size, Address const& addr) = 0;

        virtual Size
        recv (Void* buf, Size size) = 0;

        /*
        virtual Boolean
        recv (Void* buf,
              Size size,
              Size& received,
              OS::Time const& timeout) = 0;
        */
      };
    }
  }
}


#endif  // CULT_OS_NET_DATAGRAM_SOCKET_HXX