aboutsummaryrefslogtreecommitdiff
path: root/src/stable/serversocket.h
blob: cb2591d721ab5dcccdd2d95728621621b7f26313 (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
/*
 * Copyright (C) 2007-2019 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef BU_SERVER_SOCKET_H
#define BU_SERVER_SOCKET_H

#include <stdint.h>

namespace Bu
{
    class Socket;

    /**
     * Abstract representation of a server socket of some kind. Maybe socket
     * isn't strictly accurate. This could be a tcp/ip socket, a named
     * filesystem based socket, etc.
     *
     *@ingroup Serving
     */
    class ServerSocket
    {
    public:
        ServerSocket();
        virtual ~ServerSocket();

        /**
         * Accept a new connection, returning a connected Bu::Socket object.
         */
        virtual Bu::Socket *accept( int nTimeoutSec=0, int nTimeoutUSec=0 )=0;

        /**
         * Provide the contained file descriptor. Return false if there is no
         * internal file descriptor as such. If the return value is true, then
         * rFdOut will be set to the file descriptor.
         */
        virtual bool getFd( int &rFdOut ) const=0;
    };
}

#endif