admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Quintiq file version 2.0
#parent: #root
Method SendDataRequestSetBulkTransmission (LibDEF_Systems targets_i, LibDEF_Set set_i, Boolean isNewSet_i, 
  NamedValueTree cachedSetNvt_i)
{
  Description: 'Send a Data-Request message of that Set which has been updated in DataRepository in bulk (non-chunked tranmission).'
  TextBody:
  [*
    nvt := LibDEF_DataAccessor::CreateMessageData();
    
    headerType := ifexpr( isNewSet_i, 
                          LibDEF_DataAccessor::TYPE_DATA_SETCREATED(), 
                          LibDEF_DataAccessor::TYPE_DATA_SETUPDATED() );
    
    // define Type and required Header
    LibDEF_DataAccessor::SetDataHeaderProperty( nvt, LibDEF_DataAccessor::HEADER_TYPE(),           headerType );
    LibDEF_DataAccessor::SetDataHeaderProperty( nvt, LibDEF_DataAccessor::HEADER_SETGUID(),        set_i.GUID() );
    LibDEF_DataAccessor::SetDataHeaderProperty( nvt, LibDEF_DataAccessor::HEADER_SETLASTUPDATED(), set_i.LastUpdated() );
    
    // Fill in the data body of the NVT message with the Set (either with the given cached Set NVT or export a new NVT from the Set).
    // To save performance cost on exporting the set, a cached Set NVT can be given by the caller method
    // so we don't need to do the NVTIO::Export anymore.
    if( not isnull( cachedSetNvt_i ) )
    {
      LibDEF_DataAccessor::SetDataBody( nvt, cachedSetNvt_i );
    }
    else
    {
      LibDEF_DataAccessor::SetDataBody( nvt, NamedValueTreeIO::Export( set_i ) );
    }
    
    // some local variables
    channel    := set_i.SetType().Channel();
    dataBroker := this.DataBroker();
    
    traverse( targets_i, Elements, target )
    {
      event := dataBroker.EventCreate( target, false );
      LibDEF_Util::EventLog( event, "Sending " + headerType + " request to system '" + target.Name() + "'" );
    
      dataBroker.SendData( target, nvt, LibDEF_DataAccessor::KIND_REQUEST(), event,
                           channel.Name(), channel.MajorVersion(), channel.MinorVersion() );
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}