Subversion Repositories HelenOS

Rev

Rev 4731 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4731 Rev 4756
Line 41... Line 41...
41
 
41
 
42
#include <ipc/ipc.h>
42
#include <ipc/ipc.h>
43
#include <ipc/services.h>
43
#include <ipc/services.h>
44
 
44
 
45
/** Converts the data length between different types.
45
/** Converts the data length between different types.
46
 *  @param type_from The source type. Input parameter.
46
 *  @param[in] type_from The source type.
47
 *  @param type_to The destination type. Input parameter.
47
 *  @param[in] type_to The destination type.
48
 *  @param count The number units of the source type size. Input parameter.
48
 *  @param[in] count The number units of the source type size.
49
 */
49
 */
50
#define CONVERT_SIZE( type_from, type_to, count )   (( sizeof( type_from ) / sizeof( type_to )) * ( count ))
50
#define CONVERT_SIZE( type_from, type_to, count )   (( sizeof( type_from ) / sizeof( type_to )) * ( count ))
51
 
51
 
52
/** Registers the module service at the name server.
52
/** Registers the module service at the name server.
53
 *  @param me The module service. Input parameter.
53
 *  @param[in] me The module service.
54
 *  @param phonehash The created phone hash. Output parameter.
54
 *  @param[out] phonehash The created phone hash.
55
 */
55
 */
56
#define REGISTER_ME( me, phonehash )    ipc_connect_to_me( PHONE_NS, ( me ), 0, 0, ( phonehash ))
56
#define REGISTER_ME( me, phonehash )    ipc_connect_to_me( PHONE_NS, ( me ), 0, 0, ( phonehash ))
57
 
57
 
58
/** Connect to the needed module function type definition.
58
/** Connect to the needed module function type definition.
59
 *  @param need The needed module service. Input parameter.
59
 *  @param[in] need The needed module service.
60
 *  @returns The phone of the needed service.
60
 *  @returns The phone of the needed service.
61
 */
61
 */
62
typedef int connect_module_t( services_t need );
62
typedef int connect_module_t( services_t need );
63
 
63
 
64
/** Connects to the needed module.
64
/** Connects to the needed module.
65
 *  @param need The needed module service. Input parameter.
65
 *  @param[in] need The needed module service.
66
 *  @returns The phone of the needed service.
66
 *  @returns The phone of the needed service.
67
 */
67
 */
68
int connect_to_service( services_t need );
68
int connect_to_service( services_t need );
69
 
69
 
70
/** Creates bidirectional connection with the needed module service and registers the message receiver.
70
/** Creates bidirectional connection with the needed module service and registers the message receiver.
71
 *  @param need The needed module service. Input parameter.
71
 *  @param[in] need The needed module service.
72
 *  @param arg1 The first parameter. Input parameter.
72
 *  @param[in] arg1 The first parameter.
73
 *  @param arg2 The second parameter. Input parameter.
73
 *  @param[in] arg2 The second parameter.
74
 *  @param arg3 The third parameter. Input parameter.
74
 *  @param[in] arg3 The third parameter.
75
 *  @param client_receiver The message receiver. Input parameter.
75
 *  @param[in] client_receiver The message receiver.
76
 *  @returns The phone of the needed service.
76
 *  @returns The phone of the needed service.
77
 *  @returns Other error codes as defined for the ipc_connect_to_me() function.
77
 *  @returns Other error codes as defined for the ipc_connect_to_me() function.
78
 */
78
 */
79
int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver );
79
int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver );
80
 
80
 
81
/** Answers the call.
81
/** Answers the call.
82
 *  @param callid The call identifier. Input parameter.
82
 *  @param[in] callid The call identifier.
83
 *  @param result The message processing result. Input parameter.
83
 *  @param[in] result The message processing result.
84
 *  @param answer The message processing answer. Input parameter.
84
 *  @param[in] answer The message processing answer.
85
 *  @param answer_count The number of answer parameters. Input parameter.
85
 *  @param[in] answer_count The number of answer parameters.
86
 */
86
 */
87
void    answer_call( ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count );
87
void    answer_call( ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count );
88
 
88
 
89
/** Refreshes answer structure and parameters count.
89
/** Refreshes answer structure and parameters count.
90
 *  Erases all attributes.
90
 *  Erases all attributes.
91
 *  @param answer The message processing answer structure. Input/output parameter.
91
 *  @param[in,out] answer The message processing answer structure.
92
 *  @param answer_count The number of answer parameters. Input/output parameter.
92
 *  @param[in,out] answer_count The number of answer parameters.
93
 */
93
 */
94
void    refresh_answer( ipc_call_t * answer, int * answer_count );
94
void    refresh_answer( ipc_call_t * answer, int * answer_count );
95
 
95
 
96
/** Receives data from the other party.
96
/** Receives data from the other party.
97
 *  The received data buffer is allocated and returned.
97
 *  The received data buffer is allocated and returned.
98
 *  @param data The data buffer to be filled. Output parameter.
98
 *  @param[out] data The data buffer to be filled.
99
 *  @param length The buffer length. Output parameter.
99
 *  @param[out] length The buffer length.
100
 *  @returns EOK on success.
100
 *  @returns EOK on success.
101
 *  @returns EBADMEM if the data or the length parameter is NULL.
101
 *  @returns EBADMEM if the data or the length parameter is NULL.
102
 *  @returns EINVAL if the client does not send data.
102
 *  @returns EINVAL if the client does not send data.
103
 *  @returns ENOMEM if there is not enough memory left.
103
 *  @returns ENOMEM if there is not enough memory left.
104
 *  @returns Other error codes as defined for the ipc_data_write_finalize() function.
104
 *  @returns Other error codes as defined for the ipc_data_write_finalize() function.
105
 */
105
 */
106
int data_receive( void ** data, size_t * length );
106
int data_receive( void ** data, size_t * length );
107
 
107
 
108
/** Replies the data to the other party.
108
/** Replies the data to the other party.
109
 *  @param data The data buffer to be sent. Input parameter.
109
 *  @param[in] data The data buffer to be sent.
110
 *  @param data_length The buffer length. Input parameter.
110
 *  @param[in] data_length The buffer length.
111
 *  @returns EOK on success.
111
 *  @returns EOK on success.
112
 *  @returns EINVAL if the client does not expect the data.
112
 *  @returns EINVAL if the client does not expect the data.
113
 *  @returns EOVERFLOW if the client does not expect all the data. Only partial data are transfered.
113
 *  @returns EOVERFLOW if the client does not expect all the data. Only partial data are transfered.
114
 *  @returns Other error codes as defined for the ipc_data_read_finalize() function.
114
 *  @returns Other error codes as defined for the ipc_data_read_finalize() function.
115
 */
115
 */