Call yaz_daemon_stop just after stop of socket bind
[metaproxy-moved-to-github.git] / src / filter_frontend_net.cpp
1 /* This file is part of Metaproxy.
2    Copyright (C) 2005-2012 Index Data
3
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #include "config.hpp"
20
21 #include <sstream>
22 #include <iomanip>
23 #include <metaproxy/util.hpp>
24 #include "pipe.hpp"
25 #include <metaproxy/filter.hpp>
26 #include <metaproxy/package.hpp>
27 #include "thread_pool_observer.hpp"
28 #include "filter_frontend_net.hpp"
29 #include <yazpp/z-assoc.h>
30 #include <yazpp/pdu-assoc.h>
31 #include <yazpp/socket-manager.h>
32 #include <yazpp/limit-connect.h>
33 #include <yaz/timing.h>
34 #include <yaz/log.h>
35 #include <yaz/daemon.h>
36 #include "gduutil.hpp"
37
38 #include <iostream>
39
40 namespace mp = metaproxy_1;
41 namespace yf = metaproxy_1::filter;
42
43 namespace metaproxy_1 {
44     namespace filter {
45         class FrontendNet::Port {
46             friend class Rep;
47             friend class FrontendNet;
48             std::string port;
49             std::string route;
50         };
51         class FrontendNet::Rep {
52             friend class FrontendNet;
53
54             int m_no_threads;
55             std::vector<Port> m_ports;
56             int m_listen_duration;
57             int m_session_timeout;
58             int m_connect_max;
59             std::string m_msg_config;
60             std::string m_stat_req;
61             yazpp_1::SocketManager mySocketManager;
62             ZAssocServer **az;
63             int m_duration_freq[22];
64             double m_duration_lim[22];
65             double m_duration_max;
66             double m_duration_min;
67             double m_duration_total;
68             bool m_stop;
69         public:
70             Rep();
71             ~Rep();
72         };
73         class FrontendNet::My_Timer_Thread : public yazpp_1::ISocketObserver {
74         private:
75             yazpp_1::ISocketObservable *m_obs;
76             Pipe m_pipe;
77             bool m_timeout;
78         public:
79             My_Timer_Thread(yazpp_1::ISocketObservable *obs, int duration);
80             void socketNotify(int event);
81             bool timeout();
82         };
83         class FrontendNet::ZAssocChild : public yazpp_1::Z_Assoc {
84         public:
85             ~ZAssocChild();
86             ZAssocChild(yazpp_1::IPDU_Observable *the_PDU_Observable,
87                         mp::ThreadPoolSocketObserver *m_thread_pool_observer,
88                         const mp::Package *package,
89                         std::string route,
90                         Rep *rep);
91             int m_no_requests;
92             std::string m_route;
93         private:
94             yazpp_1::IPDU_Observer* sessionNotify(
95                 yazpp_1::IPDU_Observable *the_PDU_Observable,
96                 int fd);
97             void recv_GDU(Z_GDU *apdu, int len);
98             void report(Z_HTTP_Request *hreq);
99             void failNotify();
100             void timeoutNotify();
101             void connectNotify();
102         private:
103             mp::ThreadPoolSocketObserver *m_thread_pool_observer;
104             mp::Session m_session;
105             mp::Origin m_origin;
106             bool m_delete_flag;
107             const mp::Package *m_package;
108             Rep *m_p;
109         };
110         class FrontendNet::ThreadPoolPackage : public mp::IThreadPoolMsg {
111         public:
112             ThreadPoolPackage(mp::Package *package,
113                               yf::FrontendNet::ZAssocChild *ses,
114                               Rep *rep);
115             ~ThreadPoolPackage();
116             IThreadPoolMsg *handle();
117             void result(const char *t_info);
118             bool cleanup(void *info);
119         private:
120             yaz_timing_t timer;
121             ZAssocChild *m_assoc_child;
122             mp::Package *m_package;
123             Rep *m_p;
124         };
125         class FrontendNet::ZAssocServer : public yazpp_1::Z_Assoc {
126         public:
127             ~ZAssocServer();
128             ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
129                          std::string route,
130                          Rep *rep);
131             void set_package(const mp::Package *package);
132             void set_thread_pool(ThreadPoolSocketObserver *observer);
133         private:
134             yazpp_1::IPDU_Observer* sessionNotify(
135                 yazpp_1::IPDU_Observable *the_PDU_Observable,
136                 int fd);
137             void recv_GDU(Z_GDU *apdu, int len);
138
139             void failNotify();
140             void timeoutNotify();
141             void connectNotify();
142         private:
143             mp::ThreadPoolSocketObserver *m_thread_pool_observer;
144             const mp::Package *m_package;
145             yazpp_1::LimitConnect limit_connect;
146             std::string m_route;
147             Rep *m_p;
148         };
149     }
150 }
151
152 yf::FrontendNet::ThreadPoolPackage::ThreadPoolPackage(mp::Package *package,
153                                                       ZAssocChild *ses,
154                                                       Rep *rep) :
155     m_assoc_child(ses), m_package(package), m_p(rep)
156 {
157     timer = yaz_timing_create();
158 }
159
160 yf::FrontendNet::ThreadPoolPackage::~ThreadPoolPackage()
161 {
162     yaz_timing_destroy(&timer); // timer may be NULL
163     delete m_package;
164 }
165
166 bool yf::FrontendNet::ThreadPoolPackage::cleanup(void *info)
167 {
168     mp::Session *ses = (mp::Session *) info;
169
170     return *ses == m_package->session();
171 }
172
173 void yf::FrontendNet::ThreadPoolPackage::result(const char *t_info)
174 {
175     m_assoc_child->m_no_requests--;
176
177     yazpp_1::GDU *gdu = &m_package->response();
178
179     if (gdu->get())
180     {
181         int len;
182         m_assoc_child->send_GDU(gdu->get(), &len);
183
184         yaz_timing_stop(timer);
185         double duration = yaz_timing_get_real(timer);
186
187         size_t ent = 0;
188         while (m_p->m_duration_lim[ent] != 0.0 && duration > m_p->m_duration_lim[ent])
189             ent++;
190         m_p->m_duration_freq[ent]++;
191
192         m_p->m_duration_total += duration;
193
194         if (m_p->m_duration_max < duration)
195             m_p->m_duration_max = duration;
196
197         if (m_p->m_duration_min == 0.0 || m_p->m_duration_min > duration)
198             m_p->m_duration_min = duration;
199
200         if (m_p->m_msg_config.length())
201         {
202             Z_GDU *z_gdu = gdu->get();
203
204             std::ostringstream os;
205             os  << m_p->m_msg_config << " "
206                 << *m_package << " "
207                 << std::fixed << std::setprecision (6) << duration << " ";
208
209             if (z_gdu)
210                 os << *z_gdu;
211             else
212                 os << "-";
213
214             yaz_log(YLOG_LOG, "%s %s", os.str().c_str(), t_info);
215         }
216     }
217     else if (!m_package->session().is_closed())
218     {
219         // no response package and yet the session is still open..
220         // means that request is unhandled..
221         yazpp_1::GDU *gdu_req = &m_package->request();
222         Z_GDU *z_gdu = gdu_req->get();
223         if (z_gdu && z_gdu->which == Z_GDU_Z3950)
224         {
225             // For Z39.50, response with a Close and shutdown
226             mp::odr odr;
227             int len;
228             Z_APDU *apdu_response = odr.create_close(
229                 z_gdu->u.z3950, Z_Close_systemProblem,
230                 "unhandled Z39.50 request");
231
232             m_assoc_child->send_Z_PDU(apdu_response, &len);
233         }
234         else if (z_gdu && z_gdu->which == Z_GDU_HTTP_Request)
235         {
236             // For HTTP, respond with Server Error
237             int len;
238             mp::odr odr;
239             Z_GDU *zgdu_res
240                 = odr.create_HTTP_Response(m_package->session(),
241                                            z_gdu->u.HTTP_Request, 500);
242             m_assoc_child->send_GDU(zgdu_res, &len);
243         }
244         m_package->session().close();
245     }
246
247     if (m_assoc_child->m_no_requests == 0 && m_package->session().is_closed())
248     {
249         m_assoc_child->close();
250     }
251
252
253     delete this;
254 }
255
256 mp::IThreadPoolMsg *yf::FrontendNet::ThreadPoolPackage::handle()
257 {
258     m_package->move(m_assoc_child->m_route);
259     return this;
260 }
261
262 yf::FrontendNet::ZAssocChild::ZAssocChild(
263     yazpp_1::IPDU_Observable *PDU_Observable,
264     mp::ThreadPoolSocketObserver *my_thread_pool,
265     const mp::Package *package,
266     std::string route, Rep *rep)
267     :  Z_Assoc(PDU_Observable), m_p(rep)
268 {
269     m_thread_pool_observer = my_thread_pool;
270     m_no_requests = 0;
271     m_delete_flag = false;
272     m_package = package;
273     m_route = route;
274     const char *peername = PDU_Observable->getpeername();
275     if (!peername)
276         peername = "unknown";
277     m_origin.set_tcpip_address(std::string(peername), m_session.id());
278     timeout(m_p->m_session_timeout);
279 }
280
281 yazpp_1::IPDU_Observer *yf::FrontendNet::ZAssocChild::sessionNotify(
282     yazpp_1::IPDU_Observable *the_PDU_Observable, int fd)
283 {
284     return 0;
285 }
286
287 yf::FrontendNet::ZAssocChild::~ZAssocChild()
288 {
289 }
290
291 void yf::FrontendNet::ZAssocChild::report(Z_HTTP_Request *hreq)
292 {
293     mp::odr o;
294
295     Z_GDU *gdu_res = o.create_HTTP_Response(m_session, hreq, 200);
296
297     Z_HTTP_Response *hres = gdu_res->u.HTTP_Response;
298
299     mp::wrbuf w;
300     size_t i;
301     int number_total = 0;
302
303     for (i = 0; m_p->m_duration_lim[i] != 0.0; i++)
304         number_total += m_p->m_duration_freq[i];
305     number_total += m_p->m_duration_freq[i];
306
307     wrbuf_puts(w, "<?xml version=\"1.0\"?>\n");
308     wrbuf_puts(w, "<frontend_net>\n");
309     wrbuf_printf(w, "  <responses frequency=\"%d\">\n", number_total);
310     for (i = 0; m_p->m_duration_lim[i] != 0.0; i++)
311     {
312         if (m_p->m_duration_freq[i] > 0)
313             wrbuf_printf(
314                 w, "    <response duration_start=\"%f\" "
315                 "duration_end=\"%f\" frequency=\"%d\"/>\n",
316                 i > 0 ? m_p->m_duration_lim[i - 1] : 0.0,
317                 m_p->m_duration_lim[i], m_p->m_duration_freq[i]);
318     }
319
320     if (m_p->m_duration_freq[i] > 0)
321         wrbuf_printf(
322             w, "    <response duration_start=\"%f\" frequency=\"%d\"/>\n",
323             m_p->m_duration_lim[i - 1], m_p->m_duration_freq[i]);
324
325     if (m_p->m_duration_max != 0.0)
326         wrbuf_printf(
327             w, "    <response duration_max=\"%f\"/>\n",
328             m_p->m_duration_max);
329     if (m_p->m_duration_min != 0.0)
330         wrbuf_printf(
331             w, "    <response duration_min=\"%f\"/>\n",
332             m_p->m_duration_min);
333     if (m_p->m_duration_total != 0.0)
334         wrbuf_printf(
335             w, "    <response duration_average=\"%f\"/>\n",
336             m_p->m_duration_total / number_total);
337
338     wrbuf_puts(w, " </responses>\n");
339
340     int thread_busy;
341     int thread_total;
342     m_thread_pool_observer->get_thread_info(thread_busy, thread_total);
343
344     wrbuf_printf(w, " <thread_info busy=\"%d\" total=\"%d\"/>\n",
345                  thread_busy, thread_total);
346
347     wrbuf_puts(w, "</frontend_net>\n");
348
349     hres->content_len = w.len();
350     hres->content_buf = (char *) w.buf();
351
352     int len;
353     send_GDU(gdu_res, &len);
354 }
355
356 void yf::FrontendNet::ZAssocChild::recv_GDU(Z_GDU *z_pdu, int len)
357 {
358     m_no_requests++;
359
360     mp::Package *p = new mp::Package(m_session, m_origin);
361
362     if (z_pdu && z_pdu->which == Z_GDU_HTTP_Request)
363     {
364         Z_HTTP_Request *hreq = z_pdu->u.HTTP_Request;
365
366         const char *f = z_HTTP_header_lookup(hreq->headers, "X-Forwarded-For");
367         if (f)
368             p->origin().set_tcpip_address(std::string(f), m_session.id());
369
370         if (m_p->m_stat_req.length()
371             && !strcmp(hreq->path, m_p->m_stat_req.c_str()))
372         {
373             report(hreq);
374             return;
375         }
376     }
377
378     ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_p);
379     p->copy_route(*m_package);
380     p->request() = yazpp_1::GDU(z_pdu);
381
382     if (m_p->m_msg_config.length())
383     {
384         if (z_pdu)
385         {
386             std::ostringstream os;
387             os  << m_p->m_msg_config << " "
388                 << *p << " "
389                 << "0.000000" << " "
390                 << *z_pdu;
391             yaz_log(YLOG_LOG, "%s", os.str().c_str());
392         }
393     }
394     m_thread_pool_observer->put(tp);
395 }
396
397 void yf::FrontendNet::ZAssocChild::failNotify()
398 {
399     // TODO: send Package to signal "close"
400     if (m_session.is_closed())
401     {
402         if (m_no_requests == 0)
403             delete this;
404         return;
405     }
406     m_no_requests++;
407
408     m_session.close();
409
410     mp::Package *p = new mp::Package(m_session, m_origin);
411
412     ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_p);
413     p->copy_route(*m_package);
414     m_thread_pool_observer->cleanup(tp, &m_session);
415     m_thread_pool_observer->put(tp);
416 }
417
418 void yf::FrontendNet::ZAssocChild::timeoutNotify()
419 {
420     failNotify();
421 }
422
423 void yf::FrontendNet::ZAssocChild::connectNotify()
424 {
425
426 }
427
428 yf::FrontendNet::ZAssocServer::ZAssocServer(
429     yazpp_1::IPDU_Observable *PDU_Observable,
430     std::string route,
431     Rep *rep)
432     :
433     Z_Assoc(PDU_Observable), m_route(route), m_p(rep)
434 {
435     m_package = 0;
436 }
437
438
439 void yf::FrontendNet::ZAssocServer::set_package(const mp::Package *package)
440 {
441     m_package = package;
442 }
443
444 void yf::FrontendNet::ZAssocServer::set_thread_pool(
445     ThreadPoolSocketObserver *observer)
446 {
447     m_thread_pool_observer = observer;
448 }
449
450 yazpp_1::IPDU_Observer *yf::FrontendNet::ZAssocServer::sessionNotify(
451     yazpp_1::IPDU_Observable *the_PDU_Observable, int fd)
452 {
453
454     const char *peername = the_PDU_Observable->getpeername();
455     if (peername)
456     {
457         limit_connect.add_connect(peername);
458         limit_connect.cleanup(false);
459         int con_sz = limit_connect.get_total(peername);
460         if (m_p->m_connect_max && con_sz > m_p->m_connect_max)
461             return 0;
462     }
463     ZAssocChild *my = new ZAssocChild(the_PDU_Observable,
464                                       m_thread_pool_observer,
465                                       m_package, m_route, m_p);
466     return my;
467 }
468
469 yf::FrontendNet::ZAssocServer::~ZAssocServer()
470 {
471 }
472
473 void yf::FrontendNet::ZAssocServer::recv_GDU(Z_GDU *apdu, int len)
474 {
475 }
476
477 void yf::FrontendNet::ZAssocServer::failNotify()
478 {
479 }
480
481 void yf::FrontendNet::ZAssocServer::timeoutNotify()
482 {
483 }
484
485 void yf::FrontendNet::ZAssocServer::connectNotify()
486 {
487 }
488
489 yf::FrontendNet::FrontendNet() : m_p(new Rep)
490 {
491 }
492
493 yf::FrontendNet::Rep::Rep()
494 {
495     m_no_threads = 5;
496     m_listen_duration = 0;
497     m_session_timeout = 300; // 5 minutes
498     m_connect_max = 0;
499     az = 0;
500     size_t i;
501     for (i = 0; i < 22; i++)
502         m_duration_freq[i] = 0;
503     m_duration_lim[0] = 0.000001;
504     m_duration_lim[1] = 0.00001;
505     m_duration_lim[2] = 0.0001;
506     m_duration_lim[3] = 0.001;
507     m_duration_lim[4] = 0.01;
508     m_duration_lim[5] = 0.1;
509     m_duration_lim[6] = 0.2;
510     m_duration_lim[7] = 0.3;
511     m_duration_lim[8] = 0.5;
512     m_duration_lim[9] = 1.0;
513     m_duration_lim[10] = 1.5;
514     m_duration_lim[11] = 2.0;
515     m_duration_lim[12] = 3.0;
516     m_duration_lim[13] = 4.0;
517     m_duration_lim[14] = 5.0;
518     m_duration_lim[15] = 6.0;
519     m_duration_lim[16] = 8.0;
520     m_duration_lim[17] = 10.0;
521     m_duration_lim[18] = 15.0;
522     m_duration_lim[19] = 20.0;
523     m_duration_lim[20] = 30.0;
524     m_duration_lim[21] = 0.0;
525     m_duration_max = 0.0;
526     m_duration_min = 0.0;
527     m_duration_total = 0.0;
528     m_stop = false;
529 }
530
531 yf::FrontendNet::Rep::~Rep()
532 {
533     if (az)
534     {
535         size_t i;
536         for (i = 0; i < m_ports.size(); i++)
537             delete az[i];
538         delete [] az;
539     }
540     az = 0;
541 }
542
543 yf::FrontendNet::~FrontendNet()
544 {
545 }
546
547 void yf::FrontendNet::stop() const
548 {
549     m_p->m_stop = true;
550 }
551
552 bool yf::FrontendNet::My_Timer_Thread::timeout()
553 {
554     return m_timeout;
555 }
556
557 yf::FrontendNet::My_Timer_Thread::My_Timer_Thread(
558     yazpp_1::ISocketObservable *obs,
559     int duration) :
560     m_obs(obs), m_pipe(9123), m_timeout(false)
561 {
562     obs->addObserver(m_pipe.read_fd(), this);
563     obs->maskObserver(this, yazpp_1::SOCKET_OBSERVE_READ);
564     obs->timeoutObserver(this, duration);
565 }
566
567 void yf::FrontendNet::My_Timer_Thread::socketNotify(int event)
568 {
569     m_timeout = true;
570     m_obs->deleteObserver(this);
571 }
572
573 void yf::FrontendNet::process(Package &package) const
574 {
575     if (m_p->az == 0)
576         return;
577     size_t i;
578     My_Timer_Thread *tt = 0;
579
580     if (m_p->m_listen_duration)
581         tt = new My_Timer_Thread(&m_p->mySocketManager,
582                                  m_p->m_listen_duration);
583
584     ThreadPoolSocketObserver tp(&m_p->mySocketManager, m_p->m_no_threads);
585
586     for (i = 0; i<m_p->m_ports.size(); i++)
587     {
588         m_p->az[i]->set_package(&package);
589         m_p->az[i]->set_thread_pool(&tp);
590     }
591     while (m_p->mySocketManager.processEvent() > 0)
592     {
593         if (m_p->m_stop)
594         {
595             m_p->m_stop = false;
596             if (m_p->az)
597             {
598                 size_t i;
599                 for (i = 0; i < m_p->m_ports.size(); i++)
600                     m_p->az[i]->server("");
601                 yaz_daemon_stop();
602             }
603         }
604         int no = m_p->mySocketManager.getNumberOfObservers();
605         if (no <= 1)
606             break;
607         if (tt && tt->timeout())
608             break;
609     }
610     delete tt;
611 }
612
613 void yf::FrontendNet::configure(const xmlNode * ptr, bool test_only,
614                                 const char *path)
615 {
616     if (!ptr || !ptr->children)
617     {
618         throw yf::FilterException("No ports for Frontend");
619     }
620     std::vector<Port> ports;
621     for (ptr = ptr->children; ptr; ptr = ptr->next)
622     {
623         if (ptr->type != XML_ELEMENT_NODE)
624             continue;
625         if (!strcmp((const char *) ptr->name, "port"))
626         {
627             Port port;
628             const struct _xmlAttr *attr;
629             for (attr = ptr->properties; attr; attr = attr->next)
630             {
631                 if (!strcmp((const char *) attr->name, "route"))
632                     port.route = mp::xml::get_text(attr);
633             }
634             port.port = mp::xml::get_text(ptr);
635             ports.push_back(port);
636
637         }
638         else if (!strcmp((const char *) ptr->name, "threads"))
639         {
640             std::string threads_str = mp::xml::get_text(ptr);
641             int threads = atoi(threads_str.c_str());
642             if (threads < 1)
643                 throw yf::FilterException("Bad value for threads: "
644                                                    + threads_str);
645             m_p->m_no_threads = threads;
646         }
647         else if (!strcmp((const char *) ptr->name, "timeout"))
648         {
649             std::string timeout_str = mp::xml::get_text(ptr);
650             int timeout = atoi(timeout_str.c_str());
651             if (timeout < 1)
652                 throw yf::FilterException("Bad value for timeout: "
653                                                    + timeout_str);
654             m_p->m_session_timeout = timeout;
655         }
656         else if (!strcmp((const char *) ptr->name, "connect-max"))
657         {
658             m_p->m_connect_max = mp::xml::get_int(ptr, 0);
659         }
660         else if (!strcmp((const char *) ptr->name, "message"))
661         {
662             m_p->m_msg_config = mp::xml::get_text(ptr);
663         }
664         else if (!strcmp((const char *) ptr->name, "stat-req"))
665         {
666             m_p->m_stat_req = mp::xml::get_text(ptr);
667         }
668         else
669         {
670             throw yf::FilterException("Bad element "
671                                       + std::string((const char *)
672                                                     ptr->name));
673         }
674     }
675     if (test_only)
676         return;
677     set_ports(ports);
678 }
679
680 void yf::FrontendNet::set_ports(std::vector<std::string> &ports)
681 {
682     std::vector<Port> nports;
683     size_t i;
684
685     for (i = 0; i < ports.size(); i++)
686     {
687         Port nport;
688
689         nport.port = ports[i];
690
691         nports.push_back(nport);
692     }
693     set_ports(nports);
694 }
695
696
697 void yf::FrontendNet::set_ports(std::vector<Port> &ports)
698 {
699     m_p->m_ports = ports;
700
701     m_p->az = new yf::FrontendNet::ZAssocServer *[m_p->m_ports.size()];
702
703     // Create yf::FrontendNet::ZAssocServer for each port
704     size_t i;
705     for (i = 0; i<m_p->m_ports.size(); i++)
706     {
707         // create a PDU assoc object (one per yf::FrontendNet::ZAssocServer)
708         yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&m_p->mySocketManager);
709
710         // create ZAssoc with PDU Assoc
711         m_p->az[i] = new yf::FrontendNet::ZAssocServer(
712             as, m_p->m_ports[i].route, m_p.get());
713         if (m_p->az[i]->server(m_p->m_ports[i].port.c_str()))
714         {
715             throw yf::FilterException("Unable to bind to address "
716                                       + std::string(m_p->m_ports[i].port));
717         }
718     }
719 }
720
721 void yf::FrontendNet::set_listen_duration(int d)
722 {
723     m_p->m_listen_duration = d;
724 }
725
726 static yf::Base* filter_creator()
727 {
728     return new yf::FrontendNet;
729 }
730
731 extern "C" {
732     struct metaproxy_1_filter_struct metaproxy_1_filter_frontend_net = {
733         0,
734         "frontend_net",
735         filter_creator
736     };
737 }
738
739 /*
740  * Local variables:
741  * c-basic-offset: 4
742  * c-file-style: "Stroustrup"
743  * indent-tabs-mode: nil
744  * End:
745  * vim: shiftwidth=4 tabstop=8 expandtab
746  */
747