<commit_before>/*
*   Simulation to test HttpGeneratorClient and Server in a simple point to
*   point escenary
*/

#include "ns3/core-module.h"
#include "ns3/applications-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "HttpGeneratorClientHelper.h"
#include "HttpGeneratorClient.h"
#include "HttpGeneratorServerHelper.h"
#include "HttpGeneratorServer.h"

#define PORT 9

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("simulation");

int main (int argc, char *argv[]) 
{

    //Default values
    DataRate datarate("100Mbps");
    uint32_t requestSize = 100;
    uint32_t responseSize = 10000;
    Time     delay("5ms");
    bool     tracing = true;

    //Command line parsing
    CommandLine cmd;
    cmd.AddValue ("tracing", "flag to enable/disable pcap tracing", tracing);
    cmd.AddValue ("datarate", "datarate for point to point link", datarate);
    cmd.AddValue ("requestSize", "size of Http request in bytes", requestSize);
    cmd.AddValue ("responseSize", "size of Http response in bytes", responseSize);
    cmd.AddValue ("delay", "channel delay", delay);
    cmd.Parse (argc, argv);

    /*********************
    * Scenary creation   *
    **********************/

    //Creating client nodes (client and server)
    NodeContainer nodes;
    nodes.Create (2);

    PointToPointHelper pointToPoint;
    pointToPoint.SetDeviceAttribute ("DataRate", DataRateValue(datarate));
    pointToPoint.SetChannelAttribute ("Delay", TimeValue(delay));

    NetDeviceContainer devices;
    devices = pointToPoint.Install (nodes);

    //Install the internet stack on the nodes
    InternetStackHelper internet;
    internet.Install (nodes);

    Ipv4AddressHelper ipv4;
    ipv4.SetBase ("10.1.1.0", "255.255.255.0");
    Ipv4InterfaceContainer interfaces = ipv4.Assign (devices);

    /******************************
    * Applications installation   *
    *******************************/

    //HERE WE HAVE TO INSTALL CLIENT APP
    HttpGeneratorClientHelper httpClient ("ns3::TcpSocketFactory", InetSocketAddress (interfaces.GetAddress (1), PORT));        
    ApplicationContainer httpClientApp1 = httpClient.Install (nodes.Get (0));
    //ApplicationContainer httpClientApp2 = httpClient.Install (nodes.Get (1));

    httpClientApp1.Start (Seconds(1.0));
    httpClientApp1.Stop  (Seconds(60.0)); 
    //httpClientApp2.Start (Seconds(1.0));
    //httpClientApp2.Stop  (Seconds(60.0)); 

    //HERE WE HAVE TO INSTALL SERVER APP
    HttpGeneratorServerHelper httpServer ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), PORT));
    ApplicationContainer httpServerApp = httpServer.Install (nodes.Get (1));
    httpServerApp.Start (Seconds (1.0));
    httpServerApp.Stop  (Seconds (60.0));

    if (tracing) {
       pointToPoint.EnablePcapAll ("httpGenerator");
    }
    /*************************
    * Simulation execution   *
    **************************/
    NS_LOG_INFO ("Start Simulation");
    Simulator::Run();
    Simulator::Destroy ();
}<commit_msg>Simulation for test multiple http clients<commit_after>/*
*   Simulation to test HttpGeneratorClient and Server in a simple point to
*   point escenary
*/

#include "ns3/core-module.h"
#include "ns3/applications-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
//#include "ns3/point-to-point-module.h"
#include "ns3/csma-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "HttpGeneratorClientHelper.h"
#include "HttpGeneratorClient.h"
#include "HttpGeneratorServerHelper.h"
#include "HttpGeneratorServer.h"

#define PORT 9

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("simulation");

int main (int argc, char *argv[]) 
{
    GlobalValue::Bind("ChecksumEnabled", BooleanValue(true));
    Time::SetResolution (Time::US);

    //Default values
    DataRate datarate("100Mbps");
    uint32_t requestSize = 100;
    uint32_t responseSize = 10000;
    Time     delay("5ms");
    bool     tracing = true;

    //Command line parsing
    CommandLine cmd;
    cmd.AddValue ("tracing", "flag to enable/disable pcap tracing", tracing);
    cmd.AddValue ("datarate", "datarate for point to point link", datarate);
    cmd.AddValue ("requestSize", "size of Http request in bytes", requestSize);
    cmd.AddValue ("responseSize", "size of Http response in bytes", responseSize);
    cmd.AddValue ("delay", "channel delay", delay);
    cmd.Parse (argc, argv);

    /*********************
    * Scenary creation   *
    **********************/

    //Creating client nodes (client and server)
    NodeContainer nodes;
    nodes.Create (3);

    CsmaHelper csma;
    csma.SetChannelAttribute ("DataRate", DataRateValue(datarate));
    csma.SetChannelAttribute ("Delay", TimeValue(delay));

    NetDeviceContainer devices;
    devices = csma.Install (nodes);

    //Install the internet stack on the nodes
    InternetStackHelper internet;
    internet.Install (nodes);

    Ipv4AddressHelper ipv4;
    ipv4.SetBase ("10.1.1.0", "255.255.255.0");
    Ipv4InterfaceContainer interfaces = ipv4.Assign (devices);

    /******************************
    * Applications installation   *
    *******************************/

    //HERE WE HAVE TO INSTALL CLIENT APP
    HttpGeneratorClientHelper httpClient ("ns3::TcpSocketFactory", InetSocketAddress (interfaces.GetAddress (2), PORT));        
    ApplicationContainer httpClientApp1 = httpClient.Install (nodes.Get (0));
    ApplicationContainer httpClientApp2 = httpClient.Install (nodes.Get (1));

    httpClientApp1.Start (Seconds(1.0));
    httpClientApp1.Stop  (Seconds(60.0)); 
    httpClientApp2.Start (Seconds(1.0));
    httpClientApp2.Stop  (Seconds(60.0)); 

    //HERE WE HAVE TO INSTALL SERVER APP
    HttpGeneratorServerHelper httpServer ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), PORT));
    ApplicationContainer httpServerApp = httpServer.Install (nodes.Get (2));
    httpServerApp.Start (Seconds (1.0));
    httpServerApp.Stop  (Seconds (60.0));

    if (tracing) {
       csma.EnablePcapAll ("httpGenerator");
    }
    /*************************
    * Simulation execution   *
    **************************/
    NS_LOG_INFO ("Start Simulation");
    Simulator::Run();
    Simulator::Destroy ();
}
{'fraction_non_alphanumeric': 0.16629746835443038, 'fraction_numerical': 0.02357594936708861, 'mean_word_length': 4.004750593824228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3910122', 'n_tokens_mistral': 1968, 'n_tokens_neox': 1868, 'n_words': 461}