NetworkSettingsAddOn.h revision 021ff1ca
1/*
2 * Copyright 2004-2015 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 */
6#ifndef _NETWORK_SETTINGS_ADD_ON_H
7#define _NETWORK_SETTINGS_ADD_ON_H
8
9
10#include <image.h>
11#include <ListItem.h>
12#include <Resources.h>
13#include <View.h>
14
15
16namespace BNetworkKit {
17
18
19enum BNetworkSettingsType {
20	B_NETWORK_SETTINGS_TYPE_INTERFACE = 'intf',
21	B_NETWORK_SETTINGS_TYPE_SERVICE = 'serv',
22	B_NETWORK_SETTINGS_TYPE_DIAL_UP = 'dial',
23	B_NETWORK_SETTINGS_TYPE_OTHER = 'othr'
24};
25
26class BNetworkProfile;
27
28
29class BNetworkSettingsItem {
30public:
31								BNetworkSettingsItem();
32	virtual						~BNetworkSettingsItem();
33
34	virtual	BNetworkSettingsType
35								Type() const = 0;
36	virtual BListItem*			ListItem() = 0;
37	virtual BView*				View() = 0;
38
39	virtual status_t			ProfileChanged(
40									const BNetworkProfile* newProfile);
41			const BNetworkProfile*
42								Profile() const;
43
44	virtual	status_t			Save() = 0;
45	virtual	status_t			Revert() = 0;
46
47private:
48			const BNetworkProfile*
49								fProfile;
50};
51
52
53class BNetworkSettingsInterfaceItem : public BNetworkSettingsItem {
54public:
55								BNetworkSettingsInterfaceItem(
56									const char* interface);
57
58	virtual	BNetworkSettingsType
59								Type() const;
60			const char*			Interface() const;
61
62private:
63			const char*			fInterface;
64};
65
66
67class BNetworkSettingsAddOn {
68public:
69								BNetworkSettingsAddOn(image_id image);
70	virtual						~BNetworkSettingsAddOn();
71
72	virtual	BNetworkSettingsInterfaceItem*
73								CreateNextInterfaceItem(uint32& cookie,
74									const char* interface);
75	virtual	BNetworkSettingsItem*
76								CreateNextItem(uint32& cookie);
77
78			image_id			Image();
79			BResources*			Resources();
80
81private:
82			image_id			fImage;
83			BResources*			fResources;
84};
85
86
87// Your add-on needs to export this hook in order to be picked up
88extern "C" BNetworkSettingsAddOn* instantiate_network_settings_add_on(
89	image_id image);
90
91
92}	// namespace BNetworkKit
93
94
95#endif // _NETWORK_SETTINGS_ADD_ON_H
96