Subversion Repositories HelenOS

Rev

Rev 4307 | Rev 4577 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4307 Rev 4350
Line 29... Line 29...
29
/** @addtogroup net
29
/** @addtogroup net
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/** @file
33
/** @file
-
 
34
 *  Generic module skeleton implementation.
34
 */
35
 */
35
 
36
 
36
#include <async.h>
37
#include <async.h>
37
#include <stdio.h>
38
#include <stdio.h>
38
#include <task.h>
39
#include <task.h>
39
 
40
 
40
#include <ipc/ipc.h>
41
#include <ipc/ipc.h>
41
 
42
 
42
#include "err.h"
43
#include "err.h"
43
 
44
 
-
 
45
/** External message processing function.
-
 
46
 *  Should process the messages.
-
 
47
 *  The function has to be defined in each module.
-
 
48
 *  @param callid The message identifier. Input parameter.
-
 
49
 *  @param call The message parameters. Input parameter.
-
 
50
 *  @param answer The message answer parameters. Output parameter.
-
 
51
 *  @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
-
 
52
 *  @returns EOK on success.
-
 
53
 *  @returns ENOTSUP if the message is not known.
-
 
54
 *  @returns Other error codes as defined for each specific module message function.
-
 
55
 */
44
extern int  module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
56
extern int  module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
-
 
57
 
-
 
58
/** External function to print the module name.
-
 
59
 *  Should print the module name.
-
 
60
 *  The function has to be defined in each module.
-
 
61
 */
45
extern void module_print_name( void );
62
extern void module_print_name( void );
-
 
63
 
-
 
64
/** External module startup function.
-
 
65
 *  Should start and initialize the module and register the given client connection function.
-
 
66
 *  The function has to be defined in each module.
-
 
67
 *  @param client_connection The client connection functio to be registered. Input parameter.
-
 
68
 */
46
extern int  module_start( async_client_conn_t client_connection );
69
extern int  module_start( async_client_conn_t client_connection );
47
 
70
 
-
 
71
/** Default thread for new connections.
-
 
72
 *  @param iid The initial message identifier. Input parameter.
-
 
73
 *  @param icall The initial message call structure. Input parameter.
-
 
74
 */
48
void    client_connection( ipc_callid_t iid, ipc_call_t * icall );
75
void    client_connection( ipc_callid_t iid, ipc_call_t * icall );
49
int main( int argc, char * argv[] );
-
 
50
 
76
 
-
 
77
/** Starts the module.
-
 
78
 *  @param argc The count of the command line arguments. Ignored parameter.
-
 
79
 *  @param argv The command line parameters. Ignored parameter.
51
/** Default thread for new connections.
80
 *  @returns EOK on success.
-
 
81
 *  @returns Other error codes as defined for each specific module start function.
52
 */
82
 */
-
 
83
int main( int argc, char * argv[] );
-
 
84
 
53
void client_connection( ipc_callid_t iid, ipc_call_t * icall ){
85
void client_connection( ipc_callid_t iid, ipc_call_t * icall ){
54
    ipc_callid_t    callid;
86
    ipc_callid_t    callid;
55
    ipc_call_t  call;
87
    ipc_call_t  call;
56
    ipc_call_t  answer;
88
    ipc_call_t  answer;
57
    int     count;
89
    int     count;
Line 93... Line 125...
93
                    continue;
125
                    continue;
94
        }
126
        }
95
    }
127
    }
96
}
128
}
97
 
129
 
98
/** Starts the module.
-
 
99
 *  Parameters are ignored.
-
 
100
 */
-
 
101
int main( int argc, char * argv[] ){
130
int main( int argc, char * argv[] ){
102
    ERROR_DECLARE;
131
    ERROR_DECLARE;
103
 
132
 
104
    printf("Task %d - ", task_get_id());
133
    printf("Task %d - ", task_get_id());
105
    module_print_name();
134
    module_print_name();