VLANs(802.1Q)forOMNet++  0.5Beta
MACVlanRelayUnitBase.cc File Reference
#include "MACVlanRelayUnitBase.h"
#include "MACAddress.h"
#include "EtherFrame_m.h"
#include "Ethernet.h"

Defines

#define MAX_LINE   100

Functions

static std::ostream & operator<< (std::ostream &os, const AddressEntry &e)
static char * fgetline (FILE *fp)
 Function reads from a file stream pointed to by 'fp' and stores characters until the '
' or EOF character is found, the resultant string is returned.

Define Documentation

#define MAX_LINE   100

Function Documentation

static char* fgetline ( FILE *  fp) [static]

Function reads from a file stream pointed to by 'fp' and stores characters until the '
' or EOF character is found, the resultant string is returned.

Note that neither '
' nor EOF character is stored to the resultant string, also note that if on a line containing useful data that EOF occurs, then that line will not be read in, hence must terminate file with unused line.

{
    // alloc buffer and read a line
    char *line = new char[MAX_LINE];
    if (fgets(line,MAX_LINE,fp)==NULL)
        return NULL;

    // chop CR/LF
    line[MAX_LINE-1] = '\0';
    int len = strlen(line);
    while (len>0 && (line[len-1]=='\n' || line[len-1]=='\r'))
        line[--len]='\0';

    return line;
}
static std::ostream& operator<< ( std::ostream &  os,
const AddressEntry e 
) [static]
{
    os << "port=" << e.portName  << "   insTime=" << e.insertionTime;
    return os;
}
 All Classes Files Functions Variables Typedefs Friends Defines