PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
sifrpc.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# (C)2001, Gustavo Scotti (gustavo@scotti.com)
7# (c) Marcus R. Brown (mrbrown@0xd6.org)
8# Licenced under Academic Free License version 2.0
9# Review ps2sdk README & LICENSE files for further details.
10*/
11
17#ifndef __SIFRPC_H__
18#define __SIFRPC_H__
19
20#include <sifcmd.h>
21
22/* Modes for bind() and call() */
24#define SIF_RPC_M_NOWAIT 0x01
26#define SIF_RPC_M_NOWBDC 0x02
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32typedef void *(*SifRpcFunc_t)(int fno, void *buffer, int length);
33typedef void (*SifRpcEndFunc_t)(void *end_param);
34
35#ifdef __cplusplus
36}
37#endif
38
39typedef struct t_SifRpcPktHeader
40{
41 struct t_SifCmdHeader sifcmd;
42 int rec_id;
43 void *pkt_addr;
44 int rpc_id;
46
47typedef struct t_SifRpcRendPkt
48{
49 struct t_SifCmdHeader sifcmd;
50 int rec_id; /* 04 */
51 void *pkt_addr; /* 05 */
52 int rpc_id; /* 06 */
53
54 struct t_SifRpcClientData *client; /* 7 */
55 u32 cid; /* 8 */
56 struct t_SifRpcServerData *server; /* 9 */
57 void *buff, /* 10 */
58 *cbuff; /* 11 */
60
62{
63 struct t_SifCmdHeader sifcmd;
64 int rec_id; /* 04 */
65 void *pkt_addr; /* 05 */
66 int rpc_id; /* 06 */
67
68 struct t_SifRpcReceiveData *receive; /* 07 */
69 void *src; /* 08 */
70 void *dest; /* 09 */
71 int size; /* 10 */
73
74typedef struct t_SifRpcBindPkt
75{
76 struct t_SifCmdHeader sifcmd;
77 int rec_id; /* 04 */
78 void *pkt_addr; /* 05 */
79 int rpc_id; /* 06 */
80 struct t_SifRpcClientData *client; /* 07 */
81 int sid; /* 08 */
83
84typedef struct t_SifRpcCallPkt
85{
86 struct t_SifCmdHeader sifcmd;
87 int rec_id; /* 04 */
88 void *pkt_addr; /* 05 */
89 int rpc_id; /* 06 */
90 struct t_SifRpcClientData *client; /* 07 */
91 int rpc_number; /* 08 */
92 int send_size; /* 09 */
93 void *receive; /* 10 */
94 int recv_size; /* 11 */
95 int rmode; /* 12 */
96 struct t_SifRpcServerData *server; /* 13 */
98
99typedef struct t_SifRpcServerData
100{
101 int sid; /* 04 00 */
102
103 SifRpcFunc_t func; /* 05 01 */
104 void *buff; /* 06 02 */
105 int size; /* 07 03 */
106
107 SifRpcFunc_t cfunc; /* 08 04 */
108 void *cbuff; /* 09 05 */
109 int size2; /* 10 06 */
110
111 struct t_SifRpcClientData *client; /* 11 07 */
112 void *pkt_addr; /* 12 08 */
113 int rpc_number; /* 13 09 */
114
115 void *receive; /* 14 10 */
116 int rsize; /* 15 11 */
117 int rmode; /* 16 12 */
118 int rid; /* 17 13 */
119
120 struct t_SifRpcServerData *link; /* 18 14 */
121 struct t_SifRpcServerData *next; /* 19 15 */
122 struct t_SifRpcDataQueue *base; /* 20 16 */
124
125
126typedef struct t_SifRpcHeader
127{
128 void *pkt_addr; /* 04 00 */
129 u32 rpc_id; /* 05 01 */
130 int sema_id; /* 06 02 */
131 u32 mode; /* 07 03 */
133
134
135typedef struct t_SifRpcClientData
136{
137 struct t_SifRpcHeader hdr;
138 u32 command; /* 04 08 */
139 void *buff, /* 05 09 */
140 *cbuff; /* 06 10 */
141 SifRpcEndFunc_t end_function; /* 07 11 */
142 void *end_param; /* 08 12*/
143 struct t_SifRpcServerData *server; /* 09 13 */
145
147{
148 struct t_SifRpcHeader hdr;
149 void *src, /* 04 */
150 *dest; /* 05 */
151 int size; /* 06 */
153
154typedef struct t_SifRpcDataQueue
155{
156 int thread_id, /* 00 */
157 active; /* 01 */
158 struct t_SifRpcServerData *link, /* 02 */
159 *start, /* 03 */
160 *end; /* 04 */
161 struct t_SifRpcDataQueue *next; /* 05 */
163
164#ifdef __cplusplus
165extern "C" {
166#endif
167
168void SifInitRpc(int mode);
169void SifExitRpc(void);
170
171/* SIF RPC client API */
172int SifBindRpc(SifRpcClientData_t *client, int rpc_number, int mode);
173int SifCallRpc(SifRpcClientData_t *client, int rpc_number, int mode,
174 void *send, int ssize, void *receive, int rsize,
175 SifRpcEndFunc_t end_function, void *end_param);
176int SifRpcGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest,
177 int size, int mode);
178
179int SifCheckStatRpc(SifRpcClientData_t *cd);
180
181/* SIF RPC server API */
183SifSetRpcQueue(SifRpcDataQueue_t *q, int thread_id);
185SifRemoveRpcQueue(SifRpcDataQueue_t *qd);
186
188SifRegisterRpc(SifRpcServerData_t *srv,
189 int sid, SifRpcFunc_t func, void *buff, SifRpcFunc_t cfunc,
190 void *cbuff, SifRpcDataQueue_t *qd);
192SifRemoveRpc(SifRpcServerData_t *sd, SifRpcDataQueue_t *queue);
193
195SifGetNextRequest(SifRpcDataQueue_t *qd);
196
197void SifExecRequest(SifRpcServerData_t *srv);
198void SifRpcLoop(SifRpcDataQueue_t *q);
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif /* __SIFRPC_H__ */