Three special types,
recognized in declarations in this section. They are fully explained in
the Special Types section.
The second section contains the network functions whose argument lists are modified to work across the network. Functions here must be declared ANSI C style on one line. The body of each function will be passed, unchanged, to the server section of the generated code. The opening brace must be on the line following the prototype.
int search(SRCH *sr)
/* perform the actual search */
NCG will create local and network versions for each function. The local
version will be named and work exactly as defined. The network version
will be prefixed by "
n_" and will require a leading extra argument
SERVER *) to specify what opened server to talk to.
SERVER is a
structure type placed into the generated header and code by NCG and will
be explained later. The prototypes for the example above would be:
int search(SRCH *sr);
int n_search(SERVER *se,SRCH *sr);
When the client program calls
n_search(), its arguments will be packaged
and sent to the server which will unpackage the arguments and pass them
to the real
search(). The return value from
search() will then be sent
back to the client.
Functions to be included in the generated header but not made into
network versions may be declared with "
extern" and the ANSI C prototype.
extern char *urlfn(char *url);
Structures to be passed between client and server are declared as normal
C structures except that they are named with an uppercase name instead
of the keyword "
struct" followed by a name. The opening brace must be
on the line following the structure name.
The generated header will contain definitions for "
SRCHPN is a shorthand for a
pointer to type
SRCH. The definitions will be as follows:
#define SRCH struct net_SRCH
#define SRCHPN (SRCH *)NULL
Structures passed between client and server by pointer, not value, must be declared with "extern" before being referenced.
Pointed to types, other than the structures defined in section two, are not transferred between client and server. Their pointers are transferred back and forth, but are only valid on the end that they originated on. A pointer to a client variable is not valid on the server and a pointer to a server variable is not valid on the client.