aboutsummaryrefslogtreecommitdiffstats
path: root/src/ssl/unix_socket/unx_sock.h
blob: 58c7ada69e44a1f2fd6570d02b3d3f6c4a27b556 (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
58
59
60
61
62
/*
* Unix Socket
* (C) 2004-2006 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#ifndef BOTAN_TLS_SOCKET_UNIX_H__
#define BOTAN_TLS_SOCKET_UNIX_H__

#include <botan/socket.h>

namespace Botan {

/**
   FIXME: the current socket interface is totally unusable
     It has to handle (cleanly):
      - TCP, UDP, and SCTP, where UDP is only usable with DTLS and
        TCP/SCTP is only usable with TLS.
      - Alternate socket interfaces (ACE, Netxx, whatever) with
        minimal wrapping needed.
*/


/**
* Unix Socket Base Class
*/
class BOTAN_DLL Unix_Socket : public Socket
   {
   public:
      size_t read(byte[], size_t);
      void write(const byte[], size_t);

      std::string peer_id() const;

      void close();
      Unix_Socket(int, const std::string& = "");
      Unix_Socket(const std::string&, u16bit);
      ~Unix_Socket() { close(); }
   private:
      std::string peer;
      int sockfd;
   };

/**
* Unix Server Socket Base Class
*/
class BOTAN_DLL Unix_Server_Socket : public Server_Socket
   {
   public:
      Socket* accept();
      void close();

      Unix_Server_Socket(u16bit);
      ~Unix_Server_Socket() { close(); }
   private:
      int sockfd;
   };

}

#endif