metaproxy  1.21.0
Classes | Namespaces | Functions | Variables
filter_zoom.cpp File Reference
#include "config.hpp"
#include <stdlib.h>
#include <sys/types.h>
#include "filter_zoom.hpp"
#include <metaproxy/package.hpp>
#include <metaproxy/util.hpp>
#include <metaproxy/xmlutil.hpp>
#include <yaz/comstack.h>
#include <yaz/poll.h>
#include "torus.hpp"
#include <libxslt/xsltutils.h>
#include <libxslt/transform.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <yaz/yaz-version.h>
#include <yaz/tpath.h>
#include <yaz/srw.h>
#include <yaz/ccl_xml.h>
#include <yaz/ccl.h>
#include <yaz/rpn2cql.h>
#include <yaz/rpn2solr.h>
#include <yaz/pquery.h>
#include <yaz/cql.h>
#include <yaz/oid_db.h>
#include <yaz/diagbib1.h>
#include <yaz/log.h>
#include <yaz/zgdu.h>
#include <yaz/querytowrbuf.h>
#include <yaz/sortspec.h>
#include <yaz/tokenizer.h>
#include <yaz/zoom.h>
#include <yaz/otherinfo.h>
#include <yaz/match_glob.h>
Include dependency graph for filter_zoom.cpp:

Go to the source code of this file.

Classes

class  metaproxy_1::filter::Zoom::Searchable
 
class  metaproxy_1::filter::Zoom::Backend
 
class  metaproxy_1::filter::Zoom::Frontend
 
class  metaproxy_1::filter::Zoom::Impl
 

Namespaces

 metaproxy_1
 
 metaproxy_1::filter
 

Functions

static xmlNode * xml_node_search (xmlNode *ptr, int *num, int m)
 
static bool match_element (const char *actual_element_set_name, const std::string &config_element)
 
static bool wait_conn (COMSTACK cs, int secs)
 
std::string escape_cql_term (std::string inp)
 
static mp::filter::Base * filter_creator ()
 

Variables

struct metaproxy_1_filter_struct metaproxy_1_filter_zoom
 

Function Documentation

◆ escape_cql_term()

std::string escape_cql_term ( std::string  inp)

Definition at line 2674 of file filter_zoom.cpp.

2675 {
2676  std::string res;
2677  size_t l = inp.length();
2678  size_t i;
2679  for (i = 0; i < l; i++)
2680  {
2681  if (strchr("*?^\"", inp[i]))
2682  res += "\\";
2683  res += inp[i];
2684  }
2685  return res;
2686 }

Referenced by metaproxy_1::filter::Zoom::Frontend::auth().

◆ filter_creator()

static mp::filter::Base* filter_creator ( )
static

Definition at line 2887 of file filter_zoom.cpp.

2888 {
2889  return new mp::filter::Zoom;
2890 }

◆ match_element()

static bool match_element ( const char *  actual_element_set_name,
const std::string &  config_element 
)
static

Definition at line 1628 of file filter_zoom.cpp.

1630 {
1631  if (config_element.length() == 0)
1632  return false;
1633  const char *cp = config_element.c_str();
1634  if (*cp == '?')
1635  {
1636  if (actual_element_set_name == 0)
1637  return true;
1638  cp++;
1639  }
1640  if (actual_element_set_name && !strcmp(cp, actual_element_set_name))
1641  return true;
1642  return false;
1643 }

Referenced by metaproxy_1::filter::Zoom::Frontend::prepare_elements().

◆ wait_conn()

static bool wait_conn ( COMSTACK  cs,
int  secs 
)
static

Definition at line 2169 of file filter_zoom.cpp.

2170 {
2171  struct yaz_poll_fd pfd;
2172 
2173  pfd.input_mask = yaz_poll_none;
2174  pfd.output_mask = yaz_poll_none;
2175  yaz_poll_add(pfd.input_mask, yaz_poll_except);
2176  if (cs->io_pending & CS_WANT_WRITE)
2177  yaz_poll_add(pfd.input_mask, yaz_poll_write);
2178  if (cs->io_pending & CS_WANT_READ)
2179  yaz_poll_add(pfd.input_mask, yaz_poll_read);
2180 
2181  pfd.fd = cs_fileno(cs);
2182  pfd.client_data = 0;
2183 
2184  int ret = yaz_poll(&pfd, 1, secs, 0);
2185  return ret > 0;
2186 }

Referenced by metaproxy_1::filter::Zoom::Impl::check_proxy().

◆ xml_node_search()

static xmlNode* xml_node_search ( xmlNode *  ptr,
int *  num,
int  m 
)
static

Definition at line 253 of file filter_zoom.cpp.

254 {
255  while (ptr)
256  {
257  if (ptr->type == XML_ELEMENT_NODE &&
258  !strcmp((const char *) ptr->name, "recordData"))
259  {
260  (*num)++;
261  if (m == *num)
262  return ptr;
263  }
264  else // else: we don't want to find nested nodes
265  {
266  xmlNode *ret_node = xml_node_search(ptr->children, num, m);
267  if (ret_node)
268  return ret_node;
269  }
270  ptr = ptr->next;
271  }
272  return 0;
273 }
static xmlNode * xml_node_search(xmlNode *ptr, int *num, int m)

Referenced by metaproxy_1::filter::Zoom::Frontend::explain_search(), and metaproxy_1::filter::Zoom::Frontend::get_explain_records().

Variable Documentation

◆ metaproxy_1_filter_zoom

struct metaproxy_1_filter_struct metaproxy_1_filter_zoom
Initial value:
= {
0,
"zoom",
}
static mp::filter::Base * filter_creator()

Definition at line 2887 of file filter_zoom.cpp.

Referenced by metaproxy_1::FactoryStatic::FactoryStatic().