vfs: check userland buffers before reading them.
[haiku.git] / src / servers / print / ResourceManager.h
blob85e3b090d887800f4a74834f52487a69ab93c374
1 /*
2 * Copyright 2002-2006, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Pfeiffer
7 */
8 #ifndef RESOURCE_MANAGER_H
9 #define RESOURCE_MANAGER_H
11 #include "ObjectList.h"
13 #include <Locker.h>
14 #include <String.h>
16 #include "BeUtils.h"
18 class Resource : public Object {
19 private:
20 BString fTransport;
21 BString fTransportAddress;
22 BString fConnection;
23 sem_id fResourceAvailable;
25 public:
26 Resource(const char* transport, const char* address, const char* connection);
27 ~Resource();
29 bool NeedsLocking();
31 bool Equals(const char* transport, const char* address, const char* connection);
33 const BString& Transport() const { return fTransport; }
35 bool Lock();
36 void Unlock();
39 class ResourceManager {
40 private:
41 BObjectList<Resource> fResources;
43 Resource* Find(const char* transport, const char* address, const char* connection);
45 public:
46 ~ResourceManager();
48 Resource* Allocate(const char* transport, const char* address, const char* connection);
49 void Free(Resource* r);
52 #endif