blob: 4eacadd5adfe7fc852caaeb3274d2994c43a7204 [file] [log] [blame]
Oleg Sheikin641f7e52005-11-22 18:04:10 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19
20#ifndef __RFB_LISTCONNINFO_INCLUDED__
21#define __RFB_LISTCONNINFO_INCLUDED__
22
23namespace rfb {
24
25 struct ListConnInfo {
26 ListConnInfo() {
27 Clear();
28 };
29
30 void Clear() {
31 conn.clear();
32 IP_address.clear();
33 time_conn.clear();
34 status.clear();
35 };
36
37 bool Empty() {
38 return conn.empty();
39 }
40
41 void iBegin() {
42 ci = conn.begin();
43 Ii = IP_address.begin();
44 ti = time_conn.begin();
45 si = status.begin();
46 }
47
48 bool iEnd() {
49 return ci == conn.end();
50 }
51
52 void iNext() {
53 ci++;
54 Ii++;
55 ti++;
56 si++;
57 }
58
59 void addInfo(DWORD Conn, char* IP, char* Time, int Status) {
60 conn.push_front(Conn);
61 IP_address.push_front(IP);
62 time_conn.push_front(Time);
63 status.push_front(Status);
64 }
65
66 void iGetCharInfo(char* buf[3]) {
67 if (Empty())
68 return;
69 buf[0] = (*Ii);
70 buf[1] = (*ti);
71 switch (*si) {
72 case 0:
73 buf[2] = strDup("Full control");
74 break;
75 case 1:
76 buf[2] = strDup("View only");
77 break;
78 case 2:
79 buf[2] = strDup("Stop updating");
80 break;
81 default:
82 buf[2] = strDup("Unknown");
83 };
84 }
85
86 DWORD iGetConn() { return *ci;};
87
88 int iGetStatus() { return *si;};
89
90 std::list<DWORD> conn;
91 std::list<char*> IP_address;
92 std::list<char*> time_conn;
93 std::list<int> status;
94 std::list<DWORD>::iterator ci;
95 std::list<char*>::iterator Ii, ti;
96 std::list<int>::iterator si;
97
98 };
99
100}
101#endif
102