/* SWIG interface for libitkacl */ %module itkacl %include exception.i /* * ITKACL now threadsafe using exceptions found in PHP5. * -1 is return on unexpected event, eg. realm doesn't exist. * * The naming of the class is somewhat braindamaged due to SWIG * restrictions. */ %inline %{ extern "C" int itkacl_check(char *realm, char *user, char *errmsg, size_t errmsgsize); class itkaclwrap { public: static int check(char *realm, char *user); }; int itkaclwrap::check(char *realm, char *user) { char itkacl_errmsg[1024]; int ret = itkacl_check(realm, user, itkacl_errmsg, 1024); if (ret == -1) { SWIG_exception(SWIG_RuntimeError,itkacl_errmsg); thrown: return -1; } else { return ret == 0; } } %} %pragma(php) code=" class itkacl { static function check($realm,$user) { return itkaclwrap_check($realm,$user); } } "