コード例 #1
0
// IR reads device change request from CN socket.
func (request *DeviceChangeRequest) ReadNodeRequest(reader io.Reader) (read int64, err error) {
	bytesRead, err := common.ExpectHeader(reader, HeaderNodeDeviceChange)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadUUID(reader, &request.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadDevice(reader, &request.Current)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadDevice(reader, &request.Previous)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadString(reader, &request.ServiceName)
	read += bytesRead
	if err != nil {
		return
	}
	return
}
コード例 #2
0
ファイル: deliver.go プロジェクト: kitcambridge/hermes-go
// Service reads message delivery ACK from OR socket. Useful for tests and Go
// services.
func (reply *DeliverReply) ReadServiceReply(reader io.Reader) (read int64, err error) {
	bytesRead, err := common.ExpectHeader(reader, HeaderServiceDeliver)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadUUID(reader, &reply.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadInt(reader, &reply.Response)
	read += bytesRead
	if err != nil {
		return
	}
	return
}
コード例 #3
0
// CN reads ACK from IR socket.
func (reply *DeviceChangeReply) ReadNodeReply(reader io.Reader) (read int64, err error) {
	bytesRead, err := common.ExpectHeader(reader, HeaderNodeDeviceChange)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadUUID(reader, &reply.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	// One of: `StatusNodeDelivered`, `StatusNodeSpooled`,
	// `StatusNodeUnavailable`.
	bytesRead, err = common.ReadInt(reader, &reply.Response)
	read += bytesRead
	if err != nil {
		return
	}
	return
}
コード例 #4
0
ファイル: deliver.go プロジェクト: kitcambridge/hermes-go
// OR reads delivery request from Service socket.
func (request *DeliverRequest) ReadServiceRequest(reader io.Reader) (read int64, err error) {
	bytesRead, err := common.ExpectHeader(reader, HeaderServiceDeliver)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadUUID(reader, &request.MessageId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadDevice(reader, &request.DeviceId)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadString(reader, &request.Data)
	read += bytesRead
	if err != nil {
		return
	}
	return
}