X-Git-Url: https://git.sesse.net/?p=itkacl;a=blobdiff_plain;f=php5-itkacl-2.0%2Fitkacl.i;fp=php5-itkacl-2.0%2Fitkacl.i;h=18ae21cf56a4cc33f0cf2d477272a8ec9021e5fd;hp=0000000000000000000000000000000000000000;hb=de9a4d80bde793f8d6b266fa3c0e55ee618ecc1b;hpb=984e5ade2fc82719cdb7404d4babc68755040055 diff --git a/php5-itkacl-2.0/itkacl.i b/php5-itkacl-2.0/itkacl.i new file mode 100644 index 0000000..18ae21c --- /dev/null +++ b/php5-itkacl-2.0/itkacl.i @@ -0,0 +1,34 @@ +/* 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 %{ + /* This is due to Swig forgetting one file */ + #include + + 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); + } else { + return ret == 0; + } + } +%} +