LCOV - code coverage report
Current view: top level - python/isc/util/cio - socketsession_python.cc (source / functions) Hit Total Coverage
Test: report.info Lines: 8 12 66.7 %
Date: 2012-05-15 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 20 30.0 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
       2                 :            : //
       3                 :            : // Permission to use, copy, modify, and/or distribute this software for any
       4                 :            : // purpose with or without fee is hereby granted, provided that the above
       5                 :            : // copyright notice and this permission notice appear in all copies.
       6                 :            : //
       7                 :            : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
       8                 :            : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
       9                 :            : // AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
      10                 :            : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      11                 :            : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
      12                 :            : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      13                 :            : // PERFORMANCE OF THIS SOFTWARE.
      14                 :            : 
      15                 :            : #include <Python.h>
      16                 :            : 
      17                 :            : #include <util/python/pycppwrapper_util.h>
      18                 :            : 
      19                 :            : #include "socketsessionreceiver_python.h"
      20                 :            : #include "socketsessionforwarder_python.h"
      21                 :            : 
      22                 :            : using namespace isc::util::io::python;
      23                 :            : using namespace isc::util::python;
      24                 :            : 
      25                 :            : #include "socketsession_inc.cc"
      26                 :            : 
      27                 :            : namespace isc {
      28                 :            : namespace util {
      29                 :            : namespace io {
      30                 :            : namespace python {
      31                 :            : PyObject* po_SocketSessionError;
      32                 :            : }
      33                 :            : }
      34                 :            : }
      35                 :            : }
      36                 :            : 
      37                 :            : namespace {
      38                 :            : 
      39                 :            : PyModuleDef socketsession = {
      40                 :            :     { PyObject_HEAD_INIT(NULL) NULL, 0, NULL},
      41                 :            :     "isc.util.cio.socketsession",
      42                 :            :     socketsession_doc,
      43                 :            :     -1,
      44                 :            :     NULL,
      45                 :            :     NULL,
      46                 :            :     NULL,
      47                 :            :     NULL,
      48                 :            :     NULL
      49                 :            : };
      50                 :            : } // end of unnamed namespace
      51                 :            : 
      52                 :            : PyMODINIT_FUNC
      53                 :          2 : PyInit_socketsession(void) {
      54                 :          2 :     PyObject* mod = PyModule_Create(&socketsession);
      55         [ +  - ]:          2 :     if (mod == NULL) {
      56                 :            :         return (NULL);
      57                 :            :     }
      58                 :            : 
      59                 :            :     try {
      60                 :            :         po_SocketSessionError =
      61         [ +  - ]:          2 :             PyErr_NewException("isc.util.cio.SocketSessionError", NULL, NULL);
      62                 :            :         PyObjectContainer(po_SocketSessionError).
      63 [ +  - ][ +  - ]:          2 :             installToModule(mod, "SocketSessionError");
      64                 :          0 :     } catch (...) {
      65 [ #  # ][ #  # ]:          0 :         Py_DECREF(mod);
      66                 :            :         return (NULL);
      67                 :            :     }
      68                 :            : 
      69         [ -  + ]:          2 :     if (!initModulePart_SocketSessionForwarder(mod)) {
      70         [ #  # ]:          0 :         Py_DECREF(mod);
      71                 :            :         return (NULL);
      72                 :            :     }
      73         [ -  + ]:          2 :     if (!initModulePart_SocketSessionReceiver(mod)) {
      74         [ #  # ]:          2 :         Py_DECREF(mod);
      75                 :            :         return (NULL);
      76                 :            :     }
      77                 :            : 
      78                 :            :     return (mod);
      79                 :          0 : }

Generated by: LCOV version 1.9