RegistrarDefs.h revision 27bba9c3
1/*
2 * Copyright 2001-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Ingo Weinhold, bonefish@users.sf.net
7 */
8#ifndef REGISTRAR_DEFS_H
9#define REGISTRAR_DEFS_H
10
11
12//!	API classes - registrar interface.
13
14
15#include <Errors.h>
16#include <Roster.h>
17
18
19namespace BPrivate {
20
21
22// names
23extern const char* kRAppLooperPortName;
24
25
26#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
27#	define B_REGISTRAR_SIGNATURE "application/x-vnd.haiku-registrar"
28#	define B_REGISTRAR_PORT_NAME "system:roster"
29#else
30#	define B_REGISTRAR_SIGNATURE "application/x-vnd.test-registrar"
31#	define B_REGISTRAR_PORT_NAME "haiku-test:roster"
32#endif
33
34#define B_REGISTRAR_AUTHENTICATION_PORT_NAME	"auth"
35
36
37// message constants
38enum {
39	// replies
40	B_REG_SUCCESS							= 'rgsu',
41	B_REG_ERROR								= 'rger',
42	B_REG_RESULT							= 'rgrz',
43
44	// general requests
45	B_REG_GET_MIME_MESSENGER				= 'rgmm',
46	B_REG_GET_CLIPBOARD_MESSENGER			= 'rgcm',
47	B_REG_GET_DISK_DEVICE_MESSENGER			= 'rgdm',
48	B_REG_SHUT_DOWN							= 'rgsh',
49
50	// roster requests
51	B_REG_ADD_APP							= 'rgaa',
52	B_REG_COMPLETE_REGISTRATION				= 'rgcr',
53	B_REG_IS_APP_REGISTERED					= 'rgip',
54	B_REG_REMOVE_PRE_REGISTERED_APP			= 'rgrp',
55	B_REG_REMOVE_APP						= 'rgra',
56	B_REG_SET_THREAD_AND_TEAM				= 'rgtt',
57	B_REG_SET_SIGNATURE						= 'rgss',
58	B_REG_GET_APP_INFO						= 'rgai',
59	B_REG_GET_APP_LIST						= 'rgal',
60	B_REG_UPDATE_ACTIVE_APP					= 'rgua',
61	B_REG_BROADCAST							= 'rgbc',
62	B_REG_START_WATCHING					= 'rgwa',
63	B_REG_STOP_WATCHING						= 'rgsw',
64	B_REG_GET_RECENT_DOCUMENTS				= 'rggd',
65	B_REG_GET_RECENT_FOLDERS				= 'rggf',
66	B_REG_GET_RECENT_APPS					= 'rgga',
67	B_REG_ADD_TO_RECENT_DOCUMENTS			= 'rg2d',
68	B_REG_ADD_TO_RECENT_FOLDERS				= 'rg2f',
69	B_REG_ADD_TO_RECENT_APPS				= 'rg2a',
70	B_REG_CLEAR_RECENT_DOCUMENTS			= 'rgxd',
71	B_REG_CLEAR_RECENT_FOLDERS				= 'rgxf',
72	B_REG_CLEAR_RECENT_APPS					= 'rgxa',
73	B_REG_LOAD_RECENT_LISTS					= 'rglr',
74	B_REG_SAVE_RECENT_LISTS					= 'rgsr',
75
76	// MIME requests
77	B_REG_MIME_SET_PARAM					= 'rgsp',
78	B_REG_MIME_DELETE_PARAM					= 'rgdp',
79	B_REG_MIME_START_WATCHING				= 'rgwb',
80	B_REG_MIME_STOP_WATCHING				= 'rgwe',
81	B_REG_MIME_INSTALL						= 'rgin',
82	B_REG_MIME_DELETE						= 'rgdl',
83	B_REG_MIME_GET_INSTALLED_TYPES			= 'rgit',
84	B_REG_MIME_GET_INSTALLED_SUPERTYPES		= 'rgis',
85	B_REG_MIME_GET_SUPPORTING_APPS			= 'rgsa',
86	B_REG_MIME_GET_ASSOCIATED_TYPES			= 'rgat',
87	B_REG_MIME_SNIFF						= 'rgsn',
88	B_REG_MIME_UPDATE_MIME_INFO				= 'rgup',
89	B_REG_MIME_CREATE_APP_META_MIME			= 'rgca',
90	B_REG_MIME_UPDATE_THREAD_FINISHED		= 'rgtf',
91
92	// message runner requests
93	B_REG_REGISTER_MESSAGE_RUNNER			= 'rgrr',
94	B_REG_UNREGISTER_MESSAGE_RUNNER			= 'rgru',
95	B_REG_SET_MESSAGE_RUNNER_PARAMS			= 'rgrx',
96	B_REG_GET_MESSAGE_RUNNER_INFO			= 'rgri',
97
98	// internal registrar messages
99	B_REG_ROSTER_SANITY_EVENT				= 'rgir',
100	B_REG_SHUTDOWN_FINISHED					= 'rgsf',
101	B_REG_ROSTER_DEVICE_RESCAN				= 'rgrs',
102
103	// clipboard handler requests
104	B_REG_ADD_CLIPBOARD						= 'rgCa',
105	B_REG_GET_CLIPBOARD_COUNT				= 'rgCc',
106	B_REG_CLIPBOARD_START_WATCHING			= 'rgCw',
107	B_REG_CLIPBOARD_STOP_WATCHING			= 'rgCx',
108	B_REG_DOWNLOAD_CLIPBOARD				= 'rgCd',
109	B_REG_UPLOAD_CLIPBOARD					= 'rgCu',
110
111	// disk device request
112	B_REG_NEXT_DISK_DEVICE					= 'rgnx',
113	B_REG_GET_DISK_DEVICE					= 'rgdd',
114	B_REG_UPDATE_DISK_DEVICE				= 'rgud',
115	B_REG_DEVICE_START_WATCHING				= 'rgwd',
116	B_REG_DEVICE_STOP_WATCHING				= 'rgsd',
117
118	// debug_server notifications
119	B_REG_TEAM_DEBUGGER_ALERT				= 'rtda',
120
121	// authentication requests
122	B_REG_GET_PASSWD_DB						= 'rpdb',
123	B_REG_GET_GROUP_DB						= 'rgdb',
124	B_REG_GET_SHADOW_PASSWD_DB				= 'rsdb',
125	B_REG_GET_USER							= 'rgus',
126	B_REG_GET_GROUP							= 'rggr',
127	B_REG_GET_USER_GROUPS					= 'rgug',
128	B_REG_UPDATE_USER						= 'ruus',
129	B_REG_DELETE_USER						= 'rdus',
130	B_REG_UPDATE_GROUP						= 'rugr',
131	B_REG_DELETE_GROUP						= 'rdgr',
132
133	// package watching requests
134	B_REG_PACKAGE_START_WATCHING			= 'rgPw',
135	B_REG_PACKAGE_STOP_WATCHING				= 'rgPx',
136};
137
138// B_REG_MIME_SET_PARAM "which" constants
139enum {
140	B_REG_MIME_APP_HINT				= 'rgmh',
141	B_REG_MIME_ATTR_INFO			= 'rgma',
142	B_REG_MIME_DESCRIPTION			= 'rgmd',
143	B_REG_MIME_FILE_EXTENSIONS		= 'rgmf',
144	B_REG_MIME_ICON					= 'rgmi',
145	B_REG_MIME_ICON_FOR_TYPE		= 'rgm4',
146	B_REG_MIME_PREFERRED_APP		= 'rgmp',
147	B_REG_MIME_SNIFFER_RULE			= 'rgmr',
148	B_REG_MIME_SUPPORTED_TYPES		= 'rgms',
149};
150
151// B_REG_UPDATE_DISK_DEVICE "update_policy" constants
152enum {
153  B_REG_DEVICE_UPDATE_CHECK,
154  B_REG_DEVICE_UPDATE_CHANGED,
155  B_REG_DEVICE_UPDATE_DEVICE_CHANGED,
156};
157
158// type constants
159enum {
160	B_REG_APP_INFO_TYPE				= 'rgai',	// app_info
161};
162
163// error constants
164#define B_REGISTRAR_ERROR_BASE		(B_ERRORS_END + 1)
165
166enum {
167	B_REG_ALREADY_REGISTERED		= B_REGISTRAR_ERROR_BASE,
168		// A team tries to register a second time.
169	B_REG_APP_NOT_REGISTERED,
170	B_REG_APP_NOT_PRE_REGISTERED,
171};
172
173// misc constants
174enum {
175	B_REG_DEFAULT_APP_FLAGS			= B_MULTIPLE_LAUNCH,
176	B_REG_APP_LOOPER_PORT_CAPACITY	= 100,
177};
178
179// structs
180
181// a flat app_info -- to be found in B_REG_APP_INFO_TYPE message fields
182struct flat_app_info {
183	thread_id	thread;
184	team_id		team;
185	port_id		port;
186	uint32		flags;
187	dev_t		ref_device;
188	ino_t		ref_directory;
189	char		signature[B_MIME_TYPE_LENGTH];
190	char		ref_name[B_FILE_NAME_LENGTH + 1];
191} _PACKED;
192
193
194}	// namespace BPrivate
195
196
197#endif	// REGISTRAR_DEFS_H
198
199