% -*- LaTeX -*-		(really SLiTeX)

\begin{bwslide}
\part	{DYNAMIC FACILITIES}\bf

\begin{nrtc}
\item	RUN-TIME ENVIRONMENT

\item	BOILERPLATE FOR INITIATORS

\item	BOILERPLATE FOR RESPONDERS

\item	DEFINING A NEW SERVICE
\end{nrtc}
\end{bwslide}


\begin{note}\em
this part of the presentation corresponds to part~iv along with section~3.1
of The Applications Cookbook
\end{note}


\begin{bwslide}
\ctitle	{DYNAMIC FACILITIES\\ OVERVIEW}

\vskip.15in
\diagram[p]{figure10}
\end{bwslide}


\begin{bwslide}
\part*	{RUN-TIME ENVIRONMENT}\bf

\begin{nrtc}
\item	RUN-TIME ENVIRONMENT RESPONSIBLE FOR ``CIVILIZING'' REMOTE OPERATIONS
	SERVICE

\item	IMPORTANT TRADE-OFF:
    \begin{nrtc}
    \item	FLEXIBILITY FOR SIMPLICITY
    \end{nrtc}

\item	IN \emph{THE COOKBOOK}, \verb"ROSYLIB" IMPLEMENTS THE RUN-TIME
	ENVIRONMENT
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{DATA STRUCTURES}

\begin{nrtc}
\item	RECALL THAT ROSY GENERATES TABLES IN ADDITION TO STUBS

\item	FOR EACH OPERATION, A TABLE IS DEFINED CONTAINING:
    \begin{nrtc}
    \item	NAME AND NUMBER OF OPERATION

    \item	ARGUMENT ENCODE/DECODE ROUTINES

    \item	RESULT ENCODE/DECODE/FREE ROUTINES

    \item	ERROR TABLE
    \end{nrtc}
\end{nrtc}\small

\begin{verbatim}
    ...

                                        /* OPERATION m-ConfirmedEventReport */
    "m-ConfirmedEventReport", operation_CMIP_m__ConfirmedEventReport,
        encode_CMIP_m__ConfirmedEventReport_argument,
        decode_CMIP_m__ConfirmedEventReport_argument,
        1, encode_CMIP_m__ConfirmedEventReport_result,
           decode_CMIP_m__ConfirmedEventReport_result,
           free_CMIP_m__ConfirmedEventReport_result,
        errors_CMIP_m__ConfirmedEventReport,

    ...
\end{verbatim}
\end{bwslide}


\begin{bwslide}
\ctitle	{DATA STRUCTURES (cont.)}

\begin{nrtc}
\item	FOR EACH ERROR, A TABLE IS DEFINED CONTAINING:
    \begin{nrtc}
    \item	NAME AND NUMBER OF ERROR

    \item	PARAMETER ENCODE/DECODE/FREE ROUTINES
    \end{nrtc}
\end{nrtc}\small

\begin{verbatim}
    ...

                                        /* ERROR noSuchObject */
    "noSuchObject", error_CMIP_noSuchObject,
        encode_CMIP_noSuchObject_parameter,
        decode_CMIP_noSuchObject_parameter,
        free_CMIP_noSuchObject_parameter,

    ...
\end{verbatim}
\end{bwslide}


\begin{bwslide}
\ctitle	{A TABLE-DRIVEN APPROACH}

\begin{nrtc}
\item	RUN-TIME ENVIRONMENT SHOULD BE GENERALIZED TO WORK WITH THE LARGEST
	POSSIBLE SET OF APPLICATIONS USING REMOTE OPERATIONS

\item	A TABLE-DRIVEN APPROACH PERMITS US TO DECOUPLE OPERATION-SPECIFIC
	INFORMATION
    \begin{nrtc}
    \item	WHAT ARGUMENTS REPRESENTED, HOW THEY ARE ENCODED, etc.
    \end{nrtc}
	FROM OPERATION-GENERIC INFORMATION
    \begin{nrtc}
    \item	THE OPERATION TAKES ARGUMENTS WHICH MUST BE ENCODED, etc.
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{STUBS REVISITED}

\begin{nrtc}
\item	STUBS DEFINED BY ROSY CALL EITHER THE \verb"RyOperation" OR THE
	\verb"RyStub" ROUTINE

\item	THE \verb"RyOperation" ROUTINE IMPLEMENTS A ``POLICY''
    \begin{nrtc}
    \item	OPERATION CLASS: SYNCHRONOUS

    \item	INVOCATION IDENTIFIER: UNIQUE NUMBER

    \item	LINKED-INVOCATION ID: NONE

    \item	PRIORITY: NONE
    \end{nrtc}

\item	THE \verb"RyStub" ROUTINE IMPLEMENTS A LESS RESTRICTIVE POLICY:
    \begin{nrtc}
    \item	USER SELECTS OPERATION CLASS AND INVOCATION IDENTIFIER
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS STUBS}

\begin{nrtc}
\item	RECALL
{\small
\begin{verbatim}
#define stub_CMIP_m__ConfirmedEventReport(sd,id,in,rfx,efx,class,roi) \
RyStub ((sd), table_CMIP_Operations, \
        operation_CMIP_m__ConfirmedEventReport, (id), \
        (caddr_t) (in), (rfx), (efx), (class), (roi))
\end{verbatim}}

\item	THE MEANING OF THE PARAMETERS:
    \begin{nrtc}
    \item	\verb"sd": ASSOCIATION-DESCRIPTOR

    \item	\verb"id": INVOCATION IDENTIFIER

    \item	\verb"in": ARGUMENT FOR OPERATION

    \item	\verb"rfx": DISPATCH ROUTINE FOR RESULT

    \item	\verb"efx": DISPATCH ROUTINE FOR ERRORS OR REJECTIONS

    \item	\verb"class": (A)SYNCHRONOUS

    \item	\verb"roi": LOCAL SERVICE INTERFACE INFORMATION
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{INSIDE RYSTUB}

\begin{nrtc}
\item	RUDIMENTARY PARAMETER CHECK

\item	BUILD PRESENTATION ELEMENT FOR ARGUMENT

\item	BUILD \emph{ACTIVATION BLOCK}

\item	ISSUE RO-INVOKE.REQUEST

\item	IF ASYNCHRONOUS, RETURN

\item	LOOP, WAITING FOR ANY RESPONSE:
    \begin{nrtc}
    \item	RO-INVOKE.INDICATION:
	\begin{nrtc}
	\item	 PUSH ACTIVATION BLOCK FOR DISPATCHING OPERATION
	\end{nrtc}

    \item	RO-RESULT, ERROR, OR REJECTION.INDICATION:
	\begin{nrtc}
	\item	PARSE OPERATION RESULT OR ERROR PARAMETER AND CALL DISPATCH
		ROUTINE
\begin{verbatim}
result = (*fnx) (sd, id, reason, value, roi);
\end{verbatim}

	\item	IF RESPONSE WAS FOR US, RETURN
	\end{nrtc}
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{SYNCHRONOUS STUBS}

\begin{nrtc}
\item	RECALL
\begin{verbatim}
#define op_CMIP_m__ConfirmedEventReport(sd,in,out,rsp,roi) \
RyOperation ((sd), table_CMIP_Operations, \
        operation_CMIP_m__ConfirmedEventReport, \
        (caddr_t) (in), (out), (rsp), (roi))
\end{verbatim}

\item	THE MEANING OF THE PARAMETERS:
    \begin{nrtc}
    \item	\verb"sd": ASSOCIATION-DESCRIPTOR

    \item	\verb"in": ARGUMENT FOR OPERATION

    \item	\verb"out": RESULT FOR OPERATION OR PARAMETER FOR ERROR

    \item	\verb"rsp": TELLS HOW TO INTERPRET \verb"out"

    \item	\verb"roi": REJECTION INFORMATION FOR OPERATION
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{INSIDE RYOPERATION}

\begin{nrtc}
\item	RUDIMENTARY PARAMETER CHECK

\item	BUILD PRESENTATION ELEMENT FOR ARGUMENT

\item	BUILD \emph{ACTIVATION BLOCK}

\item	ISSUE RO-INVOKE.REQUEST

\item	LOOP, WAITING FOR SOME RESPONSE:
    \begin{nrtc}
    \item	RO-INVOKE.INDICATION:
	\begin{nrtc}
	\item	 PUSH ACTIVATION BLOCK FOR DISPATCHING OPERATION
	\end{nrtc}

    \item	RO-RESULT, ERROR, OR REJECTION.INDICATION:
	\begin{nrtc}
	\item	IF FOR US: PARSE OPERATION RESULT OR ERROR PARAMETER AND RETURN

	\item	IF NOT FOR US: STUFF INFORMATION INTO CORRESPONDING ACTIVATION
		BLOCK
	\end{nrtc}
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{RESPONDERS}

\begin{nrtc}
\item	REGISTER A DISPATCH ROUTINE FOR EACH OPERATION USING \verb"RyDispatch"
\begin{verbatim}
RyDispatch (sd, ryo, op, fnx, roi)
\end{verbatim}

\item	THE MEANING OF THE PARAMETERS:
    \begin{nrtc}
    \item	\verb"sd": ASSOCIATION-DESCRIPTOR

    \item	\verb"ryo": OPERATION TABLE

    \item	\verb"op": OPERATION NUMBER

    \item	\verb"fnx": DISPATCH ROUTINE

    \item	\verb"roi": FAILURE INDICATOR
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{OPERATION DISPATCH}

\begin{nrtc}
\item	WHILE WAITING FOR ``SOMETHING TO HAPPEN'', A RO-INVOKE.INDICATION
	CAUSES AN ACTIVATION BLOCK TO BE PUSHED

\item	THE PRESENTATION ELEMENT FOR THE ARGUMENT IS PARSED INTO A STRUCTURE
	AND THE DISPATCH ROUTINE IS CALLED:
\begin{verbatim}
result = (*fnx) (sd, ryo, rox, in, roi)    
\end{verbatim}

\item	DISPATCH ROUTINE HAS THREE OPTIONS
    \begin{nrtc}
    \item	\verb"RyDsResult": TO RETURN A RESULT

    \item	\verb"RyDsError": TO RETURN AN ERROR

    \item	\verb"RyDsUReject": TO REJECT AN OPERATION
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{CLEAN-UP}

\begin{nrtc}
\item	WHEN AN ASSOCIATION IS ABORTED (e.g., DUE TO NETWORK FAILURE),
	SOMETHING MUST BE DONE WITH ACTIVATION BLOCKS

\item	IDEALLY, WOULD LIKE TO:
    \begin{nrtc}
    \item	RETAIN THIS STATE,

    \item	RE-ESTABLISH THE ASSOCIATION, AND

    \item	CONTINUE WHERE WE LEFT OFF
    \end{nrtc}

\item	NO SUCH LUCK, ACTIVATION BLOCKS ARE FLUSHED!
    \begin{nrtc}
    \item	A LOT OF HARD ISSUES NEED TO BE RESOLVED IN ORDER TO DO THE
		``RIGHT THING''

    \item	ACTUALLY, FOR ASYNCHRONOUS INVOCATIONS, A REJECTION IS
		PASSED UP
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\part*	{BOILERPLATE FOR INITIATORS}\bf

\begin{nrtc}
\item	THE PROBLEM WITH BOILERPLATE IS THAT IT'S BORING

\item	SO, WE'LL CONSIDER ONLY THE HIGHLIGHTS
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{INVOKING AN OPERATION}

\begin{nrtc}
\item	ALTHOUGH \emph{THE COOKBOOK} TRIED TO MAKE THINGS SIMPLE,
	CALLING A STUB IS NOT EASY
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS INVOCATION}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure21\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure32\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure22\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure31\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{ASYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure33\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{SIMPLIFIED ASYNCHRONOUS INVOCATION}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure34\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{SYNCHRONOUS INVOCATION}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure15\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{SYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure16\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{SYNCHRONOUS INVOCATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure17\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\part*	{BOILERPLATE FOR RESPONDERS}\bf

\begin{nrtc}
\item	THE PROBLEM WITH BOILERPLATE IS THAT IT'S BORING

\item	SO, WE'LL CONSIDER ONLY THE HIGHLIGHTS
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{RESPONDING TO AN OPERATION}

\begin{nrtc}
\item	WHEN AN ACTIVATION BLOCK IS PUSHED,
	THE DISPATCH ROUTINE IS CALLED
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{RESPONDING TO AN OPERATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure18\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{RESPONDING TO AN OPERATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure19\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\ctitle	{RESPONDING TO AN OPERATION (cont.)}\small

\hrule\vskip.15in
\begin{tgrind}
\let\linebox=\relax
\def\_{\ifstring{\char'137}\else\underline{\ }\fi}
\input figure20\relax
\end{tgrind}
\end{bwslide}


\begin{bwslide}
\part*	{DEFINING A NEW SERVICE}\bf

\begin{nrtc}
\item	FINALLY, NEED TO IDENTIFY THE APPLICATION TO THE NETWORK

\item	THINGS TO BE DEFINED:
    \begin{nrtc}
    \item	ABSTRACT SYNTAX

    \item	APPLICATION CONTEXT NAME

    \item	APPLICATION ENTITY TITLE

    \item	PRESENTATION ADDRESS

    \item	LOCAL PROGRAM
    \end{nrtc}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{ABSTRACT SYNTAX}

\begin{nrtc}
\item	DESCRIBES THE DATA STRUCTURES BEING EXCHANGED BY THE SERVICE

\item	DEFINED IN THE \verb"isobjects(5)" FILE:
\begin{verbatim}
"ips-osi-mips cmip pci"    1.0.9596.2.1.1
\end{verbatim}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{APPLICATION CONTEXT NAME}

\begin{nrtc}
\item	DESCRIBES THE ELEMENTS AND PROTOCOL BEING USED BY THE SERVICE

\item	DEFINED IN THE \verb"isobjects(5)" FILE:
\begin{verbatim}
"iso cmip"    1.0.9596.2.2.1
\end{verbatim}
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{NAMES AND ADDRESSES}

\begin{nrtc}
\item	APPLICATION ENTITY TITLE UNIQUELY NAMES AN ENTITY IN THE NETWORK

\item	PRESENTATION ADDRESS LOCATES AN ENTITY IN THE NETWORK

\item	DEFINED IN THE \verb"isoentities(5)" FILE:
\begin{verbatim}
gonzo-noc mgmtinfobase    1.17.4.1.9    ""    ""    #519
                          NS 49000002608c456561fe04
                          X.25 23422233939909
\end{verbatim}

\item	USED BY INITIATORS AND STATIC RESPONDERS (MULTIPLE ASSOCIATION)
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{LOCAL PROGRAM}

\begin{nrtc}
\item	IDENTIFIES THE PROGRAM ON THE LOCAL SYSTEM WHICH IMPLEMENTS THE SERVICE

\item	DEFINED IN THE \verb"isoservices(5)" FILE:
\begin{verbatim}
"tsap/cmip"    #519    /usr/etc/ros.cmip args...
\end{verbatim}

\item	USED BY LISTENER TO FIND DYNAMIC RESPONDERS (SINGLE ASSOCIATION)
\end{nrtc}
\end{bwslide}


\begin{bwslide}
\ctitle	{DYNAMIC FACILITIES:\\ REVIEW}

\vskip.15in
\diagram[p]{figure10}
\end{bwslide}
