source: mainline/kernel/generic/include/ipc/sysipc_ops.h@ 716185d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 716185d was 716185d, checked in by Jakub Jermar <jakub@…>, 13 years ago

Call request_process() callback for incoming calls during IPC cleanup.

  • Property mode set to 100644
File size: 4.9 KB
Line 
1/*
2 * Copyright (c) 2012 Jakub Jermar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup genericipc
30 * @{
31 */
32/** @file
33 */
34
35#ifndef KERN_SYSIPC_OPS_H_
36#define KERN_SYSIPC_OPS_H_
37
38#include <ipc/ipc.h>
39
40/**
41 * This header declares the per-method IPC callbacks. Using these callbacks,
42 * each IPC method (but system methods in particular), can define actions that
43 * will be called at specific moments in the call life-cycle.
44 *
45 * Normally, the kernel will attempt to invoke the following callbacks in the
46 * following order on each call:
47 *
48 * request_preprocess()
49 * request_process()
50 * answer_preprocess()
51 * answer_process()
52 *
53 * This callback invocation sequence is a natural order of processing. Note,
54 * however, that due to various special circumstances, callbacks may be called
55 * also in a different than natural order of processing. This means that some
56 * callbacks may be skipped and some others may be called instead.
57 *
58 * The additional callbacks that may be called are as follows:
59 *
60 * request_forget()
61 * answer_cleanup()
62 *
63 * There are several notable scenarios in which some callbacks of the natural
64 * order of processing will be skipped.
65 *
66 * The request_process(), answer_preprocess() and answer_process() callbacks
67 * will be skipped if the call cannot be delivered to the callee. This may
68 * happen when e.g. the request_preprocess() callback fails or the connection
69 * to the callee is not functional. The next callback that will be invoked on
70 * the call is request_forget().
71 *
72 * The comments for each callback type describe the specifics of each callback
73 * such as the context in which it is invoked and various constraints.
74 */
75
76typedef struct {
77 /**
78 * This callback is called from request_preprocess().
79 *
80 * Context: caller
81 * Caller alive: guaranteed
82 * Races with: N/A
83 * Invoked on: all calls
84 */
85 int (* request_preprocess)(call_t *, phone_t *);
86
87 /**
88 * This callback is called when the IPC cleanup code wins the race to
89 * forget the call.
90 *
91 * Context: caller
92 * Caller alive: guaranteed
93 * Races with: request_process(), answer_cleanup(),
94 * _ipc_answer_free_call()
95 * Invoked on: all forgotten calls
96 */
97 void (* request_forget)(call_t *);
98
99 /**
100 * This callback is called from process_request().
101 *
102 * Context: callee
103 * Caller alive: no guarantee
104 * Races with: request_forget()
105 * Invoked on: all calls delivered to the callee
106 */
107 int (* request_process)(call_t *, answerbox_t *);
108
109 /**
110 * This callback is called when answer_preprocess() loses the race to
111 * answer the call.
112 *
113 * Context: callee
114 * Caller alive: no guarantee
115 * Races with: request_forget()
116 * Invoked on: all forgotten calls
117 */
118 void (* answer_cleanup)(call_t *, ipc_data_t *);
119
120 /**
121 * This callback is called when answer_preprocess() wins the race to
122 * answer the call.
123 *
124 * Context: callee
125 * Caller alive: guaranteed
126 * Races with: N/A
127 * Invoked on: all answered calls
128 */
129 int (* answer_preprocess)(call_t *, ipc_data_t *);
130
131 /**
132 * This callback is called from process_answer().
133 *
134 * Context: caller
135 * Caller alive: guaranteed
136 * Races with: N/A
137 * Invoked on: all answered calls
138 */
139 int (* answer_process)(call_t *);
140} sysipc_ops_t;
141
142extern sysipc_ops_t *sysipc_ops_get(sysarg_t);
143
144extern int null_request_preprocess(call_t *, phone_t *);
145extern void null_request_forget(call_t *);
146extern int null_request_process(call_t *, answerbox_t *);
147extern void null_answer_cleanup(call_t *, ipc_data_t *);
148extern int null_answer_preprocess(call_t *, ipc_data_t *);
149extern int null_answer_process(call_t *);
150
151#endif
152
153/** @}
154 */
Note: See TracBrowser for help on using the repository browser.