OSDN Git Service

(split) LDP: Translate several number of pages
[linuxjm/LDP_man-pages.git] / draft / man7 / socket.7
index cadf76b..5037200 100644 (file)
@@ -115,7 +115,7 @@ Read:POLLHUP:T{
 も送信される。
 T}
 Write:POLLOUT:T{
\82½ã\82±ã\83\83ã\83\88ã\81«ã\81¯æ\96°ã\81\97ã\81\84ã\83\87ã\83¼ã\82¿ã\82\92æ\9b¸ã\81\8dè¾¼ã\82\80ã\81®ã\81«å\85\85å\88\86ã\81ªã\83\90ã\83\83ã\83\95ã\82¡é \98å\9f\9fがある。
\82½ã\82±ã\83\83ã\83\88ã\81«ã\81¯æ\96°ã\81\97ã\81\84ã\83\87ã\83¼ã\82¿ã\82\92æ\9b¸ã\81\8dè¾¼ã\82\80ã\81®ã\81«å\8d\81å\88\86ã\81ªã\83\90ã\83\83ã\83\95ã\82¡がある。
 T}
 Read/Write:T{
 POLLIN|
@@ -145,27 +145,21 @@ T}
 シグナルを使う方法もある。 この方法を使うには、 \fBfcntl\fP(2)  を用いてソケットのファイルディスクリプタに \fBO_ASYNC\fP
 フラグをセットし、 \fBSIGIO\fP に対する有効なシグナルハンドラを \fBsigaction\fP(2)  によって設定しておく必要がある。 後述の
 \fIシグナル\fP に関する議論も参考にすること。
-.SS "Socket address structures"
-Each socket domain has its own format for socket addresses, with a
-domain\-specific address structure.  Each of these structures begins with an
-integer "family" field (typed as \fIsa_family_t\fP)  that indicates the type of
-the address structure.  This allows the various system calls (e.g.,
-\fBconnect\fP(2), \fBbind\fP(2), \fBaccept\fP(2), \fBgetsockname\fP(2),
-\fBgetpeername\fP(2)), which are generic to all socket domains, to determine
-the domain of a particular socket address.
+.SS ソケットアドレス構造体
+各ソケットドメインにはそれぞれ独自のソケットアドレス形式があり、ドメイン固有のアドレス構造体を持っている。
+これらの構造体の先頭には、アドレス構造体の種類を示す整数の "family" フィールド (型は \fIsa_family_t\fP) がある。
+このフィールドにより、 すべてのソケットドメインで汎用的に使用されるシステムコール (例えば、 \fBconnect\fP(2), \fBbind\fP(2),
+\fBaccept\fP(2), \fBgetsockname\fP(2), \fBgetpeername\fP(2) など)
+が、特定のソケットアドレスのドメインを判定することができる。
 
-To allow any type of socket address to be passed to interfaces in the
-sockets API, the type \fIstruct sockaddr\fP is defined.  The purpose of this
-type is purely to allow casting of domain\-specific socket address types to a
-"generic" type, so as to avoid compiler warnings about type mismatches in
-calls to the sockets API.
+任意の種類のソケットアドレスをソケット API のインターフェースに渡せるように、 \fIstruct sockaddr\fP 型が定義されている。
+この型の目的は、 純粋に、 ドメイン固有のソケットアドレスを 「汎用的な」型にキャストできるようにする点にある。 これにより、 ソケット API
+呼び出しにおいて、 コンパイラが型の不一致の警告を出すのを避けることができる。
 
-In addition, the sockets API provides the data type \fIstruct
-sockaddr_storage\fP.  This type is suitable to accommodate all supported
-domain\-specific socket address structures; it is large enough and is aligned
-properly.  (In particular, it is large enough to hold IPv6 socket
-addresses.)  The structure includes the following field, which can be used
-to identify the type of socket address actually stored in the structure:
+これに加えて、ソケット API ではデータ型 \fIstruct sockaddr_storage\fP が提供されている。
+サポートしているすべてのドメイン固有のソケットアドレス構造体を収容するのに、この型を使うことができる。 この型は十分な大きさがあり、(メモリ境界への)
+アラインも適切に行われている (特に、 IPv6 ソケットアドレスを収容するのにも十分な大きさである)。 この構造体には次のフィールドがあり、
+このフィールドを使って、 この構造体に実際に格納されているソケットアドレスの型を特定することができる。
 
 .in +4n
 .nf
@@ -173,9 +167,8 @@ to identify the type of socket address actually stored in the structure:
 .fi
 .in
 
-The \fIsockaddr_storage\fP structure is useful in programs that must handle
-socket addresses in a generic way (e.g., programs that must deal with both
-IPv4 and IPv6 socket addresses).
+\fIsockaddr_storage\fP 構造体は、 ソケットアドレスを汎用的な方法で扱う必要があるプログラム (例えば、 IPv4 と IPv6
+の両方のソケットアドレスを扱う必要があるプログラム) で有用である。
 .SS ソケットオプション
 .\" FIXME
 .\" In the list below, the text used to describe argument types
@@ -191,23 +184,17 @@ IPv4 and IPv6 socket addresses).
 状態のソケットでないことを、 値 1 は listen 状態のソケットであることを示す。このソケットオプションは読み込み専用である。
 .TP 
 \fBSO_BINDTODEVICE\fP
-このソケットを、引き数で渡したインターフェース名で指定される
-(\(lqeth0\(rq のような) 特定のデバイスにバインドする。
-名前が空文字列だったり、オプションの長さ (optlen) が 0 の場合には、
-ソケットのバインドが削除される。渡すオプションは、インターフェース名が
-入ったヌル文字で終端された可変長の文字列である。
-文字列の最大のサイズは \fBIFNAMSIX\fP である。
-ソケットがインターフェースにバインドされると、その特定のインターフェース
-から受信されたパケットだけを処理する。
-このオプションはいくつかのソケットタイプ、
-特に \fBAF_INET\fP に対してのみ動作する点に注意すること。
-パケットソケットではサポートされていない (通常の \fBbind\fP(2) を使うこと)。
+このソケットを、引き数で渡したインターフェース名で指定される (\(lqeth0\(rq のような) 特定のデバイスにバインドする。
+名前が空文字列だったり、オプションの長さ (optlen) が 0 の場合には、 ソケットのバインドが削除される。
+渡すオプションは、インターフェース名が 入ったヌル文字で終端された可変長の文字列である。 文字列の最大のサイズは \fBIFNAMSIX\fP である。
+ソケットがインターフェースにバインドされると、 その特定のインターフェースから受信されたパケットだけを処理する。
+このオプションはいくつかのソケットタイプ、 特に \fBAF_INET\fP に対してのみ動作する点に注意すること。 パケットソケットではサポートされていない
+(通常の \fBbind\fP(2) を使うこと)。
 
-Before Linux 3.8, this socket option could be set, but could not retrieved
-with \fBgetsockopt\fP(2).  Since Linux 3.8, it is readable.  The \fIoptlen\fP
-argument should contain the buffer size available to receive the device name
-and is recommended to be \fBIFNAMSZ\fP bytes.  The real device name length is
-reported back in the \fIoptlen\fP argument.
+Linux 3.8 より前のバージョンでは、このソケットオプションは \fBgetsockname\fP(2)
+で設定することはできたが、取得することができなかった。 Linux 3.8 以降では、読み出すことができる。 \fIoptlen\fP 引き数には、
+デバイス名を格納するのに十分なバッファサイズを渡すべきであり、 \fBIFNAMSIZ\fP バイトにすることを推奨する。 実際のデバイス名の長さは
+\fIoptlen\fP 引き数に格納されて返される。
 .TP 
 \fBSO_BROADCAST\fP
 ブロードキャストフラグを設定・取得する。有効になっていると、データグラ
@@ -260,10 +247,9 @@ struct linger {
 \fBSO_MARK\fP (Linux 2.6.25 以降)
 .\" commit 4a19ec5800fc3bb64e2d87c4d9fdd9e636086fe0
 .\" and    914a9ab386a288d0f22252fc268ecbc048cdcbd5
-Set the mark for each packet sent through this socket (similar to the
-netfilter MARK target but socket\-based).  Changing the mark can be used for
-mark\-based routing without netfilter or for packet filtering.  Setting this
-option requires the \fBCAP_NET_ADMIN\fP capability.
+このソケットから送信される各パケットにマークをセットする (netfilter の MARK ターゲットと似ているが、ソケット単位である点が異なる)。
+マークの変更は、 netfilter なしでのマークに基づいてのルーティングや、 パケットフィルタリングに使うことができる。
+このオプションを変更するには \fBCAP_NET_ADMIN\fP ケーパビリティが必要である。
 .TP 
 \fBSO_OOBINLINE\fP
 .\" don't document it because it can do too much harm.