1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2013 Index Data
3 * See the file LICENSE for details.
7 * \brief Decoding of diagnostics embedded in init response
13 #include <yaz/proto.h>
15 static Z_DefaultDiagFormat *interpret_init_diag2(int *no,
16 Z_DiagnosticFormat *diag)
19 for (i = 0; i < diag->num; i++)
21 Z_DiagnosticFormat_s *ds = diag->elements[i];
22 if (ds->which == Z_DiagnosticFormat_s_defaultDiagRec)
25 return ds->u.defaultDiagRec;
32 Z_DefaultDiagFormat *yaz_decode_init_diag(int no, Z_InitResponse *initrs)
34 Z_External *uif = initrs->userInformationField;
35 if (uif && uif->which == Z_External_userInfo1)
38 Z_OtherInformation *ui = uif->u.userInfo1;
39 for (i = 0; i < ui->num_elements; i++)
41 Z_OtherInformationUnit *unit = ui->list[i];
42 if (unit->which == Z_OtherInfo_externallyDefinedInfo &&
43 unit->information.externallyDefinedInfo &&
44 unit->information.externallyDefinedInfo->which ==
47 Z_DefaultDiagFormat *r =
49 (&no, unit->information.externallyDefinedInfo->u.diag1);
60 * c-file-style: "Stroustrup"
61 * indent-tabs-mode: nil
63 * vim: shiftwidth=4 tabstop=8 expandtab