// SendProprietaryPayload send a payload using the 'Proprietary' LoRaWAN message-type.
969364
func (n *NetworkServerAPI) SendProprietaryPayload(ctx context.Context, req *ns.SendProprietaryPayloadRequest) (*empty.Empty, error) {
	var mic lorawan.MIC
	var gwIDs []lorawan.EUI64

	copy(mic[:], req.Mic)
	for i := range req.GatewayMacs {
		var id lorawan.EUI64
		copy(id[:], req.GatewayMacs[i])
		gwIDs = append(gwIDs, id)
	}

	err := proprietarydown.Handle(req.MacPayload, mic, gwIDs, req.PolarizationInversion, int(req.Frequency), int(req.Dr))
	if err != nil {
		return nil, errToRPCError(err)
	}

	return &empty.Empty{}, nil
}
581706
func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK {
	o.Payload = payload
	return o
}
454999
func (p *CONNECT) setPayload() {
	// Append the Client Identifier to the payload.
	p.payload = appendLenStr(p.payload, p.clientID)

	// Append the Will Topic and the Will Message to the payload
	// if the Packet has them.
	if p.will() {
		p.payload = appendLenStr(p.payload, p.willTopic)
		p.payload = appendLenStr(p.payload, p.willMessage)
	}

	// Append the User Name to the payload if the Packet has it.
	if len(p.userName) > 0 {
		p.payload = appendLenStr(p.payload, p.userName)
	}

	// Append the Password to the payload if the Packet has it.
	if len(p.password) > 0 {
		p.payload = appendLenStr(p.payload, p.password)
	}
}
501760
func (p *PHYPayload) EncryptFRMPayload(key AES128Key) error {
	macPL, ok := p.MACPayload.(*MACPayload)
	if !ok {
		return errors.New("lorawan: MACPayload must be of type *MACPayload")
	}

	// nothing to encrypt
	if len(macPL.FRMPayload) == 0 {
		return nil
	}

	data, err := macPL.marshalPayload()
	if err != nil {
		return err
	}

	data, err = EncryptFRMPayload(key, p.isUplink(), macPL.FHDR.DevAddr, macPL.FHDR.FCnt, data)
	if err != nil {
		return err
	}

	// store the encrypted data in a DataPayload
	macPL.FRMPayload = []Payload{&DataPayload{Bytes: data}}

	return nil
}
687697
func (o *GetDebuginfoFailure) WithPayload(payload models.Error) *GetDebuginfoFailure {
	o.Payload = payload
	return o
}
56372
func GetChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error) {
	cpp := &peer.ChaincodeProposalPayload{}
	err := proto.Unmarshal(bytes, cpp)
	return cpp, errors.Wrap(err, "error unmarshaling ChaincodeProposalPayload")
}
848888
func (o *FindTodosDefault) WithPayload(payload *models.Error) *FindTodosDefault {
	o.Payload = payload
	return o
}
935860
func (s *GossipStateProviderImpl) AddPayload(payload *proto.Payload) error {
	return s.addPayload(payload, s.config.BlockingMode)
}
725295
func (w *WebRTCSignalMessage) ParsePayload() (*Payload, error) {
	w.mu.Lock()
	defer w.mu.Unlock()

	if w.isParsed {
		return w.parsedPayload, nil
	}

	payload := &Payload{}
	if err := json.Unmarshal(w.Payload, payload); err != nil {
		return nil, err
	}

	w.parsedPayload = payload
	return payload, nil
}
735830
func (s *InvokeInput) SetPayload(v []byte) *InvokeInput {
	s.Payload = v
	return s
}
375766
func (m *Message) PopPayload() (data []byte, err error) {
	if m.payload.Empty() {
		err = errors.New("No payload available")
		return
	}

	data = m.payload.Pop().([]byte)

	return
}
838778
func SendProposal(reqCtx reqContext.Context, proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error) {

	if proposal == nil {
		return nil, errors.New("proposal is required")
	}

	if len(targets) < 1 {
		return nil, errors.New("targets is required")
	}

	for _, p := range targets {
		if p == nil {
			return nil, errors.New("target is nil")
		}
	}

	targets = getTargetsWithoutDuplicates(targets)

	ctx, ok := context.RequestClientContext(reqCtx)
	if !ok {
		return nil, errors.New("failed get client context from reqContext for signProposal")
	}
	signedProposal, err := signProposal(ctx, proposal.Proposal)
	if err != nil {
		return nil, errors.WithMessage(err, "sign proposal failed")
	}

	request := fab.ProcessProposalRequest{SignedProposal: signedProposal}

	var responseMtx sync.Mutex
	var transactionProposalResponses []*fab.TransactionProposalResponse
	var wg sync.WaitGroup
	errs := multi.Errors{}

	for _, p := range targets {
		wg.Add(1)
		go func(processor fab.ProposalProcessor) {
			defer wg.Done()

			// TODO: The RPC should be timed-out.
			//resp, err := processor.ProcessTransactionProposal(context.NewRequestOLD(ctx), request)
			resp, err := processor.ProcessTransactionProposal(reqCtx, request)
			if err != nil {
				logger.Debugf("Received error response from txn proposal processing: %s", err)
				responseMtx.Lock()
				errs = append(errs, err)
				responseMtx.Unlock()
				return
			}

			responseMtx.Lock()
			transactionProposalResponses = append(transactionProposalResponses, resp)
			responseMtx.Unlock()
		}(p)
	}
	wg.Wait()

	return transactionProposalResponses, errs.ToError()
}
34275
func (o *GetItemsOK) WithPayload(payload []models.Item) *GetItemsOK {
	o.Payload = payload
	return o
}
664954
func (o *GetOrdersForItemDefault) WithPayload(payload *models.Error) *GetOrdersForItemDefault {
	o.Payload = payload
	return o
}
225510
func (o *PutPolicyFailure) WithPayload(payload models.Error) *PutPolicyFailure {
	o.Payload = payload
	return o
}
955975
func (o *PostIPAMFailure) WithPayload(payload models.Error) *PostIPAMFailure {
	o.Payload = payload
	return o
}
1170103
func (o *PutPolicyOK) WithPayload(payload *models.Policy) *PutPolicyOK {
	o.Payload = payload
	return o
}