btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / servers / net / Services.h
blobce8343691f39b17bebe1de31bc00d118c8149356
1 /*
2 * Copyright 2006-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
8 #ifndef SERVICES_H
9 #define SERVICES_H
12 #include <Handler.h>
13 #include <Locker.h>
15 #include <map>
16 #include <string>
17 #include <sys/select.h>
20 struct service;
21 struct service_connection;
22 typedef std::map<std::string, service*> ServiceNameMap;
23 typedef std::map<int, service_connection*> ServiceSocketMap;
26 class Services : public BHandler {
27 public:
28 Services(const BMessage& services);
29 virtual ~Services();
31 status_t InitCheck() const;
33 virtual void MessageReceived(BMessage* message);
35 private:
36 void _NotifyListener(bool quit = false);
37 void _UpdateMinMaxSocket(int socket);
38 status_t _StartService(struct service& service);
39 status_t _StopService(struct service* service);
40 status_t _ToService(const BMessage& message,
41 struct service*& service);
42 void _Update(const BMessage& services);
43 status_t _LaunchService(struct service& service,
44 int socket);
45 status_t _Listener();
46 static status_t _Listener(void* self);
48 private:
49 thread_id fListener;
50 BLocker fLock;
51 ServiceNameMap fNameMap;
52 ServiceSocketMap fSocketMap;
53 uint32 fUpdate;
54 int fReadPipe;
55 int fWritePipe;
56 int fMinSocket;
57 int fMaxSocket;
58 fd_set fSet;
62 const static uint32 kMsgUpdateServices = 'srvU';
65 #endif // SERVICES_H