metaproxy  1.21.0
Public Member Functions | List of all members
metaproxy_1::filter::SD_Remove Class Reference
Inheritance diagram for metaproxy_1::filter::SD_Remove:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::SD_Remove:
Collaboration graph

Public Member Functions

 SD_Remove ()
 
 ~SD_Remove ()
 
void process (metaproxy_1::Package &package) const
 
void configure (const xmlNode *ptr, bool test_only, const char *path)
 

Detailed Description

Definition at line 29 of file filter_sd_remove.cpp.

Constructor & Destructor Documentation

◆ SD_Remove()

mp::filter::SD_Remove::SD_Remove ( )

Definition at line 43 of file filter_sd_remove.cpp.

44 {
45 }

◆ ~SD_Remove()

mp::filter::SD_Remove::~SD_Remove ( )

Definition at line 47 of file filter_sd_remove.cpp.

48 {
49 }

Member Function Documentation

◆ configure()

void mp::filter::SD_Remove::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 51 of file filter_sd_remove.cpp.

53 {
54  if (xmlnode)
55  {
56  xmlNode *ptr;
57  for (ptr = xmlnode->children; ptr; ptr = ptr->next)
58  {
59  if (ptr->type == XML_ELEMENT_NODE)
60  throw mp::filter::FilterException("Bad element "
61  + std::string((const char *)
62  ptr->name));
63  }
64  }
65 }

◆ process()

void mp::filter::SD_Remove::process ( metaproxy_1::Package &  package) const

Definition at line 86 of file filter_sd_remove.cpp.

87 {
88  package.move();
89 
90  Z_GDU *gdu_res = package.response().get();
91  if (gdu_res && gdu_res->which == Z_GDU_Z3950)
92  {
93  Z_NamePlusRecordList *records = 0;
94  Z_APDU *apdu = gdu_res->u.z3950;
95  if (apdu->which == Z_APDU_presentResponse)
96  {
97  Z_PresentResponse * pr_res = apdu->u.presentResponse;
98  if (pr_res->numberOfRecordsReturned
99  && *(pr_res->numberOfRecordsReturned) > 0
100  && pr_res->records
101  && pr_res->records->which == Z_Records_DBOSD)
102  {
103  records = pr_res->records->u.databaseOrSurDiagnostics;
104  }
105  }
106  if (apdu->which == Z_APDU_searchResponse)
107  {
108  Z_SearchResponse *sr_res = apdu->u.searchResponse;
109  if (
110  sr_res->numberOfRecordsReturned
111  && *(sr_res->numberOfRecordsReturned) > 0
112  && sr_res->records
113  && sr_res->records->which == Z_Records_DBOSD)
114  {
115  records = sr_res->records->u.databaseOrSurDiagnostics;
116  }
117  }
118  if (records)
119  {
120  mp::odr odr_en(ODR_ENCODE);
121  int i;
122  for (i = 0; i < records->num_records; i++)
123  {
124  Z_NamePlusRecord *npr = records->records[i];
125  if (npr->which == Z_NamePlusRecord_surrogateDiagnostic)
126  {
127  WRBUF w = wrbuf_alloc();
128  diagrec_to_sutrs(w, npr->u.surrogateDiagnostic);
129  npr->which = Z_NamePlusRecord_databaseRecord;
130  npr->u.databaseRecord = z_ext_record_sutrs(odr_en,
131  wrbuf_buf(w),
132  wrbuf_len(w));
133  wrbuf_destroy(w);
134  }
135  }
136  package.response() = gdu_res;
137  }
138  }
139 }
static void diagrec_to_sutrs(WRBUF b, Z_DiagRec *diag)

References diagrec_to_sutrs().

Here is the call graph for this function:

The documentation for this class was generated from the following file: