OSDN Git Service

e2b31003a5eeea3ef1ef12dc936e4c75d5fceed8
[linuxjm/LDP_man-pages.git] / draft / man3 / xdr.3
1 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
2 .\"
3 .\" @(#)xdr.3n  2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
4 .\"
5 .\" 2007-12-30, mtk, Convert function prototypes to modern C syntax
6 .\"
7 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
8 .\"         all rights reserved.
9 .\" Translated Tue Jan  4 20:48:51 JST 2000
10 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
11 .\"
12 .TH XDR 3 2007-12-30 "" "Linux Programmer's Manual"
13 .\"O .SH NAME
14 .SH 名前
15 .\"O xdr \- library routines for external data representation
16 xdr \- 外部データ表現(XDR)のためのライブラリ・ルーティン
17 .\"O .SH SYNOPSIS AND DESCRIPTION
18 .SH 書式と説明
19 .LP
20 .\"O These routines allow C programmers to describe
21 .\"O arbitrary data structures in a machine-independent fashion.
22 .\"O Data for remote procedure calls are transmitted using these
23 .\"O routines.
24 これらのルーティンは C プログラマーがマシン非依存な形式で
25 任意のデータ構造体を記述することを可能にする。
26 リモート・プロシジャ・コールのためのデータはこれらのルーティンを
27 使用して送信される。
28
29 .\"O The prototypes below are declared in
30 .\"O .I <rpc/xdr.h>
31 .\"O and make use of the following types:
32 以下に示すプロトタイプ宣言は
33 .I <rpc/xdr.h>
34 で行われており、その中では次の型が使用される。
35 .in +4n
36 .nf
37
38 typedef int \fIbool_t\fP;
39
40 typedef bool_t (*\fIxdrproc_t\fP) (XDR *, void *,...);
41 .fi
42 .in
43 .LP
44 .\"O For the declaration of the
45 .\"O .I XDR
46 .\"O type, see
47 .\"O .IR <rpc/xdr.h> .
48 .I XDR
49 型の宣言については、
50 .I <rpc/xdr.h>
51 を参照。
52 .LP
53 .nf
54 .BI "bool_t xdr_array(XDR *" xdrs ", char **" arrp ", unsigned int *" sizep ,
55 .BI "                 unsigned int " maxsize ", unsigned int " elsize ,
56 .BI "                 xdrproc_t " elproc );
57 .fi
58 .IP
59 .\"O A filter primitive that translates between variable-length arrays
60 .\"O and their corresponding external representations.
61 .\"O The argument
62 .\"O .I arrp
63 .\"O is the address of the pointer to the array, while
64 .\"O .I sizep
65 .\"O is the address of the element count of the array;
66 .\"O this element count cannot exceed
67 .\"O .IR maxsize .
68 可変長の配列とそれに対応する外部表現とを変換する基本フィルター。
69 引き数
70 .I arrp
71 は配列へのポインターのアドレスであり、
72 .I sizep
73 は配列の要素数のアドレスである。
74 これらの要素数は
75 .I maxsize
76 を超えてはならない。
77 .\"O The argument
78 .\"O .I elsize
79 .\"O is the
80 .\"O .I sizeof
81 .\"O each of the array's elements, and
82 .\"O .I elproc
83 .\"O is an XDR filter that translates between
84 .\"O the array elements' C form, and their external
85 .\"O representation.
86 .\"O This routine returns one if it succeeds, zero otherwise.
87 引き数
88 .I elsize
89 は各配列の要素の
90 .I sizeof
91 であり、
92 .I elproc
93 は配列要素を C 形式からその外部表現に変換するための XDR フィルターである。
94 このルーティンは成功した場合には 1 を返す。
95 失敗した場合にはゼロを返す。
96 .LP
97 .nf
98 .BI "bool_t xdr_bool(XDR *" xdrs ", bool_t *" bp );
99 .fi
100 .IP
101 .\"O A filter primitive that translates between booleans (C
102 .\"O integers)
103 .\"O and their external representations.
104 .\"O When encoding data, this
105 .\"O filter produces values of either one or zero.
106 .\"O This routine returns one if it succeeds, zero otherwise.
107 真偽値(C の int)とその外部表現とを変換する基本フィルター。
108 データをエンコードする時、このフィルターは 1 また 0 の値を生成する。
109 このルーティンは成功した場合には 1 を返す。
110 失敗した場合には 0 を返す。
111 .LP
112 .nf
113 .BI "bool_t xdr_bytes(XDR *" xdrs ", char **" sp ", unsigned int *" sizep ,
114 .BI "                 unsigned int " maxsize );
115 .fi
116 .IP
117 .\"O A filter primitive that translates between counted byte
118 .\"O strings and their external representations.
119 .\"O The argument
120 .\"O .I sp
121 .\"O is the address of the string pointer.
122 .\"O The length of the
123 .\"O string is located at address
124 .\"O .IR sizep ;
125 .\"O strings cannot be longer than
126 .\"O .IR maxsize .
127 .\"O This routine returns one if it succeeds, zero otherwise.
128 ある長さのバイト文字列とその外部表現とを変換する基本フィルター。
129 引き数
130 .I sp
131 は文字列ポインターのアドレスである。文字列の長さは
132 .I sizep
133 のアドレスに置く。文字列は
134 .I maxsize
135 より長くてはいけない。
136 このルーティンは成功した場合には 1 を返す。
137 失敗した場合には 0 を返す。
138 .LP
139 .nf
140 .BI "bool_t xdr_char(XDR *" xdrs ", char *" cp );
141 .fi
142 .IP
143 .\"O A filter primitive that translates between C characters
144 .\"O and their external representations.
145 .\"O This routine returns one if it succeeds, zero otherwise.
146 .\"O Note: encoded characters are not packed, and occupy 4 bytes each.
147 .\"O For arrays of characters, it is worthwhile to
148 .\"O consider
149 .\"O .BR xdr_bytes (),
150 .\"O .BR xdr_opaque ()
151 .\"O or
152 .\"O .BR xdr_string ().
153 C の文字(char)とその外部表現との間を変換する基本フィルター。
154 このルーティンは成功した場合には 1 を返す。
155 失敗した場合には 0 を返す。
156 注意: エンコードされたデータは詰め込まれておらず、それぞれ 4 バイトを
157 占める。文字の配列の場合には
158 .BR xdr_bytes (),
159 .BR xdr_opaque (),
160 .BR xdr_string ()
161 などを考慮した方が良い。
162 .LP
163 .nf
164 .BI "void xdr_destroy(XDR *" xdrs );
165 .fi
166 .IP
167 .\"O A macro that invokes the destroy routine associated with the XDR stream,
168 .\"O .IR xdrs .
169 .\"O Destruction usually involves freeing private data structures
170 .\"O associated with the stream.
171 .\"O Using
172 .\"O .I xdrs
173 .\"O after invoking
174 .\"O .BR xdr_destroy ()
175 .\"O is undefined.
176 このマクロは XDR ストリーム
177 .I xdrs
178 に関連付けられた破壊ルーティンを呼び出す。
179 破壊には通常、ストリームに関連付けられた私的データ構造体の解放が含まれている。
180 .BR xdr_destroy ()
181 の呼び出しの後に
182 .I xdrs
183 を使用することは未定義である。
184 .LP
185 .nf
186 .BI "bool_t xdr_double(XDR *" xdrs ", double *" dp );
187 .fi
188 .IP
189 .\"O A filter primitive that translates between C
190 .\"O .I double
191 .\"O precision numbers and their external representations.
192 .\"O This routine returns one if it succeeds, zero otherwise.
193 C の
194 .I 倍精度数 (double)
195 とその外部表現との変換を行なう基本フィルター。
196 このルーティンは成功した場合は 1 を返す。
197 失敗した場合は 0 を返す。
198 .LP
199 .nf
200 .BI "bool_t xdr_enum(XDR *" xdrs ", enum_t *" ep );
201 .fi
202 .IP
203 .\"O A filter primitive that translates between C
204 .\"O .IR enum s
205 .\"O (actually integers) and their external representations.
206 .\"O This routine returns one if it succeeds, zero otherwise.
207 C の
208 .I enum
209 (実際には int)とその外部表現との変換を行なう基本フィルター。
210 このルーティンは成功した場合は 1 を返す。
211 失敗した場合は 0 を返す。
212 .LP
213 .nf
214 .BI "bool_t xdr_float(XDR *" xdrs ", float *" fp );
215 .fi
216 .IP
217 .\"O A filter primitive that translates between C
218 .\"O .IR float s
219 .\"O and their external representations.
220 .\"O This routine returns one if it succeeds, zero otherwise.
221 C の
222 .IR "浮動小数点数 (float)"
223 とその外部表現との変換を行なう基本フィルター。
224 このルーティンは成功した場合は 1 を返す。
225 失敗した場合は 0 を返す。
226 .LP
227 .nf
228 .BI "void xdr_free(xdrproc_t " proc ", char *" objp );
229 .fi
230 .IP
231 .\"O Generic freeing routine.
232 .\"O The first argument is the XDR routine for the object being freed.
233 .\"O The second argument is a pointer to the object itself.
234 .\"O Note: the pointer passed to this routine is
235 .\"O .I not
236 .\"O freed, but what it points to
237 .\"O .I is
238 .\"O freed (recursively).
239 汎用解放(free)ルーティン。最初の引き数はオブジェクトを解放するための
240 XDR ルーティンである。二番目の引き数はそのオブジェクト自身へのポインター
241 である。注意: このルーティンに渡されるポインターは
242 .I 解放されない
243 が、このポインターの指すデータは(再帰的に)
244 .IR 解放される 。
245 .LP
246 .nf
247 .BI "unsigned int xdr_getpos(XDR *" xdrs );
248 .fi
249 .IP
250 .\"O A macro that invokes the get-position routine
251 .\"O associated with the XDR stream,
252 .\"O .IR xdrs .
253 .\"O The routine returns an unsigned integer,
254 .\"O which indicates the position of the XDR byte stream.
255 .\"O A desirable feature of .SM XDR
256 .\"O streams is that simple arithmetic works with this number,
257 .\"O although the XDR stream instances need not guarantee this.
258 このマクロは XDR ストリーム
259 .I xdrs
260 に関連付けられた位置取得ルーティンを呼び出す。
261 このルーティンは XDR バイト・ストリームの位置を指示する符号無し整数を返す。
262 XDR ストリームの機能としてこの数値で単純な算術作業ができることが
263 期待されてるいる。しかしながら
264 XDR ストリームの実体はこれを保証する必要はない。
265 .LP
266 .nf
267 .BI "long *xdr_inline(XDR *" xdrs ", int " len );
268 .fi
269 .IP
270 .\"O A macro that invokes the inline routine associated with the XDR stream,
271 .\"O .IR xdrs .
272 .\"O The routine returns a pointer
273 .\"O to a contiguous piece of the stream's buffer;
274 .\"O .I len
275 .\"O is the byte length of the desired buffer.
276 .\"O Note: pointer is cast to
277 .\"O .IR "long *" .
278 このマクロは XDR ストリーム
279 .I xdrs
280 に関連付けられた内部(inline)ルーティンを呼び出す。
281 ルーティンはストリームのバッファーの連続する断片へのポインターを返す。
282 .I len
283 は要求するバッファーのバイト長である。
284 注意: ポインターは
285 .I "long *"
286 にキャストされる。
287 .IP
288 .\"O Warning:
289 .\"O .BR xdr_inline ()
290 .\"O may return NULL (0)
291 .\"O if it cannot allocate a contiguous piece of a buffer.
292 .\"O Therefore the behavior may vary among stream instances;
293 .\"O it exists for the sake of efficiency.
294 警告:
295 .BR xdr_inline ()
296 はバッファーの連続する断片を割り当てることができなかった場合には
297 NULL (0)を返すかもしれない。
298 どの場合もその動作はストリームの実体によって変化するかもしれない。
299 これは効率化のために存在している。
300 .LP
301 .nf
302 .BI "bool_t xdr_int(XDR *" xdrs ", int *" ip );
303 .fi
304 .IP
305 .\"O A filter primitive that translates between C integers
306 .\"O and their external representations.
307 .\"O This routine returns one if it succeeds, zero otherwise.
308 C の整数(int)とその外部表現とを変換するための基本フィルター。
309 このルーティンは成功した場合は 1 を返す。
310 失敗した場合はゼロを返す。
311 .LP
312 .nf
313 .BI "bool_t xdr_long(XDR *" xdrs ", long *" lp );
314 .fi
315 .IP
316 .\"O A filter primitive that translates between C
317 .\"O .I long
318 .\"O integers and their external representations.
319 .\"O This routine returns one if it succeeds, zero otherwise.
320 C の
321 .I long
322 整数とそのその外部表現とを変換するための基本フィルター。
323 このルーティンは成功した場合は 1 を返す。
324 失敗した場合はゼロを返す。
325 .LP
326 .nf
327 .BI "void xdrmem_create(XDR *" xdrs ", char *" addr ", unsigned int " size ,
328 .BI "                   enum xdr_op " op );
329 .fi
330 .IP
331 .\"O This routine initializes the XDR stream object pointed to by
332 .\"O .IR xdrs .
333 .\"O The stream's data is written to, or read from,
334 .\"O a chunk of memory at location
335 .\"O .I addr
336 .\"O whose length is no more than
337 .\"O .I size
338 .\"O bytes long.
339 .\"O The
340 .\"O .I op
341 .\"O determines the direction of the XDR stream (either
342 .\"O .BR XDR_ENCODE ,
343 .\"O .BR XDR_DECODE ,
344 .\"O or
345 .\"O .BR XDR_FREE ).
346 このルーティンは
347 .I xdrs
348 によって指されている XDR ストリーム・オブジェクトを初期化する。
349 ストリームのデータは
350 .I addr
351 位置にあるメモリーの塊から読み書きされる。
352 その長さはバイト単位で
353 .I size
354 超えてはいけない。
355 .I op
356 は XDR ストリームの変換方向を決定する
357 .RB ( XDR_ENCODE ,
358 .BR XDR_DECODE ,
359 .B XDR_FREE
360 のどれか)。
361 .LP
362 .nf
363 .BI "bool_t xdr_opaque(XDR *" xdrs ", char *" cp ", unsigned int " cnt );
364 .fi
365 .IP
366 .\"O A filter primitive that translates between fixed size opaque data
367 .\"O and its external representation.
368 .\"O The argument
369 .\"O .I cp
370 .\"O is the address of the opaque object, and
371 .\"O .I cnt
372 .\"O is its size in bytes.
373 .\"O This routine returns one if it succeeds, zero otherwise.
374 固定長の不明データとその外部表現との変換を行なう基本フィルター。
375 引き数
376 .I cp
377 は不明オブジェクトのアドレスであり
378 .I cnt
379 はそのバイト単位の大きさである。
380 このルーティンは成功した場合は 1 を返す。
381 失敗した場合はゼロを返す。
382 .LP
383 .nf
384 .BI "bool_t xdr_pointer(XDR *" xdrs ", char **" objpp ,
385 .BI "                   unsigned int " objsize ", xdrproc_t " xdrobj );
386 .fi
387 .IP
388 .\"O Like
389 .\"O .BR xdr_reference ()
390 .\"O except that it serializes NULL pointers, whereas
391 .\"O .BR xdr_reference ()
392 .\"O does not.
393 .\"O Thus,
394 .\"O .BR xdr_pointer ()
395 .\"O can represent
396 .\"O recursive data structures, such as binary trees or
397 .\"O linked lists.
398 .BR xdr_reference ()
399 と同様であるが、これが NULL ポインターを番号化するのに対して
400 .BR xdr_reference ()
401 はそうしない点が異なっている。これにより、
402 .BR xdr_pointer ()
403 は二分木や連結リストのような再帰的なデータ構造体を
404 表現できる。
405 .LP
406 .nf
407 .BI "void xdrrec_create(XDR *" xdrs ", unsigned int " sendsize ,
408 .BI "                   unsigned int " recvsize ", char *" handle ,
409 .BI "                   int (*" readit ") (char *, char *, int),"
410 .BI "                   int (*" writeit ") (char *, char *, int));"
411 .fi
412 .IP
413 .\"O This routine initializes the XDR stream object pointed to by
414 .\"O .IR xdrs .
415 .\"O The stream's data is written to a buffer of size
416 .\"O .IR sendsize ;
417 .\"O a value of zero indicates the system should use a suitable default.
418 .\"O The stream's data is read from a buffer of size
419 .\"O .IR recvsize ;
420 .\"O it too can be set to a suitable default by passing a zero value.
421 このルーティンは
422 .I xdrs
423 で指された XDR ストリーム・オブジェクトを初期化する。
424 ストリームのデータは大きさ
425 .I sendsize
426 のバッファへ書き込まれる。
427 .I sendsize
428 をゼロにすると、システムに適切なデフォルトを使用するように指示する。
429 ストリームのデータは大きさ
430 .I recvsize
431 のバッファから読み込まれる。これもゼロを渡すことで適切なデフォルトに
432 設定することができる。
433 .\"O When a stream's output buffer is full,
434 .\"O .I writeit
435 .\"O is called.
436 .\"O Similarly, when a stream's input buffer is empty,
437 .\"O .I readit
438 .\"O is called.
439 .\"O The behavior of these two routines is similar to
440 .\"O the system calls
441 .\"O .BR read (2)
442 .\"O and
443 .\"O .BR write (2),
444 .\"O except that
445 .\"O .I handle
446 .\"O is passed to the former routines as the first argument.
447 ストリームの出力バッファが一杯の場合は
448 .I writeit
449 が呼び出される。同様にストリーム入力バッファが空の場合には
450 .I readit
451 が呼び出される。これらの二つのルーティンの動作はシステムコールの
452 .BR read (2)
453
454 .BR write (2)
455 と似ているが、前者のルーティンは最初の引き数として
456 .I handle
457 が渡される点で異なっている。
458 .\"O Note: the XDR stream's
459 .\"O .I op
460 .\"O field must be set by the caller.
461 注意: XDR ストリームの
462 .I op
463 は呼び出し側で設定しなければならない。
464 .IP
465 .\"O Warning: this XDR stream implements an intermediate record stream.
466 .\"O Therefore there are additional bytes in the stream
467 .\"O to provide record boundary information.
468 警告: この XDR ストリームは中間レコード・ストリームを実装している。
469 レコード境界の情報を提供するためにストリームには余分なバイトが存在する。
470 .LP
471 .nf
472 .BI "bool_t xdrrec_endofrecord(XDR *" xdrs ", int " sendnow );
473 .fi
474 .IP
475 .\"O This routine can be invoked only on streams created by
476 .\"O .BR xdrrec_create ().
477 .\"O The data in the output buffer is marked as a completed record,
478 .\"O and the output buffer is optionally written out if
479 .\"O .I sendnow
480 .\"O is nonzero.
481 .\"O This routine returns one if it succeeds, zero otherwise.
482 このルーティンは
483 .BR xdrrec_create ()
484 によって作成されたストリームに対してのみ呼び出すことができる。
485 出力バッファのデータは完全なレコードとして印され、
486 .I sendnow
487 がゼロでない場合には出力バッファは書き出される。
488 このルーティンは成功した場合は 1 を返す。失敗した場合はゼロを返す。
489 .LP
490 .nf
491 .BI "bool_t xdrrec_eof(XDR *" xdrs );
492 .fi
493 .IP
494 .\"O This routine can be invoked only on streams created by
495 .\"O .BR xdrrec_create ().
496 .\"O After consuming the rest of the current record in the stream,
497 .\"O this routine returns one if the stream has no more input,
498 .\"O zero otherwise.
499 このルーティンは
500 .BR xdrrec_create ()
501 によって作成されたストリームに対してのみ呼び出すことができる。
502 ストリームの現在のレコードの残りを消費した後に、
503 ストリームに入力が残っていない場合には 1 を返す。
504 それ以外の場合はゼロを返す。
505 .LP
506 .nf
507 .BI "bool_t xdrrec_skiprecord(XDR *" xdrs );
508 .fi
509 .IP
510 .\"O This routine can be invoked only on
511 .\"O streams created by
512 .\"O .BR xdrrec_create ().
513 .\"O It tells the XDR implementation that the rest of the current record
514 .\"O in the stream's input buffer should be discarded.
515 .\"O This routine returns one if it succeeds, zero otherwise.
516 このルーティンは
517 .BR xdrrec_create ()
518 によって作成されたストリームに対してのみ呼び出すことができる。
519 XDR の実装にそのストリームの入力バッファーの現在のレコードの残りを
520 捨てるように伝える。このルーティンは成功した場合は 1 を返す。
521 失敗した場合はゼロを返す。
522 .LP
523 .nf
524 .BI "bool_t xdr_reference(XDR *" xdrs ", char **" pp ", unsigned int " size ,
525 .BI "                     xdrproc_t " proc );
526 .fi
527 .IP
528 .\"O A primitive that provides pointer chasing within structures.
529 .\"O The argument
530 .\"O .I pp
531 .\"O is the address of the pointer;
532 .\"O .I size
533 .\"O is the
534 .\"O .I sizeof
535 .\"O the structure that
536 .\"O .I *pp
537 .\"O points to; and
538 .\"O .I proc
539 .\"O is an XDR procedure that filters the structure
540 .\"O between its C form and its external representation.
541 .\"O This routine returns one if it succeeds, zero otherwise.
542 構造体へのポインター追跡を提供する基本ルーティン。
543 引き数
544 .I pp
545 はポインターのアドレスである。
546 .I size
547
548 .I *pp
549 が指している構造体の
550 .I sizeof
551 である。
552 .I proc
553 はその構造体の C 形式と外部表現との変換を行なう XDR プロシジャである。
554 このルーティンは成功した場合 1 を返す。
555 失敗した場合はゼロを返す。
556 .IP
557 .\"O Warning: this routine does not understand NULL pointers.
558 .\"O Use
559 .\"O .BR xdr_pointer ()
560 .\"O instead.
561 警告: このルーティンは NULL ポインターを理解することができない。かわりに
562 .BR xdr_pointer ()
563 を使用すること。
564 .LP
565 .nf
566 .BI "xdr_setpos(XDR *" xdrs ", unsigned int " pos );
567 .fi
568 .IP
569 .\"O A macro that invokes the set position routine associated with
570 .\"O the XDR stream
571 .\"O .IR xdrs .
572 .\"O The argument
573 .\"O .I pos
574 .\"O is a position value obtained from
575 .\"O .BR xdr_getpos ().
576 .\"O This routine returns one if the XDR stream could be repositioned,
577 .\"O and zero otherwise.
578 このマクロは XDR ストリーム
579 .I xdrs
580 に関連付けられた位置設定ルーティンを呼び出す。引き数
581 .I pos
582
583 .BR xdr_getpos ()
584 によって取得される位置数値である。
585 このルーティンは XDR ストリームの位置の変更ができた場合には 1 を返す。
586 それ以外の場合は 0 を返す。
587 .IP
588 .\"O Warning: it is difficult to reposition some types of XDR
589 .\"O streams, so this routine may fail with one
590 .\"O type of stream and succeed with another.
591 警告: ある種の XDR ストリームの場合は位置の変更を行なうことが困難である。
592 それでこのルーティンはある種のストリームの場合には成功し、別の種類の
593 場合には失敗するかもしれない。
594 .LP
595 .nf
596 .BI "bool_t xdr_short(XDR *" xdrs ", short *" sp );
597 .fi
598 .IP
599 .\"O A filter primitive that translates between C
600 .\"O .I short
601 .\"O integers and their external representations.
602 .\"O This routine returns one if it succeeds, zero otherwise.
603 C の
604 .I short
605 整数とその外部表現との変換を行なう基本フィルター。
606 このルーティンは成功すると 1 を返す。
607 失敗した場合はゼロを返す。
608 .LP
609 .nf
610 .BI "void xdrstdio_create(XDR *" xdrs ", FILE *" file ", enum xdr_op " op );
611 .fi
612 .IP
613 .\"O This routine initializes the XDR stream object pointed to by
614 .\"O .IR xdrs .
615 .\"O The XDR stream data is written to, or read from, the
616 .\"O .I stdio
617 .\"O stream
618 .\"O .IR file .
619 .\"O The argument
620 .\"O .I op
621 .\"O determines the direction of the XDR stream (either
622 .\"O .BR XDR_ENCODE ,
623 .\"O .BR XDR_DECODE ,
624 .\"O or
625 .\"O .BR XDR_FREE ).
626 このルーティンは
627 .I xdrs
628 で指された XDR ストリーム・オブジェクトを初期化する。
629 XDR ストリームに読み書きれたデータは
630 .I stdio
631 ストリーム
632 .I file
633 が使用される。
634 .I op
635 引き数は XDR ストリームの変換方向を決定する
636 .RB ( XDR_ENCODE ,
637 .BR XDR_DECODE ,
638 .B XDR_FREE
639 のどれか)。
640 .IP
641 .\"O Warning: the destroy routine associated with such XDR streams calls
642 .\"O .BR fflush (3)
643 .\"O on the
644 .\"O .I file
645 .\"O stream, but never
646 .\"O .BR fclose (3).
647 警告: このような XDR ストリームに関連付けられた破壊ルーティンは
648 .I file
649 ストリームに対して
650 .BR fflush (3)
651 を呼び出すが
652 .BR fclose (3)
653 を呼び出すことはない。
654 .LP
655 .nf
656 .BI "bool_t xdr_string(XDR *" xdrs ", char **" sp ", unsigned int " maxsize );
657 .fi
658 .IP
659 .\"O A filter primitive that translates between C strings and
660 .\"O their corresponding external representations.
661 .\"O Strings cannot be longer than
662 .\"O .IR maxsize .
663 .\"O Note:
664 .\"O .I sp
665 .\"O is the address of the string's pointer.
666 .\"O This routine returns one if it succeeds, zero otherwise.
667 C の文字列とそれに対応する外部表現とを変換するための基本フィルター。
668 文字列は
669 .I maxsize
670 より長くはできない。
671 注意:
672 .I sp
673 は文字列へのポインターのアドレスである。
674 このルーティンは成功した場合は 1 を返す。
675 失敗した場合はゼロを返す。
676 .LP
677 .nf
678 .BI "bool_t xdr_u_char(XDR *" xdrs ", unsigned char *" ucp );
679 .fi
680 .IP
681 .\"O A filter primitive that translates between
682 .\"O .I unsigned
683 .\"O C characters and their external representations.
684 .\"O This routine returns one if it succeeds, zero otherwise.
685 C の
686 .I 符号無し文字 (unsigned char)
687 とその外部表現とを変換する基本フィルター。
688 このルーティンは成功した場合は 1 を返す。
689 失敗した場合はゼロを返す。
690 .LP
691 .nf
692 .BI "bool_t xdr_u_int(XDR *" xdrs ", unsigned *" up );
693 .fi
694 .IP
695 .\"O A filter primitive that translates between C
696 .\"O .I unsigned
697 .\"O integers and their external representations.
698 .\"O This routine returns one if it succeeds, zero otherwise.
699 C の
700 .I 符号無し整数 (unsigned)
701 とその外部表現を変換するための基本フィルター。
702 このルーティンは成功した場合は 1 を返す。
703 失敗した場合はゼロを返す。
704 .LP
705 .nf
706 .BI "bool_t xdr_u_long(XDR *" xdrs ", unsigned long *" ulp );
707 .fi
708 .IP
709 .\"O A filter primitive that translates between C
710 .\"O .I "unsigned long"
711 .\"O integers and their external representations.
712 .\"O This routine returns one if it succeeds, zero otherwise.
713 C の
714 .I "unsigned long"
715 整数とその外部表現を変換するための基本フィルター。
716 このルーティンは成功した場合は 1 を返す。
717 失敗した場合はゼロを返す。
718 .LP
719 .nf
720 .BI "bool_t xdr_u_short(XDR *" xdrs ", unsigned short *" usp );
721 .fi
722 .IP
723 .\"O A filter primitive that translates between C
724 .\"O .I "unsigned short"
725 .\"O integers and their external representations.
726 .\"O This routine returns one if it succeeds, zero otherwise.
727 C の
728 .I "unsigned short"
729 整数とその外部表現を変換するための基本フィルター。
730 このルーティンは成功した場合は 1 を返す。
731 失敗した場合はゼロを返す。
732 .LP
733 .nf
734 .BI "bool_t xdr_union(XDR *" xdrs ", int *" dscmp ", char *" unp ,
735 .BI "                 struct xdr_discrim *" choices ,
736 .BI "                 xdrproc_t " defaultarm ");     /* may equal NULL */"
737 .fi
738 .IP
739 .\"O A filter primitive that translates between a discriminated C
740 .\"O .I union
741 .\"O and its corresponding external representation.
742 .\"O It first
743 .\"O translates the discriminant of the union located at
744 .\"O .IR dscmp .
745 分別可能な C の
746 .I "共用体 (union)"
747 とその外部形式とを変換する基本フィルター。
748 最初に
749 .I dscmp
750 として与えられた共用体の分別要素が変換される。
751 .\"O This discriminant is always an
752 .\"O .IR enum_t .
753 この分別要素は常に
754 .I enum_t
755 である。
756 .\"O Next the union located at
757 .\"O .I unp
758 .\"O is translated.
759 .\"O The argument
760 .\"O .I choices
761 .\"O is a pointer to an array of
762 .\"O .BR xdr_discrim ()
763 .\"O structures.
764 .\"O Each structure contains an ordered pair of
765 .\"O .RI [ value , proc ].
766 次に
767 .I unp
768 の位置の共用体が変換される。引き数
769 .I choices
770
771 .BR xdr_discrim ()
772 構造体の配列へのポインターである。各構造体は
773 .RI [ value , proc ]
774 の順序付きペアを格納している。
775 .\"O If the union's discriminant is equal to the associated
776 .\"O .IR value ,
777 .\"O then the
778 .\"O .I proc
779 .\"O is called to translate the union.
780 .\"O The end of the
781 .\"O .BR xdr_discrim ()
782 .\"O structure array is denoted by a routine of value NULL.
783 もし共用体の分別要素が関連付けられた
784 .I value
785 と等しい場合には、共用体を変換するために
786 .I proc
787 が呼び出される。
788 .BR xdr_discrim ()
789 構造体の配列の最後は、ルーティンとして
790 .SM NULL
791 を指定することで示される。
792 .\"O If the discriminant is not found in the
793 .\"O .I choices
794 .\"O array, then the
795 .\"O .I defaultarm
796 .\"O procedure is called (if it is not NULL).
797 .\"O Returns one if it succeeds, zero otherwise.
798 分別要素が
799 .I choices
800 配列の中に見つからなかった場合、
801 .I defaultarm
802 が (NULL でなければ) 呼び出される。
803 成功した場合は 1 を返す。失敗した場合はゼロを返す。
804 .LP
805 .nf
806 .BI "bool_t xdr_vector(XDR *" xdrs ", char *" arrp ", unsigned int " size ,
807 .BI "                  unsigned int " elsize ", xdrproc_t " elproc );
808 .fi
809 .IP
810 .\"O A filter primitive that translates between fixed-length arrays
811 .\"O and their corresponding external representations.
812 .\"O The argument
813 .\"O .I arrp
814 .\"O is the address of the pointer to the array, while
815 .\"O .I size
816 .\"O is the element count of the array.
817 .\"O The argument
818 .\"O .I elsize
819 .\"O is the
820 .\"O .I sizeof
821 .\"O each of the array's elements, and
822 .\"O .I elproc
823 .\"O is an XDR filter that translates between
824 .\"O the array elements' C form, and their external
825 .\"O representation.
826 .\"O This routine returns one if it succeeds, zero otherwise.
827 固定長の配列とそれらが対応する外部表現とを変換する基本フィルター。
828 引き数
829 .I arrp
830 は配列へのポインターのアドレスである。一方で
831 .I size
832 は配列の要素数そのものである。引き数
833 .I elsize
834 は配列の各要素の
835 .I sizeof
836 で、
837 .I elproc
838 は配列の要素を C 形式からその外部表現へと変換する XDR フィルターである。
839 このルーティンは成功した場合 1 を返す。
840 失敗した場合はゼロを返す。
841 .LP
842 .nf
843 .BI "bool_t xdr_void(void);"
844 .fi
845 .IP
846 .\"O This routine always returns one.
847 .\"O It may be passed to RPC routines that require a function argument,
848 .\"O where nothing is to be done.
849 このルーティンは常に 1 を返す。
850 これは何も行なわないが、関数引き数が必要な
851 RPC ルーティンに渡すことができる。
852 .LP
853 .nf
854 .BI "bool_t xdr_wrapstring(XDR *" xdrs ", char **" sp );
855 .fi
856 .IP
857 .\"O A primitive that calls
858 .\"O .B "xdr_string(xdrs, sp,MAXUN.UNSIGNED );"
859 .\"O where
860 .\"O .B MAXUN.UNSIGNED
861 .\"O is the maximum value of an unsigned integer.
862 .\"O .BR xdr_wrapstring ()
863 .\"O is handy because the RPC package passes a maximum of two XDR
864 .\"O routines as arguments, and
865 .\"O .BR xdr_string (),
866 .\"O one of the most frequently used primitives, requires three.
867 .\"O Returns one if it succeeds, zero otherwise.
868 .B "xdr_string(xdrs, sp, \s-1MAXUN.UNSIGNED\s0 );"
869 を呼び出す基本ルーティン。
870 ここで
871 .B
872 .SM MAXUN.UNSIGNED
873 は符号無し整数(unsigned int)の最大値である。
874 .BR xdr_wrapstring ()
875 は、
876 .SM RPC
877 パッケージは二つの
878 .SM XDR
879 ルーティンの最大値を引き数として渡すため便利である。
880 .BR xdr_string ()
881 は最も頻繁に利用される基本ルーティンであるが三つを要求する。
882 成功した場合は 1 を返す、失敗した場合はゼロを返す。
883 .\"O .SH SEE ALSO
884 .SH 関連項目
885 .BR rpc (3)
886 .LP
887 .\"O The following manuals:
888 以下のマニュアル:
889 .RS
890 eXternal Data Representation Standard: Protocol Specification
891 .br
892 eXternal Data Representation: Sun Technical Notes
893 .br
894 .IR "XDR: External Data Representation Standard" ,
895 RFC\ 1014, Sun Microsystems, Inc.,
896 USC-ISI.
897 .RE