
  PROCEDURE [INLINE] nlp$cc_grant_credits
    (    connection { input, output } : ^nlt$cc_connection);

?? PUSH (LISTEXT := ON) ??
?? RIGHT := 110 ??
*copy nlh$cc_grant_credits

    VAR
      actual: integer,
      cc_header: nlt$cc_protocol_header,
      cc_pdu: nlt$bm_message_id,
      data_fragments: array [1 .. 1] of nat$data_fragment,
      ignore_status: ost$status;

    cc_header.credit_allocation.credits_granted := nlp$cc_obtain_credits (connection);
    IF cc_header.credit_allocation.credits_granted > 0 THEN
      connection^.receive_credits := connection^.receive_credits +
            cc_header.credit_allocation.credits_granted;
      cc_header.kind := nlc$cc_credit_allocation;
      cc_header.length := #SIZE (nlt$cc_protocol_header);
      cc_header.credit_allocation.destination_reference := connection^.peer_reference_number;
      cc_header.credit_allocation.class := nlc$cc_priority_class;
      data_fragments [1].address := ^cc_header;
      data_fragments [1].length := #SIZE (nlt$cc_protocol_header);
      nlp$bm_create_message (data_fragments, cc_pdu, ignore_status);
      nlp$cc_send_pdu (connection^.device_specific_attributes.device_id, nlc$cc_priority_class, cc_pdu);

{! statistics begin}

      IF nav$statistics_enabled THEN
        osp$increment_locked_variable (nav$global_osi_statistics.
              channel_connection_device^ [connection^.device_specific_attributes.device_id].credit_pdus_sent,
              0, actual);
      IFEND;

{! statistics end}

    IFEND;

  PROCEND nlp$cc_grant_credits;

*copyc nat$data_fragments
*copyc nlt$bm_message_id
*copyc nlt$cc_protocol_data_unit
*copyc ost$status
*copyc nlp$bm_create_message
*copyc nlp$cc_obtain_credits
*copyc nlp$cc_send_pdu
*copyc osp$increment_locked_variable
*copyc nav$global_osi_statistics
*copyc nav$statistics_enabled
?? POP ??
