metaproxy 1.22.1
Classes | Public Member Functions | Private Attributes | List of all members
metaproxy_1::filter::Bounce Class Reference

#include <filter_bounce.hpp>

Inheritance diagram for metaproxy_1::filter::Bounce:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::Bounce:
Collaboration graph

Classes

class  Rep
 

Public Member Functions

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

Private Attributes

boost::scoped_ptr< Repm_p
 

Detailed Description

Definition at line 31 of file filter_bounce.hpp.

Constructor & Destructor Documentation

◆ Bounce()

mp::filter::Bounce::Bounce ( )

Definition at line 47 of file filter_bounce.cpp.

47 : m_p(new Rep)
48{
49 m_p->echo = false;
50}
boost::scoped_ptr< Rep > m_p

References m_p.

◆ ~Bounce()

mp::filter::Bounce::~Bounce ( )

Definition at line 52 of file filter_bounce.cpp.

53{ // must have a destructor because of boost::scoped_ptr to m_p
54}

Member Function Documentation

◆ configure()

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

Definition at line 126 of file filter_bounce.cpp.

128{
129 for (ptr = ptr->children; ptr; ptr = ptr->next)
130 {
131 if (ptr->type != XML_ELEMENT_NODE)
132 continue;
133 else if (!strcmp((const char *) ptr->name, "echo"))
134 {
135 m_p->echo = mp::xml::get_bool(ptr, 0);
136 }
137 else
138 {
139 throw mp::filter::FilterException
140 ("Bad element '"
141 + std::string((const char *) ptr->name)
142 + "' in bounce filter");
143 }
144 }
145
146}

◆ process()

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

Definition at line 81 of file filter_bounce.cpp.

82{
83 package.session().close();
84
85 Z_GDU *zgdu = package.request().get();
86
87 if (!zgdu)
88 return;
89
90 //std::string message("BOUNCE ");
91 std::ostringstream message;
92 message << "BOUNCE " << *zgdu;
93
94 metaproxy_1::odr odr;
95
96 if (zgdu->which == Z_GDU_Z3950)
97 {
98 Z_APDU *apdu_res = 0;
99 apdu_res = odr.create_close(zgdu->u.z3950,
100 Z_Close_systemProblem,
101 message.str().c_str());
102 // TODO - Some day we may want a dump of the request in some
103 // addinfo in the close response
104 package.response() = apdu_res;
105 }
106 else if (zgdu->which == Z_GDU_HTTP_Request)
107 {
108 Z_GDU *zgdu_res = 0;
109 zgdu_res
110 = odr.create_HTTP_Response(package.session(),
111 zgdu->u.HTTP_Request, 400);
112 if (m_p->echo)
113 {
114 http_echo(odr, zgdu, zgdu_res);
115 }
116 package.response() = zgdu_res;
117 }
118 else if (zgdu->which == Z_GDU_HTTP_Response)
119 {
120 }
121
122
123 return;
124}
static void http_echo(mp::odr &odr, Z_GDU *zgdu, Z_GDU *zgdu_res)

References http_echo().

Here is the call graph for this function:

Member Data Documentation

◆ m_p

boost::scoped_ptr<Rep> metaproxy_1::filter::Bounce::m_p
private

Definition at line 33 of file filter_bounce.hpp.

Referenced by Bounce().


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