X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-my-server.cpp;h=b4678caf5d79b2cc8488a8b8f348f312942853a8;hb=805b4fdf7b70b0e9b298064f24ceff0c1d38e05b;hp=86ff26e5f9aca8a3b728fc9ca9927c76c154a552;hpb=7411ed6df7fc0b535f83503f73d70e80f390e295;p=yazpp-moved-to-github.git diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index 86ff26e..b4678ca 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -1,17 +1,19 @@ -/* - * Copyright (c) 1998-2001, Index Data. +/* This file is part of the yazpp toolkit. + * Copyright (C) 1998-2013 Index Data and Mike Taylor * See the file LICENSE for details. - * - * $Id: yaz-my-server.cpp,v 1.19 2005-06-25 15:53:19 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include -#include -#include -#include +#include +#include +#include +#include using namespace yazpp_1; @@ -43,7 +45,7 @@ public: Z_PresentResponse *presentResponse); void sr_record (const char *resultSetName, int position, - int *format, + Odr_oid *format, Z_RecordComposition *comp, Z_NamePlusRecord *namePlusRecord, Z_Records *records); @@ -123,7 +125,7 @@ void MyRetrieval::sr_present (Z_PresentRequest *presentRequest, void MyRetrieval::sr_record (const char *resultSetName, int position, - int *format, + Odr_oid *format, Z_RecordComposition *comp, Z_NamePlusRecord *namePlusRecord, Z_Records *records) @@ -131,8 +133,8 @@ void MyRetrieval::sr_record (const char *resultSetName, yaz_log (YLOG_LOG, "MyServer::recv_Z_record"); const char *rec = get_record(position); if (rec) - create_databaseRecord (odr_encode(), namePlusRecord, 0, - VAL_USMARC, rec, strlen(rec)); + create_databaseRecord(odr_encode(), namePlusRecord, 0, + yaz_oid_recsyn_usmarc, rec, strlen(rec)); else create_surrogateDiagnostics(odr_encode(), namePlusRecord, 0, YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, 0); @@ -191,16 +193,17 @@ int main(int argc, char **argv) char *arg; char *prog = *argv; const char *addr = "tcp:@:9999"; + const char *cert_fname = 0; char *apdu_log = 0; - + SocketManager mySocketManager; - + PDU_Assoc *my_PDU_Assoc = 0; - + MyServer *z = 0; int ret; - - while ((ret = options("a:v:T", argv, argc, &arg)) != -2) + + while ((ret = options("a:C:v:T", argv, argc, &arg)) != -2) { switch (ret) { @@ -210,6 +213,9 @@ int main(int argc, char **argv) case 'a': apdu_log = xstrdup(arg); break; + case 'C': + cert_fname = xstrdup(arg); + break; case 'v': yaz_log_init_level (yaz_log_mask_str(arg)); break; @@ -229,7 +235,9 @@ int main(int argc, char **argv) #else my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #endif - + + my_PDU_Assoc->set_cert_fname(cert_fname); + z = new MyServer(my_PDU_Assoc); z->server(addr); if (apdu_log) @@ -246,6 +254,7 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab