1 /* xdr_ptrace.c  - xdr routines for remote ptrace calls */
2 
3 /*  Copyright 1984, 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1998
4     Free Software Foundation, Inc.
5 
6     This code was donated by Wind River Systems, Inc. */
7 
8 /*
9 modification history
10 --------------------
11 01b,25may91,maf  now uses counted bytes struct to transfer registers.
12 		 removed xdr_regs_ptr (), xdr_fp_status_ptr (), and
13 		   xdr_fpa_regs_ptr ().
14 01a,05jun90,llk  extracted from xdr_ptrace.h, version 01c.
15 */
16 
17 #include "defs.h"
18 #include "vxWorks.h"
19 #include <rpc/rpc.h>
20 #include "xdr_ptrace.h"
21 
22 #define MAX_LEN 32000
23 
24 /********************************************************************
25 *
26 * xdr_c_bytes -
27 *
28 * xdr routine for counted bytes
29 *
30 */
31 bool_t xdr_c_bytes(xdrs,objp)
32     XDR *xdrs;
33     C_bytes *objp;
34     {
35     return(xdr_bytes(xdrs, &objp->bytes, (u_int *) &objp->len, MAX_LEN));
36     } /* xdr_c_bytes */
37 
38 /********************************************************************
39 *
40 * xdr_c_bytes_ptr -
41 *
42 * xdr routine for counted bytes branch of ptrace_info
43 *
44 */
45 
46 LOCAL bool_t xdr_c_bytes_ptr(xdrs,objp)
47     XDR *xdrs;
48     C_bytes **objp;
49     {
50     return(xdr_pointer(xdrs, (char **) objp, sizeof(C_bytes), xdr_c_bytes));
51     } /* xdr_c_bytes_ptr */
52 
53 /********************************************************************
54 *
55 * xdr_ptrace_info -
56 *
57 * xdr routine for discriminated union ptrace_info
58 *
59 */
60 
61 bool_t xdr_ptrace_info(xdrs,objp)
62     XDR *xdrs;
63     Ptrace_info *objp;
64     {
65     static struct xdr_discrim choices[] =
66 	{
67 	    { (int) DATA, xdr_c_bytes_ptr },
68 	    { __dontcare__, NULL }
69 	};
70 
71     return(xdr_union(xdrs, (enum_t *) &objp->ttype,
72 	(char *) &objp->more_data, choices, xdr_void));
73     } /* xdr_ptrace_info */
74 
75 /********************************************************************
76 *
77 * xdr_rptrace -
78 *
79 * xdr routine for remote ptrace data into server
80 *
81 */
82 
83 bool_t xdr_rptrace(xdrs,objp)
84     XDR *xdrs;
85     Rptrace *objp;
86     {
87     if (! xdr_int(xdrs, &objp->pid))
88 	return(FALSE);
89     if (! xdr_int(xdrs, &objp->data))
90 	return(FALSE);
91     if (! xdr_int(xdrs, &objp->addr))
92 	return(FALSE);
93     if (! xdr_ptrace_info(xdrs, &objp->info))
94 	return(FALSE);
95 
96     return(TRUE);
97     } /* xdr_rptrace */
98 
99 /********************************************************************
100 *
101 * xdr_ptrace_return -
102 *
103 * xdr routine for remote ptrace data returned by server
104 *
105 */
106 
107 bool_t xdr_ptrace_return(xdrs, objp)
108     XDR *xdrs;
109     Ptrace_return *objp;
110     {
111     if (! xdr_int(xdrs, &objp->status))
112 	return(FALSE);
113     if (! xdr_int(xdrs, &objp->errno_num))
114 	return(FALSE);
115     if (! xdr_ptrace_info(xdrs, &objp->info))
116 	return(FALSE);
117 
118     return(TRUE);
119     } /* xdr_ptrace_return */
120