func (request *DeviceList) ReadNodeRequest(reader io.Reader) (read int64, err error) { bytesRead, err := common.ExpectHeader(reader, HeaderNodeDeviceList) read += bytesRead if err != nil { return } var length int bytesRead, err = common.ReadInt(reader, &length) read += bytesRead if err != nil { return } devices := make([]common.Device, length) for index := 0; index < length; index++ { device := new(common.Device) bytesRead, err = common.ReadDevice(reader, device) read += bytesRead if err != nil { return } devices[index] = *device } request.Devices = devices return }
// OR reads HELO packet from CN socket. func (helo *NodeHelo) ReadNodeRequest(reader io.Reader) (read int64, err error) { bytesRead, err := common.ExpectHeader(reader, HeaderNodeHelo) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &helo.Version) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &helo.MaxBatch) read += bytesRead if err != nil { return } return }
// Service reads HELO reply from OR socket. Useful for tests and Go services. func (helo *ServiceHelo) ReadServiceReply(reader io.Reader) (read int64, err error) { bytesRead, err := common.ExpectHeader(reader, HeaderServiceHelo) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &helo.Version) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &helo.MaxBatch) read += bytesRead if err != nil { return } return }
// 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 }
// OR reads HELO request from Service socket. func (helo *ServiceHelo) ReadServiceRequest(reader io.Reader) (read int64, err error) { bytesRead, err := common.ExpectHeader(reader, HeaderServiceHelo) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &helo.Version) read += bytesRead if err != nil { return } bytesRead, err = common.ReadString(reader, &helo.ServiceName) read += bytesRead if err != nil { return } return }
func (request *ConnChange) ReadNodeRequest(reader io.Reader) (read int64, err error) { bytesRead, err := common.ExpectHeader(reader, HeaderNodeConnChange) read += bytesRead if err != nil { return } bytesRead, err = common.ReadDevice(reader, &request.DeviceId) read += bytesRead if err != nil { return } bytesRead, err = common.ReadInt(reader, &request.Change) read += bytesRead if err != nil { return } return }
// 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 }