mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Add debugLevel and set iteration time python binding.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@674 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -33,6 +33,9 @@ c = pycryptsetup.CryptSetup(
|
|||||||
logFunc = log,
|
logFunc = log,
|
||||||
passwordDialog = askpassword)
|
passwordDialog = askpassword)
|
||||||
|
|
||||||
|
# c.debugLevel(-1);
|
||||||
|
c.debugLevel(0);
|
||||||
|
c.iterationTime(1)
|
||||||
r = c.isLuks()
|
r = c.isLuks()
|
||||||
print "isLuks :", r
|
print "isLuks :", r
|
||||||
c.askyes(message = "Is there anybody out there?")
|
c.askyes(message = "Is there anybody out there?")
|
||||||
|
|||||||
@@ -554,6 +554,38 @@ static PyObject *CryptSetup_Suspend(CryptSetupObject* self, PyObject *args, PyOb
|
|||||||
return PyObjectResult(crypt_suspend(self->device, self->activated_as));
|
return PyObjectResult(crypt_suspend(self->device, self->activated_as));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CryptSetup_debugLevel_HELP "Set debug level\n\n\
|
||||||
|
debugLevel(level)\n\n\
|
||||||
|
level - debug level"
|
||||||
|
|
||||||
|
static PyObject *CryptSetup_debugLevel(CryptSetupObject* self, PyObject *args, PyObject *kwds)
|
||||||
|
{
|
||||||
|
static char *kwlist[] = {"level", NULL};
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", kwlist, &level))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
crypt_set_debug_level(level);
|
||||||
|
return PyObjectResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CryptSetup_iterationTime_HELP "Set iteration time\n\n\
|
||||||
|
iterationTime(time_ms)\n\n\
|
||||||
|
time_ms - time in miliseconds"
|
||||||
|
|
||||||
|
static PyObject *CryptSetup_iterationTime(CryptSetupObject* self, PyObject *args, PyObject *kwds)
|
||||||
|
{
|
||||||
|
static char *kwlist[] = {"time_ms", NULL};
|
||||||
|
uint64_t time_ms = 0;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "l", kwlist, &time_ms))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
crypt_set_iterarion_time(self->device, time_ms);
|
||||||
|
return PyObjectResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
static PyMemberDef CryptSetup_members[] = {
|
static PyMemberDef CryptSetup_members[] = {
|
||||||
{"yesDialogCB", T_OBJECT_EX, offsetof(CryptSetupObject, yesDialogCB), 0, "confirmation dialog callback"},
|
{"yesDialogCB", T_OBJECT_EX, offsetof(CryptSetupObject, yesDialogCB), 0, "confirmation dialog callback"},
|
||||||
{"cmdLineLogCB", T_OBJECT_EX, offsetof(CryptSetupObject, cmdLineLogCB), 0, "logging callback"},
|
{"cmdLineLogCB", T_OBJECT_EX, offsetof(CryptSetupObject, cmdLineLogCB), 0, "logging callback"},
|
||||||
@@ -587,6 +619,10 @@ static PyMethodDef CryptSetup_methods[] = {
|
|||||||
{"resume", (PyCFunction)CryptSetup_Resume, METH_VARARGS|METH_KEYWORDS, CryptSetup_Resume_HELP},
|
{"resume", (PyCFunction)CryptSetup_Resume, METH_VARARGS|METH_KEYWORDS, CryptSetup_Resume_HELP},
|
||||||
{"suspend", (PyCFunction)CryptSetup_Suspend, METH_NOARGS, CryptSetup_Suspend_HELP},
|
{"suspend", (PyCFunction)CryptSetup_Suspend, METH_NOARGS, CryptSetup_Suspend_HELP},
|
||||||
|
|
||||||
|
/* misc */
|
||||||
|
{"debugLevel", (PyCFunction)CryptSetup_debugLevel, METH_VARARGS|METH_KEYWORDS, CryptSetup_debugLevel_HELP},
|
||||||
|
{"iterationTime", (PyCFunction)CryptSetup_iterationTime, METH_VARARGS|METH_KEYWORDS, CryptSetup_iterationTime_HELP},
|
||||||
|
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user