botsense  3.2.0
RoadNarrows Client-Server Proxied Services Framework
bsNull.py
Go to the documentation of this file.
1 # This file was automatically generated by SWIG (http://www.swig.org).
2 # Version 3.0.8
3 #
4 # Do not make changes to this file unless you know what you are doing--modify
5 # the SWIG interface file instead.
6 
7 
8 
9 
10 
11 from sys import version_info
12 if version_info >= (2, 6, 0):
13  def swig_import_helper():
14  from os.path import dirname
15  import imp
16  fp = None
17  try:
18  fp, pathname, description = imp.find_module('_bsNull', [dirname(__file__)])
19  except ImportError:
20  import _bsNull
21  return _bsNull
22  if fp is not None:
23  try:
24  _mod = imp.load_module('_bsNull', fp, pathname, description)
25  finally:
26  fp.close()
27  return _mod
28  _bsNull = swig_import_helper()
29  del swig_import_helper
30 else:
31  import _bsNull
32 del version_info
33 try:
34  _swig_property = property
35 except NameError:
36  pass # Python < 2.2 doesn't have 'property'.
37 
38 
39 def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
40  if (name == "thisown"):
41  return self.this.own(value)
42  if (name == "this"):
43  if type(value).__name__ == 'SwigPyObject':
44  self.__dict__[name] = value
45  return
46  method = class_type.__swig_setmethods__.get(name, None)
47  if method:
48  return method(self, value)
49  if (not static):
50  if _newclass:
51  object.__setattr__(self, name, value)
52  else:
53  self.__dict__[name] = value
54  else:
55  raise AttributeError("You cannot add attributes to %s" % self)
56 
57 
58 def _swig_setattr(self, class_type, name, value):
59  return _swig_setattr_nondynamic(self, class_type, name, value, 0)
60 
61 
62 def _swig_getattr_nondynamic(self, class_type, name, static=1):
63  if (name == "thisown"):
64  return self.this.own()
65  method = class_type.__swig_getmethods__.get(name, None)
66  if method:
67  return method(self)
68  if (not static):
69  return object.__getattr__(self, name)
70  else:
71  raise AttributeError(name)
72 
73 def _swig_getattr(self, class_type, name):
74  return _swig_getattr_nondynamic(self, class_type, name, 0)
75 
76 
77 def _swig_repr(self):
78  try:
79  strthis = "proxy of " + self.this.__repr__()
80  except Exception:
81  strthis = ""
82  return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
83 
84 try:
85  _object = object
86  _newclass = 1
87 except AttributeError:
88  class _object:
89  pass
90  _newclass = 0
91 
92 
93 
94 _bsNull.BS_NULL_DEV_NAME_swigconstant(_bsNull)
95 BS_NULL_DEV_NAME = _bsNull.BS_NULL_DEV_NAME
96 
97 _bsNull.BS_NULL_SERVER_MOD_swigconstant(_bsNull)
98 BS_NULL_SERVER_MOD = _bsNull.BS_NULL_SERVER_MOD
99 
100 _bsNull.BS_NULL_CLIENT_LIB_swigconstant(_bsNull)
101 BS_NULL_CLIENT_LIB = _bsNull.BS_NULL_CLIENT_LIB
102 
103 def bsNullGetMsgName(pClient, hndVConn, uMsgId):
104  return _bsNull.bsNullGetMsgName(pClient, hndVConn, uMsgId)
105 bsNullGetMsgName = _bsNull.bsNullGetMsgName
106 
107 def bsNullReqOpen(pClient, bInitTrace):
108  return _bsNull.bsNullReqOpen(pClient, bInitTrace)
109 bsNullReqOpen = _bsNull.bsNullReqOpen
110 
111 def bsNullReqClose(pClient, hndVConn):
112  return _bsNull.bsNullReqClose(pClient, hndVConn)
113 bsNullReqClose = _bsNull.bsNullReqClose
114 
115 def bsNullReqWrite(pClient, hndVConn, wbuf, uWriteLen):
116  return _bsNull.bsNullReqWrite(pClient, hndVConn, wbuf, uWriteLen)
117 bsNullReqWrite = _bsNull.bsNullReqWrite
118 
119 
120 """
121 BotSense DevNull Python Inline Extensions and Wrappers.
122 """
123 
124 ## \file
125 ## \package BotSense.bsNull
126 ##
127 ## \brief BotSense Swigged Null Python Interface Module.
128 ##
129 ## \author Robin Knight (robin.knight@roadnarrows.com)
130 ##
131 ## \par Copyright:
132 ## (C) 2010. RoadNarrows LLC.\n
133 ## (http://www.roadnarrows.com)\n
134 ## All Rights Reserved
135 ##
136 
137 import BotSenseCore as bsCore
138 import BotSenseError as bsError
139 import BotSenseTypes as bsTypes
140 
141 
142 def NullGetMsgName(client, hndVConn, msgId):
143  """ Get the DevNull message name.
144 
145  For each (virtual connection, message id) 2-tuple, there can be a known
146  name string (provided the id is valid and an application provides the
147  information).
148 
149  Parameters:
150  client - BotSenseTypes.BsClient instance.
151  hndVConn - Virtual connection handle (ignored).
152  msgId - DevNull message id.
153 
154  Return:
155  Returns message name string if it can be determined.
156  Otherwise returns 'unknown'.
157  """
158  bsTypes.BsClient.ChkClient(client)
159  return bsNullGetMsgName(client.pClient, hndVConn, msgId)
160 
161 def NullReqOpen(client, trace=False):
162  """ Proxy server request to establish a virtual connection to the /dev/null
163  device.
164 
165  Raises a BotSenseError exception on failure.
166 
167  Parameters:
168  client - BotSenseTypes.BsClient instance.
169  trace - Initial message tracing enable(true)/disable(false) state.
170 
171  Return
172  New virtual connection handle.
173  """
174  bsTypes.BsClient.ChkClient(client)
175  hndVConn = bsNullReqOpen(client.pClient, trace)
176  bsError.ChkReturnIsNonNeg(hndVConn,
177  "Client %s: DevNull Open request failed." % (client.AttrGetName()))
178  return hndVConn
179 
180 def NullReqClose(client, hndVConn):
181  """ Proxy server request to close client's proxied /dev/null device virtual
182  connection.
183 
184  Raises a BotSenseError exception on failure.
185 
186  Parameters:
187  client - BotSenseTypes.BsClient instance.
188  hndVConn - Virtual connection handle.
189  """
190  bsTypes.BsClient.ChkClient(client)
191  rc = bsNullReqClose(client.pClient, hndVConn)
192  bsError.ChkReturnIsOk(rc,
193  "Client %s: DevNull Close request failed." % (client.AttrGetName()))
194 
195 def NullReqWrite(client, hndVConn, wbuf):
196  """ DevNull request to write /dev/null.
197 
198  Raises a BotSenseError exception on failure.
199 
200  Parameters:
201  client - BotSenseTypes.BsClient instance.
202  hndVConn - Virtual connection handle.
203  wbuf - Write buffer.
204 
205  Return:
206  Number of bytes written.
207  """
208  bsTypes.BsClient.ChkClient(client)
209  wbytebuf = bsTypes.ByteBuf.Clone(wbuf)
210  wbytebuf.copyToSwigObj(len(wbytebuf))
211  n = bsNullReqWrite(client.pClient, hndVConn, wbytebuf.getSwigObj(),
212  len(wbytebuf))
213  bsError.ChkReturnIsNonNeg(n,
214  "Client %s: DevNull Write request failed." % (client.AttrGetName()))
215  return n
216 
217 
218 # This file is compatible with both classic and new-style classes.
219 
220 
def NullReqOpen(client, trace=False)
Definition: bsNull.py:161
def NullGetMsgName(client, hndVConn, msgId)
Definition: bsNull.py:142
def NullReqWrite(client, hndVConn, wbuf)
Definition: bsNull.py:195
def NullReqClose(client, hndVConn)
Definition: bsNull.py:180