void acmp_controller_state_machine::common_hdr_init(uint32_t msg_type, struct jdksavdecc_frame *cmd_frame)
    {
        struct jdksavdecc_acmpdu_common_control_header acmpdu_common_ctrl_hdr;
        ssize_t acmpdu_common_ctrl_hdr_returned;
        ssize_t acmpdu_common_pos;

        /***** Offset to write the field to ****/
        acmpdu_common_pos = ETHER_HDR_SIZE;

        /******************* 1722 Protocol Header *********************/
        acmpdu_common_ctrl_hdr.cd = 1;
        acmpdu_common_ctrl_hdr.subtype = JDKSAVDECC_SUBTYPE_ACMP;
        acmpdu_common_ctrl_hdr.sv = 0;
        acmpdu_common_ctrl_hdr.version = 0;
        acmpdu_common_ctrl_hdr.message_type = msg_type;
        acmpdu_common_ctrl_hdr.status = JDKSAVDECC_ACMP_STATUS_SUCCESS;
        acmpdu_common_ctrl_hdr.control_data_length = 44;
        jdksavdecc_eui64_init(&acmpdu_common_ctrl_hdr.stream_id);

        /********************** Fill frame payload with AECP Common Control Header information *********************/
        acmpdu_common_ctrl_hdr_returned = jdksavdecc_acmpdu_common_control_header_write(&acmpdu_common_ctrl_hdr,
                                                                                        cmd_frame->payload,
                                                                                        acmpdu_common_pos,
                                                                                        sizeof(cmd_frame->payload));

        if(acmpdu_common_ctrl_hdr_returned < 0)
        {
            log_imp_ref->post_log_msg(LOGGING_LEVEL_ERROR, "acmpdu_common_ctrl_hdr_write error");
            assert(acmpdu_common_ctrl_hdr_returned >= 0);
        }
    }
void acmp_tx_state_avail( uint64_t tarker_entity_id, uint16_t tarker_unique_id )
{
	struct jdksavdecc_acmpdu acmp_cmd_get_tx_state;
	struct jdksavdecc_frame frame;
	acmp_frame_init_2( &frame );
	
        jdksavdecc_eui64_init( &acmp_cmd_get_tx_state.listener_entity_id );
        jdksavdecc_uint64_write( tarker_entity_id, &acmp_cmd_get_tx_state.talker_entity_id, 0, sizeof(uint64_t) );
        acmp_cmd_get_tx_state.talker_unique_id = tarker_unique_id;
        jdksavdecc_eui48_init(&acmp_cmd_get_tx_state.stream_dest_mac);

	acmp_form_msg( &frame, &acmp_cmd_get_tx_state,  JDKSAVDECC_ACMP_MESSAGE_TYPE_GET_TX_STATE_COMMAND, \
		acmp_sequence_id++,  acmp_cmd_get_tx_state.talker_entity_id, tarker_unique_id, acmp_cmd_get_tx_state.listener_entity_id, 0,\
		0 );
	
	system_raw_packet_tx( frame.dest_address.value, frame.payload, frame.length, RUNINFLIGHT, TRANSMIT_TYPE_ACMP, false);
}
    int descriptor_base_imp::default_send_lock_entity_cmd(descriptor_base_imp *descriptor_base_imp_ref, void *notification_id, uint32_t lock_entity_flag)
    {
        struct jdksavdecc_frame cmd_frame;
        struct jdksavdecc_aem_command_lock_entity aem_cmd_lock_entity;
        ssize_t aem_cmd_lock_entity_returned;

        /***************************************** AECP Common Data ******************************************/
        aem_cmd_lock_entity.aem_header.aecpdu_header.controller_entity_id = base_end_station_imp_ref->get_adp()->get_controller_entity_id();
        // Fill aem_cmd_lock_entity.sequence_id in AEM Controller State Machine
        aem_cmd_lock_entity.aem_header.command_type = JDKSAVDECC_AEM_COMMAND_LOCK_ENTITY;

        /****************************** AECP Message Specific Data ****************************/
        aem_cmd_lock_entity.aem_lock_flags = lock_entity_flag;
        jdksavdecc_eui64_init(&aem_cmd_lock_entity.locked_entity_id);
        aem_cmd_lock_entity.descriptor_type = descriptor_base_imp_ref->descriptor_type();
        aem_cmd_lock_entity.descriptor_index = descriptor_base_imp_ref->descriptor_index();

        /**************************** Fill frame payload with AECP data and send the frame **********************/
        aecp_controller_state_machine_ref->ether_frame_init(base_end_station_imp_ref->mac(), &cmd_frame,
                                ETHER_HDR_SIZE + JDKSAVDECC_AEM_COMMAND_LOCK_ENTITY_COMMAND_LEN);
        aem_cmd_lock_entity_returned = jdksavdecc_aem_command_lock_entity_write(&aem_cmd_lock_entity,
                                                                                   cmd_frame.payload,
                                                                                   ETHER_HDR_SIZE,
                                                                                   sizeof(cmd_frame.payload));

        if(aem_cmd_lock_entity_returned < 0)
        {
            log_imp_ref->post_log_msg(LOGGING_LEVEL_ERROR, "aem_cmd_lock_entity_write error\n");
            assert(aem_cmd_lock_entity_returned >= 0);
            return -1;
        }

        aecp_controller_state_machine_ref->common_hdr_init(JDKSAVDECC_AECP_MESSAGE_TYPE_AEM_COMMAND,
                                                            &cmd_frame,
                                                            base_end_station_imp_ref->entity_id(),
                                                            JDKSAVDECC_AEM_COMMAND_LOCK_ENTITY_COMMAND_LEN - 
                                                            JDKSAVDECC_COMMON_CONTROL_HEADER_LEN);
        system_queue_tx(notification_id, CMD_WITH_NOTIFICATION, cmd_frame.payload, cmd_frame.length);

        return 0;
    }
    int STDCALL stream_input_descriptor_imp::send_get_rx_state_cmd(void *notification_id)
    {
        struct jdksavdecc_frame *cmd_frame;
        struct jdksavdecc_acmpdu acmp_cmd_get_rx_state;
        int acmp_cmd_get_rx_state_returned;
        uint64_t listener_guid = base_end_station_imp_ref->get_entity_desc_by_index(0)->entity_id();

        cmd_frame = (struct jdksavdecc_frame *)malloc(sizeof(struct jdksavdecc_frame));

        /******************************************* ACMP Common Data ******************************************/
        acmp_cmd_get_rx_state.controller_entity_id = base_end_station_imp_ref->get_adp()->get_controller_guid();
        jdksavdecc_eui64_init(&acmp_cmd_get_rx_state.talker_entity_id);
        jdksavdecc_uint64_write(listener_guid, &acmp_cmd_get_rx_state.listener_entity_id, 0, sizeof(uint64_t));
        acmp_cmd_get_rx_state.talker_unique_id = 0;
        acmp_cmd_get_rx_state.listener_unique_id = descriptor_index();
        jdksavdecc_eui48_init(&acmp_cmd_get_rx_state.stream_dest_mac);
        acmp_cmd_get_rx_state.connection_count = 0;
        // Fill acmp_cmd_get_rx_state.sequence_id in AEM Controller State Machine
        acmp_cmd_get_rx_state.flags = 0;
        acmp_cmd_get_rx_state.stream_vlan_id = 0;

        /*************** Fill frame payload with AECP data and send the frame ***************/
        acmp_controller_state_machine_ref->ether_frame_init(cmd_frame);
        acmp_cmd_get_rx_state_returned = jdksavdecc_acmpdu_write(&acmp_cmd_get_rx_state,
                                                                 cmd_frame->payload,
                                                                 ETHER_HDR_SIZE,
                                                                 sizeof(cmd_frame->payload));

        if(acmp_cmd_get_rx_state_returned < 0)
        {
            log_imp_ref->post_log_msg(LOGGING_LEVEL_ERROR, "cmd_get_rx_state_write error\n");
            assert(acmp_cmd_get_rx_state_returned >= 0);
            return -1;
        }

        acmp_controller_state_machine_ref->common_hdr_init(JDKSAVDECC_ACMP_MESSAGE_TYPE_GET_RX_STATE_COMMAND, cmd_frame);
        system_queue_tx(notification_id, CMD_WITH_NOTIFICATION, cmd_frame->payload, cmd_frame->length);

        free(cmd_frame);
        return 0;
    }
Exemple #5
0
 void clear() {
     jdksavdecc_eui64_init( this );
 }
Exemple #6
0
 ///
 /// \brief Eui64 constructor
 ///
 /// Initialize all octets to 0xff
 ///
 Eui64() {
     jdksavdecc_eui64_init( this );
 }