Mercurial > hg > freeDiameter
annotate extensions/dbg_interactive/dbg_interactive.i @ 662:2e94ef0515d7 1.1.0-rc1
Updated copyright information
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 14 Jan 2011 16:27:21 +0900 |
parents | f198d16fa7f4 |
children | 4ffbc9f1e922 |
rev | line source |
---|---|
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
1 /* This interface file is processed by SWIG to create a python wrapper interface to freeDiameter framework. */ |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
623
diff
changeset
|
2 %module fDpy |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
3 %begin %{ |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 /********************************************************************************************************* |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 * Software License Agreement (BSD License) * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
662
2e94ef0515d7
Updated copyright information
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
658
diff
changeset
|
8 * Copyright (c) 2011, WIDE Project and NICT * |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * All rights reserved. * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * permitted provided that the following conditions are met: * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * Redistributions of source code must retain the above * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * copyright notice, this list of conditions and the * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * following disclaimer. * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * * Redistributions in binary form must reproduce the above * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * copyright notice, this list of conditions and the * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * following disclaimer in the documentation and/or other * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * materials provided with the distribution. * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * * Neither the name of the WIDE Project or NICT nor the * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * names of its contributors may be used to endorse or * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * promote products derived from this software without * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * specific prior written permission of WIDE Project and * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * NICT. * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 *********************************************************************************************************/ |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
38 %} |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 %{ |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
623
diff
changeset
|
41 /* This text is included in the generated wrapper verbatim */ |
621
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
42 #define SWIG |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 #include <freeDiameter/extension.h> |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
44 %} |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
45 |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
46 |
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
47 /* Include standard types & functions used in freeDiameter headers */ |
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
48 %include <stdint.i> |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
49 //%include <cdata.i> |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
623
diff
changeset
|
50 %include <cstring.i> |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
51 %include <typemaps.i> |
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
52 |
621
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
53 |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
54 /* Inline functions seems to give problems to SWIG -- just remove the inline definition */ |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
55 %define __inline__ |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
56 %enddef |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
57 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
58 |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
59 /* Make some global-variables read-only (mainly to avoid warnings) */ |
621
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
60 %immutable fd_g_config; |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
61 %immutable peer_state_str; |
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
62 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
63 /***************** |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
64 * Exceptions * |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
65 *****************/ |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
66 %{ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
67 /* This is not thread-safe etc. but it should work /most of the time/. */ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
68 static int wrapper_errno; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
69 static PyObject* wrapper_errno_py; |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
70 static const char * wrapper_error_txt; /* if NULL, use strerror(errno) */ |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
71 #define DI_ERROR(code, pycode, str) { \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
72 fd_log_debug("[dbg_interactive] ERROR: %s: %s\n", __PRETTY_FUNCTION__, str ? str : strerror(code)); \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
73 wrapper_errno = code; \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
74 wrapper_errno_py = pycode; \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
75 wrapper_error_txt = str; \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
76 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
77 |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
78 #define DI_ERROR_MALLOC \ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
79 DI_ERROR(ENOMEM, PyExc_MemoryError, NULL) |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
80 |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
81 %} |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
82 |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
83 %exception { |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
84 /* reset the errno */ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
85 wrapper_errno = 0; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
86 /* Call the function -- it will use DI_ERROR macro in case of error */ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
87 $action |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
88 /* Now, test for error */ |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
89 if (wrapper_errno) { |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
90 const char * str = wrapper_error_txt ? wrapper_error_txt : strerror(wrapper_errno); |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
91 PyObject * exc = wrapper_errno_py; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
92 if (!exc) { |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
93 switch (wrapper_errno) { |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
94 case ENOMEM: exc = PyExc_MemoryError; break; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
95 case EINVAL: exc = PyExc_ValueError; break; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
96 default: exc = PyExc_RuntimeError; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
97 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
98 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
99 SWIG_PYTHON_THREAD_BEGIN_BLOCK; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
100 PyErr_SetString(exc, str); |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
101 SWIG_fail; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
102 SWIG_PYTHON_THREAD_END_BLOCK; |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
103 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
104 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
105 |
621
04dbea46c7a2
Cleanup many SWIG definitions from main .h files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
106 |
625
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
107 /*********************************** |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
108 Some types & typemaps for usability |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
109 ***********************************/ |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
110 |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
111 %apply (char *STRING, size_t LENGTH) { ( char * string, size_t len ) }; |
623
fc4f5815f0aa
Continued work on dbg_interactive.fdx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
621
diff
changeset
|
112 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
113 /* Generic typemap for functions that create something */ |
625
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
114 %typemap(in, numinputs=0,noblock=1) SWIGTYPE ** OUTPUT (void *temp = NULL) { |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
115 $1 = (void *)&temp; |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
116 } |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
117 %typemap(argout,noblock=1) SWIGTYPE ** OUTPUT { |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
118 %append_output(SWIG_NewPointerObj(*$1, $*1_descriptor, 0)); |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
119 } |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
120 |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
121 /* Typemap to return a boolean value as output parameter */ |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
122 %typemap(in, numinputs=0,noblock=1) int * BOOL_OUT (int temp) { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
123 $1 = &temp; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
124 } |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
125 %typemap(argout,noblock=1) int * BOOL_OUT { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
126 PyObject * r; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
127 if (*$1) |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
128 r = Py_True; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
129 else |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
130 r = Py_False; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
131 Py_XINCREF(r); |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
132 %append_output(r); |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
133 } |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
134 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
135 /* To allow passing callback functions defined in python */ |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
136 %typemap(in) PyObject *PyCb { |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
137 if (!$input || ($input == Py_None)) { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
138 $1 = NULL; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
139 } else { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
140 if (!PyCallable_Check($input)) { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
141 PyErr_SetString(PyExc_TypeError, "Need a callable object!"); |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
142 SWIG_fail; |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
143 } |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
144 $1 = $input; |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
145 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
146 } |
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
147 |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
148 %{ |
638
9448cba86673
Improved usability of dbg_interactive
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
637
diff
changeset
|
149 /* Forward declaration for the peers module */ |
9448cba86673
Improved usability of dbg_interactive
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
637
diff
changeset
|
150 static void fd_add_cb(struct peer_info *peer, void *data); |
9448cba86673
Improved usability of dbg_interactive
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
637
diff
changeset
|
151 %} |
9448cba86673
Improved usability of dbg_interactive
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
637
diff
changeset
|
152 |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
153 /* Overwrite declaration to apply typemaps */ |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
154 int fd_sess_fromsid ( char * STRING, size_t LENGTH, struct session ** OUTPUT, int * BOOL_OUT); |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
155 |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
156 |
625
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
157 /********************************************************* |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
158 Now, create wrappers for (almost) all objects from fD API |
2cd2cf7abe2a
Improvements to usability, still work ongoing
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
624
diff
changeset
|
159 *********************************************************/ |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
160 %include "freeDiameter/freeDiameter-host.h" |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
641
diff
changeset
|
161 %include "freeDiameter/libfdproto.h" |
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
641
diff
changeset
|
162 %include "freeDiameter/libfdcore.h" |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
163 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
164 /* Most of the functions from the API are not directly usable "as is". |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
165 See the specific following files and the dbg_interactive.py.sample file |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
166 for more usable python-style versions. |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
167 */ |
635
134e4fb9eef5
Continued work on python interface
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
625
diff
changeset
|
168 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
169 %include "lists.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
170 %include "dictionary.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
171 %include "sessions.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
172 %include "routing.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
173 %include "messages.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
174 %include "dispatch.i" |
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
175 %include "queues.i" |
636
c23ca590fa57
Still making progress on the dbg_interactive interface.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
635
diff
changeset
|
176 |
637
22e8fac3b2d6
Split interface file in modules
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
636
diff
changeset
|
177 %include "peers.i" |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
178 %include "events.i" |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
638
diff
changeset
|
179 %include "endpoints.i" |
641
69d3579f6c6c
First version of dbg_interactive is complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
640
diff
changeset
|
180 |
69d3579f6c6c
First version of dbg_interactive is complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
640
diff
changeset
|
181 %include "posix.i" |