version 1.2, 2000/01/23 00:41:08 |
version 1.9, 2020/03/14 01:21:57 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/start-session.tex,v 1.1.1.1 2000/01/20 08:52:46 noro Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/start-session.tex,v 1.8 2005/03/04 03:49:47 takayama Exp $ |
//&jp \section{TCP/IP でのセッションのスタート} |
//&jp \section{TCP/IP с祉激с潟鴻帥若} |
//&eg \section{How to start a session on TCP/IP} |
//&eg \section{How to start a session on TCP/IP} |
|
|
\subsection{Standard I/O on OX servers} |
\subsection{Standard I/O on OX servers} |
|
|
/*&jp |
/*&jp |
サーバの実装を容易にするために, サーバは, 起動時に file descriptor 3, |
泣若絎茖絎号, 泣若, 莎桁 file descriptor 3, |
4 がそれぞれクライアントからの入力, クライアントへの出力用に open され |
4 ゃ≪潟ュ, ゃ≪潟吾阪 open |
ていると仮定する. すなわち, サーバ自体が通信を成立させるための socket |
篁絎. , 泣若篏篆<腴 socket |
操作を行う必要はない. 但し, OX message の効率よい送受信のために, data |
篏茵綽荀. 篏, OX message 合篆<, data |
のバッファリングを行うことはサーバ側の責任である. UNIX においては, |
<潟違茵泣若眼莢篁祉с. UNIX , |
file descriptor へのbuffer の attach は {\tt fdopen()} で行うことがで |
file descriptor 吾buffer attach {\tt fdopen()} ц |
きる. |
. |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 26 with a descriptor can be done by {\tt fdopen()}. |
|
Line 26 with a descriptor can be done by {\tt fdopen()}. |
|
|
|
\subsection{Launcher} |
\subsection{Launcher} |
/*&jp |
/*&jp |
サーバは, クライアントから起動されるが, TCP/IP 接続のためには socket の |
泣若, ゃ≪潟莎桁, TCP/IP ・膓 socket |
生成から始まる一連の操作が必要である. 一方で, すでに述べたように, サーバ |
紮障筝c篏綽荀с. 筝鴻, с菴違鴻, 泣若 |
自体はそういう機能はもたない. launcher は, この両者の橋渡しをする application |
篏罘純. launcher , 筝∴罘羝< application |
である. launcher の働きは次の通りである. |
с. launcher 罨<с. |
|
|
\begin{enumerate} |
\begin{enumerate} |
\item launcher はクライアントが起動する. launcher には使用する port 番号, |
\item launcher ゃ≪潟莎桁. launcher 篏睡 port , |
サーバ application のファイル名が伝えられる. |
泣若 application <ゃ篌. |
\item client はまず launcher と通信を成立させる. この際, one time password |
\item client 障 launcher 篆<腴. , one time password |
が用いられる場合もある. |
翫. |
\item launcher は新しいプロセスを起動し, そのプロセスにおいて client と通信 |
\item launcher 違祉鴻莎桁, 祉鴻 client 篆 |
を成立させる. そして, その通信路が file descriptor の 3, 4 となるように |
腴. , 篆∴君 file descriptor 3, 4 |
セットし, サーバを exec する. |
祉, 泣若 exec . |
\end{enumerate} |
\end{enumerate} |
|
|
以上の操作のあと, launcher はコントロールサーバとなり, 自身が作った |
篁ヤ篏, launcher 潟潟若泣若, 荳篏c |
したサーバの制御を行う. |
泣若九勝茵. |
*/ |
*/ |
/*&eg |
/*&eg |
Though there need several socket operations to establish a |
Though there need several socket operations to establish a |
connetion over TCP/IP, servers do not have any functionality for |
connection over TCP/IP, servers do not have any functionality for |
connection establishment. |
connection establishment. |
An application called {\it launcher} is provided to start servers |
An application called {\it launcher} is provided to start servers |
and to establish connections as follows. |
and to establish connections as follows. |
Line 69 acts as a control server and controls the server proce |
|
Line 69 acts as a control server and controls the server proce |
|
itself. |
itself. |
*/ |
*/ |
|
|
//&jp \subsection{byte order の決定} |
//&jp \subsection{byte order 羆阪} \label{subsection:byteorder} |
//&eg \subsection{Negotiation of the byte order} |
//&eg \subsection{Negotiation of the byte order} \label{subsection:byteorder} |
/*&jp |
/*&jp |
コントロールプロセス, 計算プロセス |
潟潟若祉, 荐膊祉 |
ともに, 起動直後に |
, 莎桁翫 |
1 byte のデータを書き出し flush する. |
1 byte 若帥吾冴 flush . |
そのあと, 1 byte のデータを読み込む. |
, 1 byte 若帥茯粋昭. |
クライアントはコントロールプロセス, 計算プロセス |
ゃ≪潟潟潟若祉, 荐膊祉 |
につながるファイルディスクリプタの両方から |
ゃ<ゃc鴻帥筝≧鴻 |
まず 1 byte のデータを読む. |
障 1 byte 若帥茯. |
そのあと |
|
1 byte のデータを書き出し flush する. |
1 byte 若帥吾冴 flush . |
1 byte のデータは, |
1 byte 若帥, |
{\tt 0}, {\tt 1}, {\tt FF} のどれかであり, |
{\tt 0}, {\tt 1}, {\tt FF} с, |
{\tt 0} は以下の通信において {\tt int32} をおくるのに, |
{\tt 0} 篁ヤ篆< {\tt int32} , |
network byte order を使用したい, |
network byte order 篏睡, |
{\tt 1} は以下の通信において {\tt int32} をおくるのに, |
{\tt 1} 篁ヤ篆< {\tt int32} , |
little endian を使用したい, |
little endian 篏睡, |
{\tt FF} は以下の通信において {\tt int32} をおくるのに, |
{\tt FF} 篁ヤ篆< {\tt int32} , |
big endian を使用したい, |
big endian 篏睡, |
という意味である. |
潟с. |
両者の希望が一致しない場合はつねに {\tt 0} (network byte order) |
筝∴絽筝眼翫ゃ {\tt 0} (network byte order) |
を使用する. |
篏睡. |
Network byte order しか実装していないシステムでは, |
Network byte order 絎茖激鴻с, |
{\tt 0} をおくればよい. |
{\tt 0} 違. |
ただし効率が問題となる通信において, network byte order への変換は |
合馹篆<, network byte order 吾紊 |
おおきなボトルネックとなることがあることを了解しておくべきである. |
篋茹c鴻с. |
|
|
|
64 bit machine double 128 bit machine double (羌絨亥号) |
|
, |
|
筝罕号<. |
|
{\tt double64 *} {\tt int32 *} c鴻, |
|
筝荳 {\tt int32} 罕号ч篆<. |
|
箴ゃ {\tt CMO\_64BIT\_MACHINE\_DOUBLE} 荀. |
*/ |
*/ |
/*&eg |
/*&eg |
A client and a server exchanges one byte data soon after |
A client and a server exchange one byte data soon after |
the communication has started as follows. |
the communication has started as follows. |
|
|
\begin{itemize} |
\begin{itemize} |
Line 113 The one byte data is {\tt 0}, {\tt 1} or {\tt 0xFF}. |
|
Line 120 The one byte data is {\tt 0}, {\tt 1} or {\tt 0xFF}. |
|
{\tt 0} means that one wants to use the network byte order to |
{\tt 0} means that one wants to use the network byte order to |
send 16 or 32bit quantities. |
send 16 or 32bit quantities. |
{\tt 1} means that one wants to use the little endian order. |
{\tt 1} means that one wants to use the little endian order. |
{\tt 0xFF} means that one wants to use the little endian order. |
{\tt 0xFF} means that one wants to use the big endian order. |
On each side, if the preference coicides with each other then |
On each side, if the preference coincides with each other then |
the byte order is used. Otherwise the network byte order is used. |
the byte order is used. Otherwise the network byte order is used. |
|
|
If a system implements only the network byte order, then |
If a system implements only the network byte order, then |
it is sufficient to send always {\tt 0}. |
it is sufficient to send always {\tt 0}. |
However unnecessary byte order conversion may add large overhead |
However unnecessary byte order conversion may add large overhead |
and it is often a bottle-neck on fast networks. |
and it is often a bottle-neck on fast networks. |
|
|
|
In order to send and receive 64 bit machine double (floating point number) |
|
and 128 bit machine double, |
|
we use the same byte order. |
|
In other words, we cast {\tt double64 *} to {\tt int32 *} and |
|
send the array of 4 bytes by the same method with sending {\tt int32}. |
|
As to examples, see the section on {\tt CMO\_64BIT\_MACHINE\_DOUBLE}. |
*/ |
*/ |
|
|
\begin{verbatim} |
\begin{verbatim} |
Line 129 and it is often a bottle-neck on fast networks. |
|
Line 143 and it is often a bottle-neck on fast networks. |
|
#define OX_BYTE_BIG_ENDIAN 0xff |
#define OX_BYTE_BIG_ENDIAN 0xff |
\end{verbatim} |
\end{verbatim} |
|
|
//&jp \subsection{launcher の例 : {\tt ox}} |
//&jp \subsection{launcher 箴 : {\tt ox}} |
//&eg \subsection{An example of launcher : {\tt ox}} |
//&eg \subsection{An example of launcher : {\tt ox}} |
/*&jp |
/*&jp |
注意: {\tt OpenXM/src/kxx} に含まれる, {\tt ox} (コントロールプロセス, |
羈: {\tt OpenXM/src/kxx} 障, {\tt ox} (潟潟若祉, |
計算プロセスをたちあげるローンチャ)は, 標準で One Time Password |
荐膊祉鴻<若潟), 罔羣 One Time Password |
の機能をもっています. |
罘純c障. |
この機能を OFF にするには {\tt -insecure} option を使用して下さい. |
罘純 OFF {\tt -insecure} option 篏睡筝. |
One Time Password は 0 で終了するバイト列であり, |
One Time Password 0 х篋ゃс, |
コントロール, 計算双方のプロセスをたちあげるまえに, |
潟潟若, 荐膊鴻祉鴻<障, |
{\tt ox} はコントロール, 計算双方のプロセスに対応する, |
{\tt ox} 潟潟若, 荐膊鴻祉鴻絲上, |
ふたつのポートに |
泣ゃ若 |
One Time Password バイト列を送出しています. |
One Time Password ゃ冴障. |
|
|
{\tt ox} (ソースは {\tt oxmain.c}, {\tt kan96xx/plugin/oxmisc.c})においては |
{\tt ox} (純若鴻 {\tt oxmain.c}, {\tt kan96xx/plugin/oxmisc.c}) |
{\tt oxTellMyByteOrder()} が, サーバについての byte order 情報の |
{\tt oxTellMyByteOrder()} , 泣若ゃ byte order 宴 |
送出, 読み込みをやっている. |
, 茯粋昭帥c. |
クライアントについては, |
ゃ≪潟ゃ, |
{\tt oxSetByteOrder()} が, byte order 情報の読み込み, 送出をおこなっている. |
{\tt oxSetByteOrder()} , byte order 宴茯粋昭, 冴c. |
|
|
One time パスワードは安全な通信路で配送される必要があります. |
One time 鴻若絎篆∴君ч綽荀障. |
また, 現在の {\rm ox} の実装では, One time パスワードを |
障, 憜 {\rm ox} 絎茖с, One time 鴻若 |
サーバ, クライアントに login している人はすべて見ることが |
泣若, ゃ≪潟 login 篋冴鴻荀 |
できますので, サーバ, クライアントには悪意のある人はいないと |
с障, 泣若, ゃ≪潟篋冴 |
仮定しないといけません. |
篁絎障. |
One time パスワードを安全に配送し, リモートマシンの {\rm ox} |
One time 鴻若絎, ≪若激潟 {\rm ox} |
を立ち上げるには |
腴> |
たとえば |
|
{\tt ssh} を {\tt -f } オプションを用いて使用します. |
{\tt ssh} {\tt -f } 激с潟篏睡障. |
|
|
以下は {\rm sm1} での実装, 動作例です. |
篁ヤ {\rm sm1} с絎茖, 篏箴с. |
ここでは, {\tt yama} の {\tt sm1} より {\tt dc1} の {\tt ox} |
с, {\tt yama} {\tt sm1} {\tt dc1} {\tt ox} |
を立ち上げています. |
腴>障. |
*/ |
*/ |
/*&eg |
/*&eg |
\noindent |
\noindent |
Remark: {\tt ox}, included in {\tt OpenXM/src/kxx}, |
{\tt ox}, included in {\tt OpenXM/src/kxx}, |
is a launcher to invoke an engine. After invoking an |
is a launcher to invoke an engine. After invoking an |
engine, it acts as a control server. By default {\tt ox} requires |
engine, it acts as a control server. By default {\tt ox} requires |
a one time password. To skip it, use {\tt -insecure} option. |
a one time password. To skip it, use {\tt -insecure} option. |
A one time password is a null-terminated byte sequence and |
A one time password is a null-terminated byte sequence and |
a client informs the both a control server and an engine of |
a client informs both a control server and an engine of |
byte sequences as one time passwords. |
byte sequences as one time passwords. |
|
|
{\tt ox} is created from {\tt oxmain.c} and {\tt |
{\tt ox} is created from {\tt oxmain.c} and {\tt |
kan96xx/plugin/oxmisc.c}. In {\tt ox} {\tt oxTellMyByteOrder()} |
kan96xx/plugin/oxmisc.c}. In {\tt ox} \\ |
|
{\tt oxTellMyByteOrder()} |
executes the exchange of the byte order information. In a client it is |
executes the exchange of the byte order information. In a client it is |
done in {\tt oxSetByteOrder()}. |
done in {\tt oxSetByteOrder()}. |
|
|
One time passwords should be sent via secure communication channels. |
One time passwords should be sent via secure communication channels. |
Note that in the current implementation of {\rm ox}, one time passwords |
Note that in the current implementation of {\tt ox}, one time passwords |
are visible to all users logging in machines on which the server |
are visible to all users logging in machines on which the server |
and the client run, assuming that there is no evil person in the users. |
and the client run, assuming that there is no evil person among the users. |
One may use {\tt ssh} with {\tt -f } option when one wants to send |
One may use {\tt ssh} with {\tt -f } option when one wants to send |
a one time password securely to a remote machine. |
a one time password securely to a remote machine. |
|
|
The following example shows invocation of an {\tt ox\_sm1} |
The following example shows invocation of an {\tt ox\_sm1} |
server and the comminucation establishment on {\rm sm1}. |
server and the communication establishment on {\rm sm1}. |
In this example {\tt ox} on the host {\tt ox} is invoked from |
In this example {\tt ox} on the host {\tt dc1} is invoked from |
{\tt sm1} on the host {\tt yama}. |
{\tt sm1} on the host {\tt yama}. |
*/ |
*/ |
{\footnotesize |
{\footnotesize |
Line 217 Byte order for engine process is network byte order. |
|
Line 232 Byte order for engine process is network byte order. |
|
\end{verbatim} |
\end{verbatim} |
} |
} |
|
|
|
//&jp \subsection{OX 泣若箴} |
|
//&eg \subsection{Example of using OX servers} |
|
|
|
/*&jp |
|
ox 泣若 TCP/IP $C$ 箴 |
|
{\tt OpenXM/doc/oxlib/test1-tcp.c} . |
|
*/ |
|
/*&eg |
|
An sample C source code to use ox servers by TCP/IP can be found |
|
in {\tt OpenXM/doc/oxlib/test1-tcp.c}. |
|
*/ |