예제 #1
0
func (s *DBusServer) RequestCommand(sender dbus.Sender, otype byte) (input, output dbus.UnixFD, derr *dbus.Error) {
	input = -1
	output = -1

	inPipe, outPipe, err := s.proc.RequestCommand(OutputType(otype))
	if err != nil {
		derr = newError("com.firelizzard.teasvc.Server.RequestCommandFailure", err.Error())
		return
	}

	if inPipe != nil {
		input = dbus.UnixFD(inPipe.Fd())
	}

	if outPipe != nil {
		output = dbus.UnixFD(outPipe.Fd())
	}

	return
}
예제 #2
0
func (s *DBusServer) SendCommand(sender dbus.Sender, otype byte, command string) (output dbus.UnixFD, derr *dbus.Error) {
	output = -1

	outPipe, err := s.proc.SendCommand(OutputType(otype), command)
	if err != nil {
		derr = newError("com.firelizzard.teasvc.Server.SendCommandFailure", err.Error())
		return
	}

	if outPipe != nil {
		output = dbus.UnixFD(outPipe.Fd())
	}

	return
}
예제 #3
0
	byteType        = reflect.TypeOf(byte(0))
	boolType        = reflect.TypeOf(false)
	uint8Type       = reflect.TypeOf(uint8(0))
	int16Type       = reflect.TypeOf(int16(0))
	uint16Type      = reflect.TypeOf(uint16(0))
	int32Type       = reflect.TypeOf(int32(0))
	uint32Type      = reflect.TypeOf(uint32(0))
	int64Type       = reflect.TypeOf(int64(0))
	uint64Type      = reflect.TypeOf(uint64(0))
	float64Type     = reflect.TypeOf(float64(0))
	stringType      = reflect.TypeOf("")
	signatureType   = reflect.TypeOf(dbus.Signature{})
	objectPathType  = reflect.TypeOf(dbus.ObjectPath(""))
	variantType     = reflect.TypeOf(dbus.Variant{})
	interfacesType  = reflect.TypeOf([]interface{}{})
	unixFDType      = reflect.TypeOf(dbus.UnixFD(0))
	unixFDIndexType = reflect.TypeOf(dbus.UnixFDIndex(0))
)

func alignment(t reflect.Type) int {
	switch t {
	case variantType:
		return 1
	case objectPathType:
		return 4
	case signatureType:
		return 1
	case interfacesType: // sometimes used for structs
		return 8
	}
	switch t.Kind() {