xref: /haiku/headers/private/media/DataExchange.h (revision f4925104822c0990c8fc7b99144512294827b3cf)
1 /*
2  * Copyright 2002, Marcus Overhagen. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _DATA_EXCHANGE_H
7 #define _DATA_EXCHANGE_H
8 
9 #include <MediaDefs.h>
10 #include <MediaNode.h>
11 #include <MediaAddOn.h>
12 #include <Entry.h>
13 
14 namespace BPrivate {
15 namespace media {
16 namespace dataexchange {
17 
18 struct reply_data;
19 struct request_data;
20 
21 // BMessage based data exchange with the media_server
22 status_t SendToServer(BMessage *msg);
23 status_t QueryServer(BMessage *request, BMessage *reply);
24 
25 // BMessage based data exchange with the media_addon_server
26 status_t SendToAddonServer(BMessage *msg);
27 
28 // Raw data based data exchange with the media_server
29 status_t SendToServer(int32 msgcode, void *msg, int size);
30 status_t QueryServer(int32 msgcode, const request_data *request, int requestsize, reply_data *reply, int replysize);
31 
32 // Raw data based data exchange with the media_addon_server
33 status_t SendToAddonServer(int32 msgcode, void *msg, int size);
34 status_t QueryAddonServer(int32 msgcode, const request_data *request, int requestsize, reply_data *reply, int replysize);
35 
36 // Raw data based data exchange with the media_server
37 status_t SendToPort(port_id sendport, int32 msgcode, void *msg, int size);
38 status_t QueryPort(port_id requestport, int32 msgcode, const request_data *request, int requestsize, reply_data *reply, int replysize);
39 
40 // The base struct used for all raw requests
41 struct request_data
42 {
43 	port_id reply_port;
44 
45 	void SendReply(reply_data *reply, int replysize) const;
46 };
47 
48 // The base struct used for all raw replys
49 struct reply_data
50 {
51 	status_t result;
52 };
53 
54 
55 }; // dataexchange
56 }; // media
57 }; // BPrivate
58 
59 using namespace BPrivate::media::dataexchange;
60 
61 enum {
62 
63 	// BMediaRoster notification service
64 	MEDIA_SERVER_REQUEST_NOTIFICATIONS = 1000,
65 	MEDIA_SERVER_CANCEL_NOTIFICATIONS,
66 	MEDIA_SERVER_SEND_NOTIFICATIONS
67 
68 };
69 
70 struct request_addonserver_instantiate_dormant_node : public request_data
71 {
72 	dormant_node_info info;
73 };
74 
75 struct reply_addonserver_instantiate_dormant_node : public reply_data
76 {
77 	media_node node;
78 };
79 
80 
81 #endif // _DATA_EXCHANGE_H
82