version 1.1.1.1, 2000/01/20 08:52:46 |
version 1.9, 2020/03/14 01:21:57 |
|
|
%% $OpenXM$ |
%% $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} (This section has not yet been translated.) |
//&eg \section{How to start a session on TCP/IP} |
|
|
|
\subsection{Standard I/O on OX servers} |
|
|
/*&jp |
/*&jp |
コントロールプロセス, 計算プロセス |
泣若絎茖絎号, 泣若, 莎桁 file descriptor 3, |
ともに, 起動直後に |
4 ゃ≪潟ュ, ゃ≪潟吾阪 open |
1 byte のデータを書き出し flush する. |
篁絎. , 泣若篏篆<腴 socket |
そのあと, 1 byte のデータを読み込む. |
篏茵綽荀. 篏, OX message 合篆<, data |
クライアントはコントロールプロセス, 計算プロセス |
<潟違茵泣若眼莢篁祉с. UNIX , |
につながるファイルディスクリプタの両方から |
file descriptor 吾buffer attach {\tt fdopen()} ц |
まず 1 byte のデータを読む. |
. |
そのあと |
*/ |
1 byte のデータを書き出し flush する. |
|
1 byte のデータは, |
|
{\tt 0}, {\tt 1}, {\tt FF} のどれかであり, |
|
{\tt 0} は以下の通信において {\tt int32} をおくるのに, |
|
network byte order を使用したい, |
|
{\tt 1} は以下の通信において {\tt int32} をおくるのに, |
|
little endian を使用したい, |
|
{\tt FF} は以下の通信において {\tt int32} をおくるのに, |
|
big endian を使用したい, |
|
という意味である. |
|
両者の希望が一致しない場合はつねに {\tt 0} (network byte order) |
|
を使用する. |
|
Network byte order しか実装していないシステムでは, |
|
{\tt 0} をおくればよい. |
|
ただし効率が問題となる通信において, network byte order への変換は |
|
おおきなボトルネックとなることがあることを了解しておくべきである. |
|
|
|
|
/*&eg |
|
In order to make it easy to implement servers, one can assume that |
|
any server has two opened socket descriptors 3 and 4, |
|
which are for input from a client and for output to a client respectively. |
|
That is, servers do not have to do socket operations to establish |
|
connections. However servers are responsible for buffering data |
|
to exchange OX messages efficiently. Note that associating a buffered stream |
|
with a descriptor can be done by {\tt fdopen()}. |
|
*/ |
|
|
|
\subsection{Launcher} |
|
/*&jp |
|
泣若, ゃ≪潟莎桁, TCP/IP ・膓 socket |
|
紮障筝c篏綽荀с. 筝鴻, с菴違鴻, 泣若 |
|
篏罘純. launcher , 筝∴罘羝< application |
|
с. launcher 罨<с. |
|
|
|
\begin{enumerate} |
|
\item launcher ゃ≪潟莎桁. launcher 篏睡 port , |
|
泣若 application <ゃ篌. |
|
\item client 障 launcher 篆<腴. , one time password |
|
翫. |
|
\item launcher 違祉鴻莎桁, 祉鴻 client 篆 |
|
腴. , 篆∴君 file descriptor 3, 4 |
|
祉, 泣若 exec . |
|
\end{enumerate} |
|
|
|
篁ヤ篏, launcher 潟潟若泣若, 荳篏c |
|
泣若九勝茵. |
|
*/ |
|
/*&eg |
|
Though there need several socket operations to establish a |
|
connection over TCP/IP, servers do not have any functionality for |
|
connection establishment. |
|
An application called {\it launcher} is provided to start servers |
|
and to establish connections as follows. |
|
|
|
\begin{enumerate} |
|
\item A launcher is invoked from a client. |
|
When the launcher is invoked, the client |
|
informs the launcher of a port number for TCP/IP connection |
|
and the name of a server. |
|
\item The launcher and the client establish a connection with the |
|
specified port number. One time password may be used to prevent |
|
launcher spoofing. |
|
\item The launcher creates a process and establishes a connection |
|
to the client. Then the launcher arranges for the newly created descriptors |
|
to be 3 and 4, and executes the specified server. |
|
\end{enumerate} |
|
|
|
After finishing the above task as a launcher, the launcher process |
|
acts as a control server and controls the server process created by |
|
itself. |
|
*/ |
|
|
|
//&jp \subsection{byte order 羆阪} \label{subsection:byteorder} |
|
//&eg \subsection{Negotiation of the byte order} \label{subsection:byteorder} |
|
/*&jp |
|
潟潟若祉, 荐膊祉 |
|
, 莎桁翫 |
|
1 byte 若帥吾冴 flush . |
|
, 1 byte 若帥茯粋昭. |
|
ゃ≪潟潟潟若祉, 荐膊祉 |
|
ゃ<ゃc鴻帥筝≧鴻 |
|
障 1 byte 若帥茯. |
|
|
|
1 byte 若帥吾冴 flush . |
|
1 byte 若帥, |
|
{\tt 0}, {\tt 1}, {\tt FF} с, |
|
{\tt 0} 篁ヤ篆< {\tt int32} , |
|
network byte order 篏睡, |
|
{\tt 1} 篁ヤ篆< {\tt int32} , |
|
little endian 篏睡, |
|
{\tt FF} 篁ヤ篆< {\tt int32} , |
|
big endian 篏睡, |
|
潟с. |
|
筝∴絽筝眼翫ゃ {\tt 0} (network byte order) |
|
篏睡. |
|
Network byte order 絎茖激鴻с, |
|
{\tt 0} 違. |
|
合馹篆<, 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 |
|
A client and a server exchange one byte data soon after |
|
the communication has started as follows. |
|
|
|
\begin{itemize} |
|
\item The server writes one byte representing the preferable byte order |
|
to the client, |
|
then waits for one byte to come from the client. |
|
\item After reading the byte, the client writes one byte representing the |
|
preferable byte order to the server. |
|
\end{itemize} |
|
|
|
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 |
|
send 16 or 32bit quantities. |
|
{\tt 1} 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 coincides with each other then |
|
the byte order is used. Otherwise the network byte order is used. |
|
|
|
If a system implements only the network byte order, then |
|
it is sufficient to send always {\tt 0}. |
|
However unnecessary byte order conversion may add large overhead |
|
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} |
#define OX_BYTE_NETWORK_BYTE_ORDER 0 |
#define OX_BYTE_NETWORK_BYTE_ORDER 0 |
#define OX_BYTE_LITTLE_ENDIAN 1 |
#define OX_BYTE_LITTLE_ENDIAN 1 |
#define OX_BYTE_BIG_ENDIAN 0xff |
#define OX_BYTE_BIG_ENDIAN 0xff |
\end{verbatim} |
\end{verbatim} |
|
|
|
//&jp \subsection{launcher 箴 : {\tt ox}} |
|
//&eg \subsection{An example of launcher : {\tt ox}} |
|
/*&jp |
|
羈: {\tt OpenXM/src/kxx} 障, {\tt ox} (潟潟若祉, |
|
荐膊祉鴻<若潟), 罔羣 One Time Password |
|
罘純c障. |
|
罘純 OFF {\tt -insecure} option 篏睡筝. |
|
One Time Password 0 х篋ゃс, |
|
潟潟若, 荐膊鴻祉鴻<障, |
|
{\tt ox} 潟潟若, 荐膊鴻祉鴻絲上, |
|
泣ゃ若 |
|
One Time Password ゃ冴障. |
|
|
注意: {\tt OpenXM/src/kxx} に含まれる, {\tt ox} (コントロールプロセス, |
{\tt ox} (純若鴻 {\tt oxmain.c}, {\tt kan96xx/plugin/oxmisc.c}) |
計算プロセスをたちあげるローンチャ)は, 標準で One Time Password |
{\tt oxTellMyByteOrder()} , 泣若ゃ byte order 宴 |
の機能をもっています. |
, 茯粋昭帥c. |
この機能を OFF にするには {\tt -insecure} option を使用して下さい. |
ゃ≪潟ゃ, |
One Time Password は 0 で終了するバイト列であり, |
{\tt oxSetByteOrder()} , byte order 宴茯粋昭, 冴c. |
コントロール, 計算双方のプロセスをたちあげるまえに, |
|
{\tt ox} はコントロール, 計算双方のプロセスに対応する, |
|
ふたつのポートに |
|
One Time Password バイト列を送出しています. |
|
|
|
{\tt ox} (ソースは {\tt oxmain.c}, {\tt kan96xx/plugin/oxmisc.c})においては |
One time 鴻若絎篆∴君ч綽荀障. |
{\tt oxTellMyByteOrder()} が, サーバについての byte order 情報の |
障, 憜 {\rm ox} 絎茖с, One time 鴻若 |
送出, 読み込みをやっている. |
泣若, ゃ≪潟 login 篋冴鴻荀 |
クライアントについては, |
с障, 泣若, ゃ≪潟篋冴 |
{\tt oxSetByteOrder()} が, byte order 情報の読み込み, 送出をおこなっている. |
篁絎障. |
|
One time 鴻若絎, ≪若激潟 {\rm ox} |
|
腴> |
|
|
|
{\tt ssh} {\tt -f } 激с潟篏睡障. |
|
|
One time パスワードは安全な通信路で配送される必要があります. |
篁ヤ {\rm sm1} с絎茖, 篏箴с. |
また, 現在の {\rm ox} の実装では, One time パスワードを |
с, {\tt yama} {\tt sm1} {\tt dc1} {\tt ox} |
サーバ, クライアントに login している人はすべて見ることが |
腴>障. |
できますので, サーバ, クライアントには悪意のある人はいないと |
*/ |
仮定しないといけません. |
/*&eg |
One time パスワードを安全に配送し, リモートマシンの {\rm ox} |
\noindent |
を立ち上げるには |
{\tt ox}, included in {\tt OpenXM/src/kxx}, |
たとえば |
is a launcher to invoke an engine. After invoking an |
{\tt ssh} を {\tt -f } オプションを用いて使用します. |
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 is a null-terminated byte sequence and |
|
a client informs both a control server and an engine of |
|
byte sequences as one time passwords. |
|
|
以下は {\rm sm1} での実装, 動作例です. |
{\tt ox} is created from {\tt oxmain.c} and {\tt |
ここでは, {\tt yama} の {\tt sm1} より {\tt dc1} の {\tt ox} |
kan96xx/plugin/oxmisc.c}. In {\tt ox} \\ |
を立ち上げています. |
{\tt oxTellMyByteOrder()} |
|
executes the exchange of the byte order information. In a client it is |
|
done in {\tt oxSetByteOrder()}. |
|
|
|
One time passwords should be sent via secure communication channels. |
|
Note that in the current implementation of {\tt ox}, one time passwords |
|
are visible to all users logging in machines on which the server |
|
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 |
|
a one time password securely to a remote machine. |
|
|
|
The following example shows invocation of an {\tt ox\_sm1} |
|
server and the communication establishment on {\rm sm1}. |
|
In this example {\tt ox} on the host {\tt dc1} is invoked from |
|
{\tt sm1} on the host {\tt yama}. |
|
*/ |
{\footnotesize |
{\footnotesize |
\begin{verbatim} |
\begin{verbatim} |
yama% sm1 |
yama% sm1 |
Line 92 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}. |
|
*/ |