OMNeT++ Routing Protocol

OMNeT++ Routing Protocol is the process of selecting minimum distance,cost or path for passing message to destination node.There are different types of routing protocol method based on its types and requirements.We guide you complete information about implementing OMNeT++ Routing Tutorial about issues faced in a network and how to overcome with different techniques and its advantages.

OMNeT++ Routing Architecture

Issues of routing:

  • Decision making.
  • Routing protocol must intelligently summarize relevant information.
  • Each router must know something about global state.
  • Global states are,
    • Hard to collect.
    • Inherently large.
    • Dynamic.

Requirements of routing:

  • Achieve robustness by avoiding black holes, oscillations and loops.
  • Use optimal path.
  • Minimize number and frequency of control messages.
  • Minimize routing table space like less to exchange and fast to look up.

OMNeT++ Routing Tutorial

Download Sample Source Code for OMNeT Routing Protocol

[code lang="js"]
int RoutingTableParser::readRoutingTableFromFile(const char *filename)
    FILE *fp;
    int charpointer;
    char *file = new char[MAX_FILESIZE];
    char *ifconfigFile = NULL;
    char *routeFile = NULL;
    fp = fopen(filename, "r");
    if (fp == NULL)
        throw cRuntimeError("Error opening routing table file `%s'", filename);
    // read the whole into the file[] char-array
    for (charpointer = 0;
         (file[charpointer] = getc(fp)) != EOF;
    for (; charpointer < MAX_FILESIZE; charpointer++)
        file[charpointer] = '\0';
    //    file[++charpointer] = '\0';
    // copy file into specialized, filtered char arrays
    for (charpointer = 0;
         (charpointer < MAX_FILESIZE) && (file[charpointer] != EOF);
         charpointer++) {
        // check for tokens at beginning of file or line
        if (charpointer == 0 || file[charpointer - 1] == '\n') {
            // copy into ifconfig filtered chararray
            if (streq(file + charpointer, IFCONFIG_START_TOKEN)) {
                ifconfigFile = createFilteredFile(file,
                //PRINTF("Filtered File 1 created:\n%s\n", ifconfigFile);
            // copy into route filtered chararray
            if (streq(file + charpointer, ROUTE_START_TOKEN)) {
                routeFile = createFilteredFile(file,
                //PRINTF("Filtered File 2 created:\n%s\n", routeFile);
    delete [] file;
    // parse filtered files
    if (ifconfigFile)
    if (routeFile)
    delete [] ifconfigFile;
    delete [] routeFile;