X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=doc%2Ffrontend.xml;h=19729e102d18fe8426b6ed10b889068c80fcdaad;hp=bc6f9786b5e3424b9db2851bd8286d96eb1f0436;hb=bd7e251dac1b07c54884d26295f66b90cfb23131;hpb=ce853cc4919ab346fd629e7727905d3ee6e1129f diff --git a/doc/frontend.xml b/doc/frontend.xml index bc6f978..19729e1 100644 --- a/doc/frontend.xml +++ b/doc/frontend.xml @@ -1,15 +1,12 @@ - - Making an IR Server for Your Database - + + Generic server Introduction If you aren't into documentation, a good way to learn how the - backend interface works is to look at the backend.h + back end interface works is to look at the backend.h file. Then, look at the small dummy-server in - ztest/ztest.c. Finally, you can have a look at - the seshigh.c file, which is where most of the - logic of the frontend server is located. The backend.h + ztest/ztest.c. The backend.h file also makes a good reference, once you've chewed your way through the prose of this file. @@ -35,18 +32,18 @@ The backend interface was designed in anticipation of a specific integration task, while still attempting to achieve some degree of - generality. We realise fully that there are points where the + generality. We realize fully that there are points where the interface can be improved significantly. If you have specific functions or parameters that you think could be useful, send us a mail (or better, sign on to the mailing list referred to in the - toplevel README file). We will try to fit good suggestions into future + top-level README file). We will try to fit good suggestions into future releases, to the extent that it can be done without requiring too many structural changes in existing applications. - - The Database Frontend + + The Database Frontend We refer to this software as a generic database frontend. Your @@ -86,7 +83,7 @@ Extended Services (optional). - + Result-Set Delete (optional). @@ -94,7 +91,7 @@ Result-Set Sort (optional). - + @@ -103,22 +100,22 @@ - The Backend API + The Backend API - The headers files that you need to use the interface are in the - include/yaz directory. They are called - statserv.h and backend.h. They - will include other files from the include/yaz - directory, so you'll probably want to use the -I option of your - compiler to tell it where to find the files. When you run - make in the toplevel &yaz; directory, - everything you need to create your server is put the - lib/libyaz.a library. + The header file that you need to use the interface are in the + include/yaz directory. It's called + backend.h. It will include other files from + the include/yaz directory, so you'll + probably want to use the -I option of your compiler to tell it + where to find the files. When you run + make in the top-level &yaz; directory, + everything you need to create your server is to link with the + lib/libyaz.la library. - Your main() Routine + Your main() Routine As mentioned, your main() routine can be quite brief. @@ -128,9 +125,9 @@ - int statserv_main(int argc, char **argv, - bend_initresult *(*bend_init)(bend_initrequest *r), - void (*bend_close)(void *handle)); +int statserv_main(int argc, char **argv, + bend_initresult *(*bend_init)(bend_initrequest *r), + void (*bend_close)(void *handle)); @@ -146,95 +143,115 @@ according to the parameters given. When connection requests are received, the event handler will typically fork() and create a sub-process to handle a new connection. - Alternatively the server may be setup to create threads for each connection. + Alternatively the server may be setup to create threads for each + connection. If you do use global variables and forking, you should be aware, then, that these cannot be shared between associations, unless you explicitly disable forking by command line parameters. - + The server provides a mechanism for controlling some of its behavior without using command-line options. The function - statserv_options_block *statserv_getcontrol(void); +statserv_options_block *statserv_getcontrol(void); - Will return a pointer to a struct statserv_options_block + will return a pointer to a struct statserv_options_block describing the current default settings of the server. The structure contains these elements: - + - int dynamic + + int dynamic A boolean value, which determines whether the server will fork on each incoming request (TRUE), or not (FALSE). Default is TRUE. This flag is only read by UNIX-based servers (WIN32 based servers doesn't fork). - - int threads + + + int threads A boolean value, which determines whether the server will create a thread on each incoming request (TRUE), or not (FALSE). - Default is FALSE. This flag is only read by UNIX-based servers that offer - POSIX Threads support. WIN32-based servers always operate in threaded mode. + Default is FALSE. This flag is only read by UNIX-based servers + that offer POSIX Threads support. + WIN32-based servers always operate in threaded mode. - - int inetd + + + int inetd A boolean value, which determines whether the server will operates under a UNIX INET daemon (inetd). Default is FALSE. - - int loglevel + + + int loglevel Set this by ORing the constants defined in include/yaz/yaz-log.h. - - char logfile[ODR_MAXNAME+1] + + + char logfile[ODR_MAXNAME+1] File for diagnostic output ("": stderr). - char apdufile[ODR_MAXNAME+1] + + + char apdufile[ODR_MAXNAME+1] - Name of file for logging incoming and outgoing APDUs ("": don't - log APDUs, "-": stderr). + Name of file for logging incoming and outgoing APDUs + ("": don't log APDUs, "-": + stderr). - char default_listen[1024] + + char default_listen[1024] Same form as the command-line specification of listener address. "": no default listener address. Default is to listen at "tcp:@:9999". You can only specify one default listener address in this fashion. - enum oid_proto default_proto; + + enum oid_proto default_proto; Either PROTO_SR or - PROTO_Z3950. Default is PROTO_Z39_50. + PROTO_Z3950. + Default is PROTO_Z39_50. - int idle_timeout; + + + int idle_timeout; Maximum session idletime, in minutes. Zero indicates no (infinite) timeout. Default is 120 minutes. - - int maxrecordsize; + + + int maxrecordsize; Maximum permissible record (message) size. Default - is 1Mb. This amount of memory will only be allocated if a client requests a - very large amount of records in one operation (or a big record). Set it - to a lower number - if you are worried about resource consumption on your host system. + is 1Mb. This amount of memory will only be allocated if a + client requests a very large amount of records in one operation + (or a big record). + Set it to a lower number if you are worried about resource + consumption on your host system. - char configname[ODR_MAXNAME+1] + + char configname[ODR_MAXNAME+1] Passed to the backend when a new connection is received. - char setuid[ODR_MAXNAME+1] + + char setuid[ODR_MAXNAME+1] Set user id to the user specified, after binding the listener addresses. - - - void (*bend_start)(struct statserv_options_block *p) + + + void (*bend_start)(struct statserv_options_block *p) + Pointer to function which is called after the command line options have been parsed - but before the server starts listening. @@ -246,17 +263,19 @@ When the server operates as an NT service this handler is called whenever the service is started. - - - void (*bend_stop)(struct statserv_options_block *p) - Pointer to function which is called whenver the server + + + void (*bend_stop)(struct statserv_options_block *p) + + Pointer to function which is called whenever the server has stopped listening for incoming connections. This function pointer has a default value of NULL in which case it isn't called. When the server operates as an NT service this handler is called whenever the service is stopped. - void *handle + + void *handle User defined pointer (default value NULL). This is a per-server handle that can be used to specify "user-data". Do not confuse this with the session-handle as returned by bend_init. @@ -270,9 +289,9 @@ a static area. You are allowed to change the contents of the structure, but the changes will not take effect before you call - + - void statserv_setcontrol(statserv_options_block *block); +void statserv_setcontrol(statserv_options_block *block); @@ -283,7 +302,7 @@ - The Backend Functions + The Backend Functions For each service of the protocol, the backend interface declares one or @@ -294,7 +313,7 @@ Init - bend_initresult (*bend_init)(bend_initrequest *r); +bend_initresult (*bend_init)(bend_initrequest *r); @@ -391,7 +410,7 @@ typedef struct bend_initresult Search and retrieve We now describe the handlers that are required to support search - - and retrieve. You must support two functions - one for seearch - and one + and retrieve. You must support two functions - one for search - and one for fetch (retrieval of one record). If desirable you can provide a third handler which is called when a present request is received which allows you to optimize retrieval of multiple-records. @@ -431,8 +450,8 @@ typedef struct { corresponding to the resultSetIndicator field in the protocol. num_bases/basenames is a length of/array of character pointers to the database names provided by the client. - The query is the full query structure as defined in the - protocol ASN.1 specification. + The query is the full query structure as defined in + the protocol ASN.1 specification. It can be either of the possible query types, and it's up to you to determine if you can handle the provided query type. Rather than reproduce the C interface here, we'll refer you to the @@ -496,8 +515,8 @@ typedef struct bend_fetch_rr { allocating space for structured data records. The stream will be reset when all records have been assembled, and the response package has been transmitted. - For unstructured data, the backend is responsible for maintaining a static - or dynamic buffer for the record between calls. + For unstructured data, the backend is responsible for maintaining a + static or dynamic buffer for the record between calls. @@ -552,7 +571,7 @@ typedef struct { oid_value format; /* One of the CLASS_RECSYN members */ Z_ReferenceId *referenceId;/* reference ID */ Z_RecordComposition *comp; /* Formatting instructions */ - ODR stream; /* encoding stream - memory source if required */ + ODR stream; /* encoding stream */ ODR print; /* printing stream */ bend_request request; bend_association association; @@ -583,7 +602,7 @@ typedef struct { Delete - For backends that supports delete of a result set only one handler + For back-ends that supports delete of a result set only one handler must be defined. @@ -604,8 +623,8 @@ typedef struct bend_delete_rr { - The delete set function definition is rather primitive, mostly because we - have had no practical need for it as of yet. If someone wants + The delete set function definition is rather primitive, mostly because + we have had no practical need for it as of yet. If someone wants to provide a full delete service, we'd be happy to add the extra parameters that are required. Are there clients out there that will actually delete sets they no longer need? @@ -651,7 +670,7 @@ typedef struct bend_scan_rr { - Application Invocation + Application Invocation The finished application has the following @@ -828,7 +847,7 @@ typedef struct bend_scan_rr { sgml-indent-step:1 sgml-indent-data:t sgml-parent-document: "yaz.xml" - sgml-local-catalogs: "../../docbook/docbook.cat" + sgml-local-catalogs: nil sgml-namecase-general:t End: -->