1 /*******************************************************************************
2 
3     Informational (i.e. non-destructive) interface to an ISelectClient.
4 
5     Copyright:
6         Copyright (c) 2009-2016 dunnhumby Germany GmbH.
7         All rights reserved.
8 
9     License:
10         Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
11         Alternatively, this file may be distributed under the terms of the Tango
12         3-Clause BSD License (see LICENSE_BSD.txt for details).
13 
14 *******************************************************************************/
15 
16 module ocean.io.select.client.model.ISelectClientInfo;
17 
18 
19 
20 
21 import ocean.meta.types.Qualifiers;
22 
23 import ocean.io.model.IConduit: ISelectable;
24 
25 import ocean.sys.Epoll;
26 
27 
28 
29 public interface ISelectClientInfo
30 {
31     /**************************************************************************
32 
33         Returns:
34             I/O device instance (file descriptor under linux)
35 
36      **************************************************************************/
37 
38     ISelectable.Handle fileHandle ( );
39 
40 
41     /**************************************************************************
42 
43         Returns:
44             bitfield of events which the client should be registered for
45 
46      **************************************************************************/
47 
48     Epoll.Event events ( );
49 
50 
51     /***************************************************************************
52 
53         Returns:
54             I/O timeout value of client in microseconds. A value of 0 means that
55             no timeout is set for this client
56 
57     ***************************************************************************/
58 
59     ulong timeout_value_us ( );
60 
61 
62     /***************************************************************************
63 
64         Returns:
65             true if this client has timed out or false otherwise
66 
67     ***************************************************************************/
68 
69     bool timed_out ( );
70 
71 
72     /**************************************************************************
73 
74         Returns true if the client's file handle is registered with epoll for
75         the events specified with the client reference as attachment. Returns
76         false if the client's file handle is not registered with epoll or, when
77         multiple instances of the implementing class share the same file handle,
78         if it is registered with another instance.
79 
80         Note that the returned value can be true by mistake when epoll
81         unexpectedly unregistered the file descriptor as it happens when the
82         file descriptor is closed (e.g. on error). However, the returned value
83         cannot be true by mistake.
84 
85         Returns:
86             true if the client's file handle is registered with epoll for the
87             events specified with the client reference as attachment
88 
89      **************************************************************************/
90 
91     bool is_registered ( );
92 
93 
94     /**************************************************************************
95 
96         Returns an identifier string of this instance. Defaults to the name of
97         the class, but may be overridden if more detailed information is
98         required.
99 
100         Returns:
101              identifier string of this instance
102 
103      **************************************************************************/
104 
105     debug cstring id ( );
106 
107 
108     /***************************************************************************
109 
110         Returns a string describing this client, for use in debug messages.
111 
112         Returns:
113             string describing client
114 
115     ***************************************************************************/
116 
117     debug istring toString ( );
118 }