1/*
2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef PACKAGE_LINK_SYMLINK_H
6#define PACKAGE_LINK_SYMLINK_H
7
8
9#include "Node.h"
10
11
12class Package;
13class PackageLinksListener;
14
15
16class PackageLinkSymlink : public Node {
17public:
18			enum Type {
19				TYPE_INSTALLATION_LOCATION,
20				TYPE_SETTINGS,
21
22				TYPE_ENUM_COUNT
23			};
24
25public:
26								PackageLinkSymlink(Package* package,
27									Type type);
28	virtual						~PackageLinkSymlink();
29
30			void				Update(Package* package,
31									PackageLinksListener* listener);
32
33	virtual	mode_t				Mode() const;
34	virtual	timespec			ModifiedTime() const;
35	virtual	off_t				FileSize() const;
36
37	virtual	status_t			Read(off_t offset, void* buffer,
38									size_t* bufferSize);
39	virtual	status_t			Read(io_request* request);
40
41	virtual	status_t			ReadSymlink(void* buffer, size_t* bufferSize);
42
43	virtual	status_t			OpenAttributeDirectory(
44									AttributeDirectoryCookie*& _cookie);
45	virtual	status_t			OpenAttribute(const StringKey& name,
46									int openMode, AttributeCookie*& _cookie);
47
48private:
49			struct OldAttributes;
50
51private:
52			timespec			fModifiedTime;
53			BReference<Package>	fPackage;
54			const char*			fLinkPath;
55			Type				fType;
56};
57
58
59#endif	// PACKAGE_LINK_SYMLINK_H
60