YAZ  5.23.1
zes-admin.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/zes-admin.h>
11 
12 int z_AdminEsRequest(ODR o, Z_AdminEsRequest **p, int opt, const char *name)
13 {
14  if (!odr_sequence_begin(o, p, sizeof(**p), name))
15  return odr_missing(o, opt, name) && odr_ok (o);
16  return
18  &(*p)->toKeep, ODR_CONTEXT, 1, 0, "toKeep") &&
20  &(*p)->notToKeep, ODR_CONTEXT, 2, 0, "notToKeep") &&
22 }
23 
24 int z_AdminTaskPackage(ODR o, Z_AdminTaskPackage **p, int opt, const char *name)
25 {
26  if (!odr_sequence_begin(o, p, sizeof(**p), name))
27  return odr_missing(o, opt, name) && odr_ok (o);
28  return
30  &(*p)->originPart, ODR_CONTEXT, 1, 0, "originPart") &&
32  &(*p)->targetPart, ODR_CONTEXT, 2, 0, "targetPart") &&
34 }
35 
36 int z_Admin(ODR o, Z_Admin **p, int opt, const char *name)
37 {
38  static Odr_arm arm[] = {
40  (Odr_fun) z_AdminEsRequest, "esRequest"},
42  (Odr_fun) z_AdminTaskPackage, "taskPackage"},
43  {-1, -1, -1, -1, (Odr_fun) 0, 0}
44  };
45  if (!odr_initmember(o, p, sizeof(**p)))
46  return odr_missing(o, opt, name);
47  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
48  return 1;
49  if (o->direction == ODR_DECODE)
50  *p = 0;
51  return odr_missing(o, opt, name);
52 }
53 
55 {
56  static Odr_arm arm[] = {
58  (Odr_fun) odr_null, "reIndex"},
60  (Odr_fun) odr_null, "truncate"},
62  (Odr_fun) odr_null, "drop"},
64  (Odr_fun) odr_null, "create"},
66  (Odr_fun) z_ImportParameters, "import"},
68  (Odr_fun) odr_null, "refresh"},
70  (Odr_fun) odr_null, "commit"},
72  (Odr_fun) odr_null, "shutdown"},
74  (Odr_fun) odr_null, "start"},
75  {-1, -1, -1, -1, (Odr_fun) 0, 0}
76  };
77  if (!odr_sequence_begin(o, p, sizeof(**p), name))
78  return odr_missing(o, opt, name) && odr_ok (o);
79  return
80  odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, "action") &&
81  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
84  &(*p)->databaseName, ODR_CONTEXT, 2, 1, "databaseName") &&
86 }
87 
89 {
90  static Odr_arm arm[] = {
92  (Odr_fun) z_Segment, "records"},
94  (Odr_fun) odr_null, "recordsWillFollow"},
95  {-1, -1, -1, -1, (Odr_fun) 0, 0}
96  };
97  if (!odr_initmember(o, p, sizeof(**p)))
98  return odr_missing(o, opt, name);
99  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
100  return 1;
101  if (o->direction == ODR_DECODE)
102  *p = 0;
103  return odr_missing(o, opt, name);
104 }
105 
106 int z_ESAdminTargetPart(ODR o, Z_ESAdminTargetPart **p, int opt, const char *name)
107 {
108  if (!odr_sequence_begin(o, p, sizeof(**p), name))
109  return odr_missing(o, opt, name) && odr_ok (o);
110  return
112  &(*p)->updateStatus, ODR_CONTEXT, 1, 0, "updateStatus") &&
114  (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->globalDiagnostics,
115  &(*p)->num_globalDiagnostics, "globalDiagnostics") || odr_ok(o)) &&
116  odr_sequence_end(o);
117 }
118 
119 int z_ImportParameters(ODR o, Z_ImportParameters **p, int opt, const char *name)
120 {
121  if (!odr_sequence_begin(o, p, sizeof(**p), name))
122  return odr_missing(o, opt, name) && odr_ok (o);
123  return
125  &(*p)->recordType, ODR_CONTEXT, 1, 0, "recordType") &&
126  odr_sequence_end(o);
127 }
#define odr_ok(o)
Definition: odr.h:215
int z_Admin(ODR o, Z_Admin **p, int opt, const char *name)
Definition: zes-admin.c:36
#define odr_explicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:195
int z_ESAdminOriginPartToKeep(ODR o, Z_ESAdminOriginPartToKeep **p, int opt, const char *name)
Definition: zes-admin.c:54
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
char * name
Definition: initopt.c:18
#define Z_ESAdminOriginPartToKeep_create
Definition: zes-admin.h:77
#define Z_Admin_taskPackage
Definition: zes-admin.h:58
int z_Segment(ODR o, Z_Segment **p, int opt, const char *name)
Definition: z-core.c:518
#define Z_ESAdminOriginPartToKeep_truncate
Definition: zes-admin.h:75
int odr_constructed_begin(ODR o, void *xxp, int zclass, int tag, const char *name)
Definition: odr_cons.c:24
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
#define Z_ESAdminOriginPartNotToKeep_records
Definition: zes-admin.h:92
int direction
Definition: odr.h:126
#define Z_ESAdminOriginPartToKeep_shutdown
Definition: zes-admin.h:81
#define Z_ESAdminOriginPartToKeep_reIndex
Definition: zes-admin.h:74
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
#define Z_Admin_esRequest
Definition: zes-admin.h:57
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int z_ImportParameters(ODR o, Z_ImportParameters **p, int opt, const char *name)
Definition: zes-admin.c:119
#define ODR_EXPLICIT
Definition: odr.h:60
int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num, const char *name)
Definition: odr_seq.c:134
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int z_AdminTaskPackage(ODR o, Z_AdminTaskPackage **p, int opt, const char *name)
Definition: zes-admin.c:24
int which
Definition: odr.h:142
Definition: odr.h:137
#define Z_ESAdminOriginPartToKeep_commit
Definition: zes-admin.h:80
int z_AdminEsRequest(ODR o, Z_AdminEsRequest **p, int opt, const char *name)
Definition: zes-admin.c:12
int odr_null(ODR o, Odr_null **p, int opt, const char *name)
Definition: odr_null.c:19
int z_DiagRec(ODR o, Z_DiagRec **p, int opt, const char *name)
Definition: z-core.c:637
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int opt
Definition: initopt.c:19
#define Z_ESAdminOriginPartToKeep_import
Definition: zes-admin.h:78
#define ODR_IMPLICIT
Definition: odr.h:59
#define Z_ESAdminOriginPartToKeep_refresh
Definition: zes-admin.h:79
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
int z_ESAdminTargetPart(ODR o, Z_ESAdminTargetPart **p, int opt, const char *name)
Definition: zes-admin.c:106
ASN.1 Module ESFormat-Admin.
#define Z_ESAdminOriginPartToKeep_start
Definition: zes-admin.h:82
#define Z_ESAdminOriginPartToKeep_drop
Definition: zes-admin.h:76
int odr_constructed_end(ODR o)
Definition: odr_cons.c:148
#define ODR_CONTEXT
Definition: odr.h:67
#define Z_ESAdminOriginPartNotToKeep_recordsWillFollow
Definition: zes-admin.h:93
#define ODR_DECODE
Definition: odr.h:95
int odr_implicit_settag(ODR o, int zclass, int tag)
Definition: odr_tag.c:32
int z_ESAdminOriginPartNotToKeep(ODR o, Z_ESAdminOriginPartNotToKeep **p, int opt, const char *name)
Definition: zes-admin.c:88