Class: ClamAV
- Inherits:
-
Object
- Object
- ClamAV
- Defined in:
- ext/clamav/clamav.c
Class Method Summary collapse
Instance Method Summary collapse
- #getlimit(v_limit) ⇒ Object
- #getstring(v_param) ⇒ Object
- #initialize ⇒ Object constructor
- #reload ⇒ Object
- #scanfile ⇒ Object
- #setlimit(v_limit, v_value) ⇒ Object
- #setstring(v_param, v_value) ⇒ Object
- #signo ⇒ Object
Constructor Details
#initialize ⇒ Object
74 75 76 |
# File 'ext/clamav/clamav.c', line 74 static VALUE clamavr_initialize(VALUE self) { return self; } |
Class Method Details
.new ⇒ Object
23 24 |
# File 'ext/clamav/clamav.c', line 23 static VALUE clamavr_new(argc, argv, klass) int argc; |
Instance Method Details
#getlimit(v_limit) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'ext/clamav/clamav.c', line 93
static VALUE clamavr_getlimit(VALUE self, VALUE v_limit) {
Check_Type(v_limit, T_FIXNUM);
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
int ret;
int err;
ret = cl_engine_get_num(ptr->root, FIX2INT(v_limit), &err);
if(err != CL_SUCCESS) {
rb_raise(rb_eRuntimeError, "cl_engine_get_num() error: %s\n", cl_strerror(err));
}
return INT2NUM(ret);
}
|
#getstring(v_param) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'ext/clamav/clamav.c', line 123
static VALUE clamavr_getstring(VALUE self, VALUE v_param) {
Check_Type(v_param, T_FIXNUM);
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
const char *result;
int err;
result = cl_engine_get_str(ptr->root, FIX2INT(v_param), &err);
if(err != CL_SUCCESS) {
rb_raise(rb_eRuntimeError, "cl_engine_get_str() error: %s\n", cl_strerror(err));
}
if(result == NULL){
return Qnil;
}
return rb_str_new2(result);
}
|
#reload ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'ext/clamav/clamav.c', line 174
static VALUE clamavr_dbreload(VALUE self) {
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
int state;
state = cl_statchkdir(&ptr->dbstat);
if(state == 1) {
const char *dbdir;
dbdir = cl_retdbdir();
int ret;
ret = cl_load(dbdir, ptr->root, &ptr->signo, FIX2INT(ptr->db_options));
if(ret != CL_SUCCESS) {
rb_raise(rb_eRuntimeError, "cl_load() error: %s\n", cl_strerror(ret));
}
cl_statfree(&ptr->dbstat);
cl_statinidir(dbdir, &ptr->dbstat);
}
return INT2FIX(state);
}
|
#scanfile ⇒ Object
145 146 |
# File 'ext/clamav/clamav.c', line 145 static VALUE clamavr_scanfile(argc, argv, klass) int argc; |
#setlimit(v_limit, v_value) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'ext/clamav/clamav.c', line 78
static VALUE clamavr_setlimit(VALUE self, VALUE v_limit, VALUE v_value) {
Check_Type(v_limit, T_FIXNUM);
Check_Type(v_value, T_FIXNUM);
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
int ret;
ret = cl_engine_set_num(ptr->root, FIX2INT(v_limit), FIX2INT(v_value));
if(ret != CL_SUCCESS) {
rb_raise(rb_eRuntimeError, "cl_engine_set_num() error: %s\n", cl_strerror(ret));
}
return INT2FIX(ret);
}
|
#setstring(v_param, v_value) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'ext/clamav/clamav.c', line 108
static VALUE clamavr_setstring(VALUE self, VALUE v_param, VALUE v_value) {
Check_Type(v_param, T_FIXNUM);
Check_Type(v_value, T_STRING);
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
int ret;
ret = cl_engine_set_str(ptr->root, FIX2INT(v_param), RSTRING(v_value)->ptr);
if(ret != CL_SUCCESS) {
rb_raise(rb_eRuntimeError, "cl_engine_set_str() error: %s\n", cl_strerror(ret));
}
return INT2FIX(ret);
}
|
#signo ⇒ Object
139 140 141 142 143 |
# File 'ext/clamav/clamav.c', line 139
static VALUE clamavr_signo(VALUE self) {
struct ClamAV_R *ptr;
Data_Get_Struct(self, struct ClamAV_R, ptr);
return UINT2NUM(ptr->signo);
}
|