[f0defd2] | 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 | typedef struct {
|
---|
[eb5560a] | 41 | /**
|
---|
| 42 | * This callback is called from request_preprocess().
|
---|
| 43 | *
|
---|
| 44 | * Context: caller
|
---|
| 45 | * Caller alive: guaranteed
|
---|
| 46 | * Races with: N/A
|
---|
| 47 | * Invoked on: all calls
|
---|
| 48 | */
|
---|
[f0defd2] | 49 | int (* request_preprocess)(call_t *, phone_t *);
|
---|
[eb5560a] | 50 |
|
---|
| 51 | /**
|
---|
| 52 | * This callback is called when the IPC cleanup code wins the race to
|
---|
| 53 | * forget the call.
|
---|
| 54 | *
|
---|
| 55 | * Context: caller
|
---|
| 56 | * Caller alive: guaranteed
|
---|
| 57 | * Races with: request_process(), answer_cleanup()
|
---|
| 58 | * Invoked on: all forgotten calls
|
---|
| 59 | */
|
---|
[b1e6269] | 60 | void (* request_forget)(call_t *);
|
---|
[eb5560a] | 61 |
|
---|
| 62 | /**
|
---|
| 63 | * This callback is called from process_request().
|
---|
| 64 | *
|
---|
| 65 | * Context: callee
|
---|
| 66 | * Caller alive: no guarantee
|
---|
| 67 | * Races with: request_forget()
|
---|
| 68 | * Invoked on: all calls
|
---|
| 69 | */
|
---|
[f0defd2] | 70 | int (* request_process)(call_t *, answerbox_t *);
|
---|
[eb5560a] | 71 |
|
---|
| 72 | /**
|
---|
| 73 | * This callback is called when answer_preprocess() loses the race to
|
---|
| 74 | * answer the call.
|
---|
| 75 | *
|
---|
| 76 | * Context: callee
|
---|
| 77 | * Caller alive: no guarantee
|
---|
| 78 | * Races with: request_forget()
|
---|
| 79 | * Invoked on: all forgotten calls
|
---|
| 80 | */
|
---|
[b1e6269] | 81 | void (* answer_cleanup)(call_t *, ipc_data_t *);
|
---|
[eb5560a] | 82 |
|
---|
| 83 | /**
|
---|
| 84 | * This callback is called when answer_preprocess() wins the race to
|
---|
| 85 | * answer the call.
|
---|
| 86 | *
|
---|
| 87 | * Context: callee
|
---|
| 88 | * Caller alive: guaranteed
|
---|
| 89 | * Races with: N/A
|
---|
| 90 | * Invoked on: all answered calls
|
---|
| 91 | */
|
---|
[f0defd2] | 92 | int (* answer_preprocess)(call_t *, ipc_data_t *);
|
---|
[eb5560a] | 93 |
|
---|
| 94 | /**
|
---|
| 95 | * This callback is called from process_answer().
|
---|
| 96 | *
|
---|
| 97 | * Context: caller
|
---|
| 98 | * Caller alive: guaranteed
|
---|
| 99 | * Races with: N/A
|
---|
| 100 | * Invoked on: all answered calls
|
---|
| 101 | */
|
---|
[f0defd2] | 102 | int (* answer_process)(call_t *);
|
---|
| 103 | } sysipc_ops_t;
|
---|
| 104 |
|
---|
| 105 | extern sysipc_ops_t *sysipc_ops_get(sysarg_t);
|
---|
| 106 |
|
---|
| 107 | extern int null_request_preprocess(call_t *, phone_t *);
|
---|
[b1e6269] | 108 | extern void null_request_forget(call_t *);
|
---|
[f0defd2] | 109 | extern int null_request_process(call_t *, answerbox_t *);
|
---|
[b1e6269] | 110 | extern void null_answer_cleanup(call_t *, ipc_data_t *);
|
---|
[f0defd2] | 111 | extern int null_answer_preprocess(call_t *, ipc_data_t *);
|
---|
| 112 | extern int null_answer_process(call_t *);
|
---|
| 113 |
|
---|
| 114 | #endif
|
---|
| 115 |
|
---|
| 116 | /** @}
|
---|
| 117 | */
|
---|