-# -*-pyrex-*-
-#
-# $Id$
-#
-# Ident client
-#
-# (c) 2005 Straylight/Edgeware
-#
+### -*-pyrex-*-
+###
+### Ident client
+###
+### (c) 2005 Straylight/Edgeware
+###
-#----- Licensing notice -----------------------------------------------------
-#
-# This file is part of the Python interface to mLib.
-#
-# mLib/Python is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# mLib/Python is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with mLib/Python; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the Python interface to mLib.
+###
+### mLib/Python is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+###
+### mLib/Python is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with mLib/Python; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import socket
cdef _user
cdef _bad
cdef _error
- cdef _failed
cdef _bogus
- def __new__(me, sk,
- userproc = None, bogusproc = None,
- badproc = None, errorproc = None, failedproc = None,
- *hunoz, **hukairz):
+ def __cinit__(me, sk, userproc = None, bogusproc = None,
+ badproc = None, errorproc = None, *hunoz, **hukairz):
cdef sockaddr_in s_in, s_out
- cdef size_t sz_in, sz_out
+ cdef socklen_t sz_in, sz_out
cdef int fd
- if PyObject_TypeCheck(sk, socket.SocketType):
+ if typecheck(sk, socket.SocketType):
fd = sk.fileno()
sz_in = PSIZEOF(&s_in)
sz_out = PSIZEOF(&s_out)
me._user = _checkcallable(userproc, 'user proc')
me._bad = _checkcallable(badproc, 'bad proc')
me._error = _checkcallable(errorproc, 'error proc')
- me._failed = _checkcallable(failedproc, 'failed proc')
me._bogus = _checkcallable(bogusproc, 'bogus proc')
def __dealloc__(me):
if me._activep:
me._user = _checkcallable(proc, 'user proc')
def __del__(me):
me._user = None
- property eofproc:
- def __get__(me):
- return me._eof
- def __set__(me, proc):
- me._eof = _checkcallable(proc, 'eof proc')
- def __del__(me):
- me._eof = None
property badproc:
def __get__(me):
return me._bad
me._error = _checkcallable(proc, 'error proc')
def __del__(me):
me._error = None
- property failedproc:
- def __get__(me):
- return me._failed
- def __set__(me, proc):
- me._failed = _checkcallable(proc, 'failed proc')
- def __del__(me):
- me._failed = None
property bogusproc:
def __get__(me):
return me._bogus
if me._error is not None:
return me._error(error)
return me.bogus()
- def failed(me, errno, strerror):
- if me._failed is not None:
- return me._failed(errno, strerror)
- return me.bogus()
def bogus(me):
return _maybecall(me._bogus, ())
-cdef void _identfunc2(ident_reply *i, void *arg):
+cdef void _identfunc(ident_reply *i, void *arg):
cdef SelIdentify id
id = <SelIdentify>arg
id._dead()
id.error(i.u.error)
elif i.type == IDENT_USERID:
id.user(i.u.userid.os, i.u.userid.user)
-cdef void _identfunc(ident_reply *i, void *arg):
- PyEval_AcquireLock()
- _identfunc2(i, arg)
- PyEval_ReleaseLock()
-#----- That's all, folks ----------------------------------------------------
+###----- That's all, folks --------------------------------------------------