Пример #1
0
func (ct *Container) AddController(ctype int) error {
	if ret := C.libct_controller_add(ct.ct, C.enum_ct_controller(ctype)); ret != 0 {
		return LibctError{int(ret)}
	}

	return nil
}
Пример #2
0
func (ct *Container) ReadController(ctype int, param string) (string, error) {
	cparam := C.CString(param)
	defer C.free(unsafe.Pointer(cparam))

	buf := make([]byte, 4096)

	ret := C.libct_controller_read(ct.ct, C.enum_ct_controller(ctype), cparam, unsafe.Pointer(&buf[0]), 4096)
	if ret < 0 {
		return "", LibctError{int(ret)}
	}

	return string(buf[:ret]), nil
}
Пример #3
0
func (ct *Container) ConfigureController(ctype int, param string, value string) error {
	cparam := C.CString(param)
	defer C.free(unsafe.Pointer(cparam))
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))

	ret := C.libct_controller_configure(ct.ct, C.enum_ct_controller(ctype), cparam, cvalue)
	if ret != 0 {
		return LibctError{int(ret)}
	}

	return nil
}