source: rtems/c/src/librpc/include/rpc/clnt.h @ 48bfd992

4.104.114.84.95
Last change on this file since 48bfd992 was 4721cf1, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/98 at 23:54:14

Patch from Emmanuel Raguet <raguet@…> to add remote debug server
and RPC support to RTEMS. Thanks. :) Email follows:

Hello,

For Xmas, here is the Remote Debugger on RTEMS !

Here are 2 patches for the Remote Debugger on RTEMS for pc386 from Linux
host :

  • one for RTEMS it self,
  • one for GDB-4.17.

1/ RTEMS patch
--------------

This patch adds 2 libraries :

  • a simplified SUN RPC library
  • the Remote Debugger library

The configuration command is the following :
../rtems4/configure --target=i386-rtemself --enable-rtemsbsp=pc386
--enable-rdbg

The SUN RPC library is built only if networking is set.
The RDBG library is built if networking and enable-rdbg are set.

The function used to initialize the debugger is :

rtems_rdbg_initialize ();

A special function has been created to force a task to be
in a "debug" state : enterRdbg().
The use of this function is not mandatory.

2/ GDB-4.17 patch
-----------------

This patch create a new RTEMS target for GDB-4.17.

The configuration command is the following :
./configure --enable-shared --target=i386RTEMS

To connect to a target, use :

target rtems [your_site_address]

Then, attach the target using : attach 1

And... Debug ;)

You can obtain the original GDB-4.17 on
ftp://ftp.debian.org/debian/dists/stable/main/source/devel/gdb_4.17.orig.tar.gz

This has been tested from a Debian 2.0.1 linux host.

  • Property mode set to 100644
File size: 8.6 KB
Line 
1#ifndef RPC_CLNT_H
2#define RPC_CLNT_H
3
4/* @(#)clnt.h   2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/
5/*
6 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
7 * unrestricted use provided that this legend is included on all tape
8 * media and as a part of the software program in whole or part.  Users
9 * may copy or modify Sun RPC without charge, but are not authorized
10 * to license or distribute it to anyone else except as part of a product or
11 * program developed by the user.
12 *
13 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
14 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
16 *
17 * Sun RPC is provided with no support and without any obligation on the
18 * part of Sun Microsystems, Inc. to assist in its use, correction,
19 * modification or enhancement.
20 *
21 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
22 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
23 * OR ANY PART THEREOF.
24 *
25 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
26 * or profits or other special, indirect and consequential damages, even if
27 * Sun has been advised of the possibility of such damages.
28 *
29 * Sun Microsystems, Inc.
30 * 2550 Garcia Avenue
31 * Mountain View, California  94043
32 */
33
34/*
35 * clnt.h - Client side remote procedure call interface.
36 *
37 * Copyright (C) 1984, Sun Microsystems, Inc.
38 */
39
40#ifndef _CLNT_
41#define _CLNT_
42
43/*
44 * Rpc calls return an enum clnt_stat.  This should be looked at more,
45 * since each implementation is required to live with this (implementation
46 * independent) list of errors.
47 */
48enum clnt_stat {
49        RPC_SUCCESS=0,                  /* call succeeded */
50        /*
51         * local errors
52         */
53        RPC_CANTENCODEARGS=1,           /* can't encode arguments */
54        RPC_CANTDECODERES=2,            /* can't decode results */
55        RPC_CANTSEND=3,                 /* failure in sending call */
56        RPC_CANTRECV=4,                 /* failure in receiving result */
57        RPC_TIMEDOUT=5,                 /* call timed out */
58        /*
59         * remote errors
60         */
61        RPC_VERSMISMATCH=6,             /* rpc versions not compatible */
62        RPC_AUTHERROR=7,                /* authentication error */
63        RPC_PROGUNAVAIL=8,              /* program not available */
64        RPC_PROGVERSMISMATCH=9,         /* program version mismatched */
65        RPC_PROCUNAVAIL=10,             /* procedure unavailable */
66        RPC_CANTDECODEARGS=11,          /* decode arguments error */
67        RPC_SYSTEMERROR=12,             /* generic "other problem" */
68
69        /*
70         * callrpc & clnt_create errors
71         */
72        RPC_UNKNOWNHOST=13,             /* unknown host name */
73        RPC_UNKNOWNPROTO=17,            /* unkown protocol */
74
75        /*
76         * _ create errors
77         */
78        RPC_PMAPFAILURE=14,             /* the pmapper failed in its call */
79        RPC_PROGNOTREGISTERED=15,       /* remote program is not registered */
80        /*
81         * unspecified error
82         */
83        RPC_FAILED=16
84};
85
86
87/*
88 * Error info.
89 */
90struct rpc_err {
91        enum clnt_stat re_status;
92        union {
93                int RE_errno;           /* realated system error */
94                enum auth_stat RE_why;  /* why the auth error occurred */
95                struct {
96                        u_long low;     /* lowest verion supported */
97                        u_long high;    /* highest verion supported */
98                } RE_vers;
99                struct {                /* maybe meaningful if RPC_FAILED */
100                        long s1;
101                        long s2;
102                } RE_lb;                /* life boot & debugging only */
103        } ru;
104#define re_errno        ru.RE_errno
105#define re_why          ru.RE_why
106#define re_vers         ru.RE_vers
107#define re_lb           ru.RE_lb
108};
109
110
111/*
112 * Client rpc handle.
113 * Created by individual implementations, see e.g. rpc_udp.c.
114 * Client is responsible for initializing auth, see e.g. auth_none.c.
115 */
116typedef struct {
117        AUTH    *cl_auth;                       /* authenticator */
118        struct clnt_ops {
119                enum clnt_stat  (*cl_call)();   /* call remote procedure */
120                void            (*cl_abort)();  /* abort a call */
121                void            (*cl_geterr)(); /* get specific error code */
122                bool_t          (*cl_freeres)(); /* frees results */
123                void            (*cl_destroy)();/* destroy this structure */
124                bool_t          (*cl_control)();/* the ioctl() of rpc */
125        } *cl_ops;
126        caddr_t                 cl_private;     /* private stuff */
127} CLIENT;
128
129
130/*
131 * client side rpc interface ops
132 *
133 * Parameter types are:
134 *
135 */
136
137/*
138 * enum clnt_stat
139 * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
140 *      CLIENT *rh;
141 *      u_long proc;
142 *      xdrproc_t xargs;
143 *      caddr_t argsp;
144 *      xdrproc_t xres;
145 *      caddr_t resp;
146 *      struct timeval timeout;
147 */
148#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)     \
149        ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
150#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)     \
151        ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
152
153/*
154 * void
155 * CLNT_ABORT(rh);
156 *      CLIENT *rh;
157 */
158#define CLNT_ABORT(rh)  ((*(rh)->cl_ops->cl_abort)(rh))
159#define clnt_abort(rh)  ((*(rh)->cl_ops->cl_abort)(rh))
160
161/*
162 * struct rpc_err
163 * CLNT_GETERR(rh);
164 *      CLIENT *rh;
165 */
166#define CLNT_GETERR(rh,errp)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))
167#define clnt_geterr(rh,errp)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))
168
169
170/*
171 * bool_t
172 * CLNT_FREERES(rh, xres, resp);
173 *      CLIENT *rh;
174 *      xdrproc_t xres;
175 *      caddr_t resp;
176 */
177#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
178#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
179
180/*
181 * bool_t
182 * CLNT_CONTROL(cl, request, info)
183 *      CLIENT *cl;
184 *      u_int request;
185 *      char *info;
186 */
187#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
188#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
189
190/*
191 * control operations that apply to both udp and tcp transports
192 */
193#define CLSET_TIMEOUT       1   /* set timeout (timeval) */
194#define CLGET_TIMEOUT       2   /* get timeout (timeval) */
195#define CLGET_SERVER_ADDR   3   /* get server's address (sockaddr) */
196/*
197 * udp only control operations
198 */
199#define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
200#define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
201
202/*
203 * void
204 * CLNT_DESTROY(rh);
205 *      CLIENT *rh;
206 */
207#define CLNT_DESTROY(rh)        ((*(rh)->cl_ops->cl_destroy)(rh))
208#define clnt_destroy(rh)        ((*(rh)->cl_ops->cl_destroy)(rh))
209
210
211/*
212 * RPCTEST is a test program which is accessable on every rpc
213 * transport/port.  It is used for testing, performance evaluation,
214 * and network administration.
215 */
216
217#define RPCTEST_PROGRAM         ((u_long)1)
218#define RPCTEST_VERSION         ((u_long)1)
219#define RPCTEST_NULL_PROC       ((u_long)2)
220#define RPCTEST_NULL_BATCH_PROC ((u_long)3)
221
222/*
223 * By convention, procedure 0 takes null arguments and returns them
224 */
225
226#define NULLPROC ((u_long)0)
227
228/*
229 * Below are the client handle creation routines for the various
230 * implementations of client side rpc.  They can return NULL if a
231 * creation failure occurs.
232 */
233
234/*
235 * Memory based rpc (for speed check and testing)
236 * CLIENT *
237 * clntraw_create(prog, vers)
238 *      u_long prog;
239 *      u_long vers;
240 */
241extern CLIENT *clntraw_create();
242
243
244/*
245 * Generic client creation routine. Supported protocols are "udp" and "tcp"
246 */
247extern CLIENT *
248clnt_create(/*host, prog, vers, prot*/); /*
249        char *host;     -- hostname
250        u_long prog;    -- program number
251        u_long vers;    -- version number
252        char *prot;     -- protocol
253*/
254
255
256
257
258/*
259 * TCP based rpc
260 * CLIENT *
261 * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
262 *      struct sockaddr_in *raddr;
263 *      u_long prog;
264 *      u_long version;
265 *      register int *sockp;
266 *      u_int sendsz;
267 *      u_int recvsz;
268 */
269extern CLIENT *clnttcp_create();
270
271/*
272 * UDP based rpc.
273 * CLIENT *
274 * clntudp_create(raddr, program, version, wait, sockp)
275 *      struct sockaddr_in *raddr;
276 *      u_long program;
277 *      u_long version;
278 *      struct timeval wait;
279 *      int *sockp;
280 *
281 * Same as above, but you specify max packet sizes.
282 * CLIENT *
283 * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
284 *      struct sockaddr_in *raddr;
285 *      u_long program;
286 *      u_long version;
287 *      struct timeval wait;
288 *      int *sockp;
289 *      u_int sendsz;
290 *      u_int recvsz;
291 */
292extern CLIENT *clntudp_create();
293extern CLIENT *clntudp_bufcreate();
294
295/*
296 * Print why creation failed
297 */
298void clnt_pcreateerror(/* char *msg */);        /* stderr */
299char *clnt_spcreateerror(/* char *msg */);      /* string */
300
301/*
302 * Like clnt_perror(), but is more verbose in its output
303 */
304void clnt_perrno(/* enum clnt_stat num */);     /* stderr */
305
306/*
307 * Print an English error message, given the client error code
308 */
309void clnt_perror(/* CLIENT *clnt, char *msg */);        /* stderr */
310char *clnt_sperror(/* CLIENT *clnt, char *msg */);      /* string */
311
312/*
313 * If a creation fails, the following allows the user to figure out why.
314 */
315struct rpc_createerr {
316        enum clnt_stat cf_stat;
317        struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
318};
319
320extern struct rpc_createerr rpc_createerr;
321
322
323
324/*
325 * Copy error message to buffer.
326 */
327char *clnt_sperrno(/* enum clnt_stat num */);   /* string */
328
329
330
331#define UDPMSGSIZE      8800    /* rpc imposed limit on udp msg size */
332#define RPCSMALLMSGSIZE 400     /* a more reasonable packet size */
333
334#endif /*!_CLNT_*/
335
336#endif /*  RPC_CLNT_H */
Note: See TracBrowser for help on using the repository browser.