Example #1
0
// IR reads delivery request from CN socket.
func (request *DeliverRequest) ReadNodeRequest(reader io.Reader) (read int64, err error) {
	bytesRead, err := common.ExpectHeader(reader, HeaderNodeDeliver)
	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.Device)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadString(reader, &request.ServiceName)
	read += bytesRead
	if err != nil {
		return
	}
	bytesRead, err = common.ReadString(reader, &request.Data)
	read += bytesRead
	if err != nil {
		return
	}
	return
}
Example #2
0
// 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
}