1 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
3 .\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
5 .\" 2007-12-30, mtk, Convert function prototypes to modern C syntax
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>
12 .TH XDR 3 2007-12-30 "" "Linux Programmer's Manual"
15 .\"O xdr \- library routines for external data representation
16 xdr \- 外部データ表現(XDR)のためのライブラリ・ルーティン
17 .\"O .SH SYNOPSIS AND DESCRIPTION
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
24 これらのルーティンは C プログラマーがマシン非依存な形式で
25 任意のデータ構造体を記述することを可能にする。
26 リモート・プロシジャ・コールのためのデータはこれらのルーティンを
29 .\"O The prototypes below are declared in
31 .\"O and make use of the following types:
34 で行われており、その中では次の型が使用される。
38 typedef int \fIbool_t\fP;
40 typedef bool_t (*\fIxdrproc_t\fP) (XDR *, void *,...);
44 .\"O For the declaration of the
47 .\"O .IR <rpc/xdr.h> .
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 );
59 .\"O A filter primitive that translates between variable-length arrays
60 .\"O and their corresponding external representations.
63 .\"O is the address of the pointer to the array, while
65 .\"O is the address of the element count of the array;
66 .\"O this element count cannot exceed
68 可変長の配列とそれに対応する外部表現とを変換する基本フィルター。
81 .\"O each of the array's elements, and
83 .\"O is an XDR filter that translates between
84 .\"O the array elements' C form, and their external
86 .\"O This routine returns one if it succeeds, zero otherwise.
93 は配列要素を C 形式からその外部表現に変換するための XDR フィルターである。
94 このルーティンは成功した場合には 1 を返す。
98 .BI "bool_t xdr_bool(XDR *" xdrs ", bool_t *" bp );
101 .\"O A filter primitive that translates between booleans (C
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 を返す。
113 .BI "bool_t xdr_bytes(XDR *" xdrs ", char **" sp ", unsigned int *" sizep ,
114 .BI " unsigned int " maxsize );
117 .\"O A filter primitive that translates between counted byte
118 .\"O strings and their external representations.
121 .\"O is the address of the string pointer.
122 .\"O The length of the
123 .\"O string is located at address
125 .\"O strings cannot be longer than
127 .\"O This routine returns one if it succeeds, zero otherwise.
128 ある長さのバイト文字列とその外部表現とを変換する基本フィルター。
131 は文字列ポインターのアドレスである。文字列の長さは
136 このルーティンは成功した場合には 1 を返す。
140 .BI "bool_t xdr_char(XDR *" xdrs ", char *" cp );
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
149 .\"O .BR xdr_bytes (),
150 .\"O .BR xdr_opaque ()
152 .\"O .BR xdr_string ().
153 C の文字(char)とその外部表現との間を変換する基本フィルター。
154 このルーティンは成功した場合には 1 を返す。
156 注意: エンコードされたデータは詰め込まれておらず、それぞれ 4 バイトを
164 .BI "void xdr_destroy(XDR *" xdrs );
167 .\"O A macro that invokes the destroy routine associated with the XDR stream,
169 .\"O Destruction usually involves freeing private data structures
170 .\"O associated with the stream.
174 .\"O .BR xdr_destroy ()
178 に関連付けられた破壊ルーティンを呼び出す。
179 破壊には通常、ストリームに関連付けられた私的データ構造体の解放が含まれている。
186 .BI "bool_t xdr_double(XDR *" xdrs ", double *" dp );
189 .\"O A filter primitive that translates between C
191 .\"O precision numbers and their external representations.
192 .\"O This routine returns one if it succeeds, zero otherwise.
195 とその外部表現との変換を行なう基本フィルター。
196 このルーティンは成功した場合は 1 を返す。
200 .BI "bool_t xdr_enum(XDR *" xdrs ", enum_t *" ep );
203 .\"O A filter primitive that translates between C
205 .\"O (actually integers) and their external representations.
206 .\"O This routine returns one if it succeeds, zero otherwise.
209 (実際には int)とその外部表現との変換を行なう基本フィルター。
210 このルーティンは成功した場合は 1 を返す。
214 .BI "bool_t xdr_float(XDR *" xdrs ", float *" fp );
217 .\"O A filter primitive that translates between C
219 .\"O and their external representations.
220 .\"O This routine returns one if it succeeds, zero otherwise.
223 とその外部表現との変換を行なう基本フィルター。
224 このルーティンは成功した場合は 1 を返す。
228 .BI "void xdr_free(xdrproc_t " proc ", char *" objp );
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
236 .\"O freed, but what it points to
238 .\"O freed (recursively).
239 汎用解放(free)ルーティン。最初の引き数はオブジェクトを解放するための
240 XDR ルーティンである。二番目の引き数はそのオブジェクト自身へのポインター
241 である。注意: このルーティンに渡されるポインターは
243 が、このポインターの指すデータは(再帰的に)
247 .BI "unsigned int xdr_getpos(XDR *" xdrs );
250 .\"O A macro that invokes the get-position routine
251 .\"O associated with the XDR stream,
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.
260 に関連付けられた位置取得ルーティンを呼び出す。
261 このルーティンは XDR バイト・ストリームの位置を指示する符号無し整数を返す。
262 XDR ストリームの機能としてこの数値で単純な算術作業ができることが
264 XDR ストリームの実体はこれを保証する必要はない。
267 .BI "long *xdr_inline(XDR *" xdrs ", int " len );
270 .\"O A macro that invokes the inline routine associated with the XDR stream,
272 .\"O The routine returns a pointer
273 .\"O to a contiguous piece of the stream's buffer;
275 .\"O is the byte length of the desired buffer.
276 .\"O Note: pointer is cast to
280 に関連付けられた内部(inline)ルーティンを呼び出す。
281 ルーティンはストリームのバッファーの連続する断片へのポインターを返す。
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.
296 はバッファーの連続する断片を割り当てることができなかった場合には
298 どの場合もその動作はストリームの実体によって変化するかもしれない。
302 .BI "bool_t xdr_int(XDR *" xdrs ", int *" 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 を返す。
313 .BI "bool_t xdr_long(XDR *" xdrs ", long *" lp );
316 .\"O A filter primitive that translates between C
318 .\"O integers and their external representations.
319 .\"O This routine returns one if it succeeds, zero otherwise.
322 整数とそのその外部表現とを変換するための基本フィルター。
323 このルーティンは成功した場合は 1 を返す。
327 .BI "void xdrmem_create(XDR *" xdrs ", char *" addr ", unsigned int " size ,
328 .BI " enum xdr_op " op );
331 .\"O This routine initializes the XDR stream object pointed to by
333 .\"O The stream's data is written to, or read from,
334 .\"O a chunk of memory at location
336 .\"O whose length is no more than
341 .\"O determines the direction of the XDR stream (either
342 .\"O .BR XDR_ENCODE ,
343 .\"O .BR XDR_DECODE ,
348 によって指されている XDR ストリーム・オブジェクトを初期化する。
351 位置にあるメモリーの塊から読み書きされる。
356 は XDR ストリームの変換方向を決定する
363 .BI "bool_t xdr_opaque(XDR *" xdrs ", char *" cp ", unsigned int " cnt );
366 .\"O A filter primitive that translates between fixed size opaque data
367 .\"O and its external representation.
370 .\"O is the address of the opaque object, and
372 .\"O is its size in bytes.
373 .\"O This routine returns one if it succeeds, zero otherwise.
374 固定長の不明データとその外部表現との変換を行なう基本フィルター。
380 このルーティンは成功した場合は 1 を返す。
384 .BI "bool_t xdr_pointer(XDR *" xdrs ", char **" objpp ,
385 .BI " unsigned int " objsize ", xdrproc_t " xdrobj );
389 .\"O .BR xdr_reference ()
390 .\"O except that it serializes NULL pointers, whereas
391 .\"O .BR xdr_reference ()
394 .\"O .BR xdr_pointer ()
396 .\"O recursive data structures, such as binary trees or
399 と同様であるが、これが NULL ポインターを番号化するのに対して
401 はそうしない点が異なっている。これにより、
403 は二分木や連結リストのような再帰的なデータ構造体を
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));"
413 .\"O This routine initializes the XDR stream object pointed to by
415 .\"O The stream's data is written to a buffer of size
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
420 .\"O it too can be set to a suitable default by passing a zero value.
423 で指された XDR ストリーム・オブジェクトを初期化する。
428 をゼロにすると、システムに適切なデフォルトを使用するように指示する。
431 のバッファから読み込まれる。これもゼロを渡すことで適切なデフォルトに
433 .\"O When a stream's output buffer is full,
436 .\"O Similarly, when a stream's input buffer is empty,
439 .\"O The behavior of these two routines is similar to
440 .\"O the system calls
446 .\"O is passed to the former routines as the first argument.
449 が呼び出される。同様にストリーム入力バッファが空の場合には
451 が呼び出される。これらの二つのルーティンの動作はシステムコールの
455 と似ているが、前者のルーティンは最初の引き数として
458 .\"O Note: the XDR stream's
460 .\"O field must be set by the caller.
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 レコード境界の情報を提供するためにストリームには余分なバイトが存在する。
472 .BI "bool_t xdrrec_endofrecord(XDR *" xdrs ", int " sendnow );
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
481 .\"O This routine returns one if it succeeds, zero otherwise.
484 によって作成されたストリームに対してのみ呼び出すことができる。
485 出力バッファのデータは完全なレコードとして印され、
487 がゼロでない場合には出力バッファは書き出される。
488 このルーティンは成功した場合は 1 を返す。失敗した場合はゼロを返す。
491 .BI "bool_t xdrrec_eof(XDR *" xdrs );
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,
501 によって作成されたストリームに対してのみ呼び出すことができる。
502 ストリームの現在のレコードの残りを消費した後に、
503 ストリームに入力が残っていない場合には 1 を返す。
507 .BI "bool_t xdrrec_skiprecord(XDR *" xdrs );
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.
518 によって作成されたストリームに対してのみ呼び出すことができる。
519 XDR の実装にそのストリームの入力バッファーの現在のレコードの残りを
520 捨てるように伝える。このルーティンは成功した場合は 1 を返す。
524 .BI "bool_t xdr_reference(XDR *" xdrs ", char **" pp ", unsigned int " size ,
525 .BI " xdrproc_t " proc );
528 .\"O A primitive that provides pointer chasing within structures.
531 .\"O is the address of the pointer;
535 .\"O the structure that
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 構造体へのポインター追跡を提供する基本ルーティン。
553 はその構造体の C 形式と外部表現との変換を行なう XDR プロシジャである。
554 このルーティンは成功した場合 1 を返す。
557 .\"O Warning: this routine does not understand NULL pointers.
559 .\"O .BR xdr_pointer ()
561 警告: このルーティンは NULL ポインターを理解することができない。かわりに
566 .BI "xdr_setpos(XDR *" xdrs ", unsigned int " pos );
569 .\"O A macro that invokes the set position routine associated with
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.
580 に関連付けられた位置設定ルーティンを呼び出す。引き数
585 このルーティンは XDR ストリームの位置の変更ができた場合には 1 を返す。
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 それでこのルーティンはある種のストリームの場合には成功し、別の種類の
596 .BI "bool_t xdr_short(XDR *" xdrs ", short *" sp );
599 .\"O A filter primitive that translates between C
601 .\"O integers and their external representations.
602 .\"O This routine returns one if it succeeds, zero otherwise.
605 整数とその外部表現との変換を行なう基本フィルター。
610 .BI "void xdrstdio_create(XDR *" xdrs ", FILE *" file ", enum xdr_op " op );
613 .\"O This routine initializes the XDR stream object pointed to by
615 .\"O The XDR stream data is written to, or read from, the
621 .\"O determines the direction of the XDR stream (either
622 .\"O .BR XDR_ENCODE ,
623 .\"O .BR XDR_DECODE ,
628 で指された XDR ストリーム・オブジェクトを初期化する。
635 引き数は XDR ストリームの変換方向を決定する
641 .\"O Warning: the destroy routine associated with such XDR streams calls
645 .\"O stream, but never
647 警告: このような XDR ストリームに関連付けられた破壊ルーティンは
656 .BI "bool_t xdr_string(XDR *" xdrs ", char **" sp ", unsigned int " maxsize );
659 .\"O A filter primitive that translates between C strings and
660 .\"O their corresponding external representations.
661 .\"O Strings cannot be longer than
665 .\"O is the address of the string's pointer.
666 .\"O This routine returns one if it succeeds, zero otherwise.
667 C の文字列とそれに対応する外部表現とを変換するための基本フィルター。
674 このルーティンは成功した場合は 1 を返す。
678 .BI "bool_t xdr_u_char(XDR *" xdrs ", unsigned char *" ucp );
681 .\"O A filter primitive that translates between
683 .\"O C characters and their external representations.
684 .\"O This routine returns one if it succeeds, zero otherwise.
686 .I 符号無し文字 (unsigned char)
687 とその外部表現とを変換する基本フィルター。
688 このルーティンは成功した場合は 1 を返す。
692 .BI "bool_t xdr_u_int(XDR *" xdrs ", unsigned *" up );
695 .\"O A filter primitive that translates between C
697 .\"O integers and their external representations.
698 .\"O This routine returns one if it succeeds, zero otherwise.
701 とその外部表現を変換するための基本フィルター。
702 このルーティンは成功した場合は 1 を返す。
706 .BI "bool_t xdr_u_long(XDR *" xdrs ", unsigned long *" ulp );
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.
715 整数とその外部表現を変換するための基本フィルター。
716 このルーティンは成功した場合は 1 を返す。
720 .BI "bool_t xdr_u_short(XDR *" xdrs ", unsigned short *" usp );
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.
729 整数とその外部表現を変換するための基本フィルター。
730 このルーティンは成功した場合は 1 を返す。
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 */"
739 .\"O A filter primitive that translates between a discriminated C
741 .\"O and its corresponding external representation.
743 .\"O translates the discriminant of the union located at
747 とその外部形式とを変換する基本フィルター。
750 として与えられた共用体の分別要素が変換される。
751 .\"O This discriminant is always an
756 .\"O Next the union located at
761 .\"O is a pointer to an array of
762 .\"O .BR xdr_discrim ()
764 .\"O Each structure contains an ordered pair of
765 .\"O .RI [ value , proc ].
772 構造体の配列へのポインターである。各構造体は
775 .\"O If the union's discriminant is equal to the associated
779 .\"O is called to translate the union.
781 .\"O .BR xdr_discrim ()
782 .\"O structure array is denoted by a routine of value NULL.
792 .\"O If the discriminant is not found in the
796 .\"O procedure is called (if it is not NULL).
797 .\"O Returns one if it succeeds, zero otherwise.
802 が (NULL でなければ) 呼び出される。
803 成功した場合は 1 を返す。失敗した場合はゼロを返す。
806 .BI "bool_t xdr_vector(XDR *" xdrs ", char *" arrp ", unsigned int " size ,
807 .BI " unsigned int " elsize ", xdrproc_t " elproc );
810 .\"O A filter primitive that translates between fixed-length arrays
811 .\"O and their corresponding external representations.
814 .\"O is the address of the pointer to the array, while
816 .\"O is the element count of the array.
821 .\"O each of the array's elements, and
823 .\"O is an XDR filter that translates between
824 .\"O the array elements' C form, and their external
826 .\"O This routine returns one if it succeeds, zero otherwise.
827 固定長の配列とそれらが対応する外部表現とを変換する基本フィルター。
830 は配列へのポインターのアドレスである。一方で
838 は配列の要素を C 形式からその外部表現へと変換する XDR フィルターである。
839 このルーティンは成功した場合 1 を返す。
843 .BI "bool_t xdr_void(void);"
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.
850 これは何も行なわないが、関数引き数が必要な
854 .BI "bool_t xdr_wrapstring(XDR *" xdrs ", char **" sp );
857 .\"O A primitive that calls
858 .\"O .B "xdr_string(xdrs, sp,MAXUN.UNSIGNED );"
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 );"
873 は符号無し整数(unsigned int)の最大値である。
874 .BR xdr_wrapstring ()
879 ルーティンの最大値を引き数として渡すため便利である。
881 は最も頻繁に利用される基本ルーティンであるが三つを要求する。
882 成功した場合は 1 を返す、失敗した場合はゼロを返す。
887 .\"O The following manuals:
890 eXternal Data Representation Standard: Protocol Specification
892 eXternal Data Representation: Sun Technical Notes
894 .IR "XDR: External Data Representation Standard" ,
895 RFC\ 1014, Sun Microsystems, Inc.,