Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
Like this article? We recommend

A Generic Network Link

The first entity we need to model is that of a network link. At the top of my inheritance hierarchy is a class that represents any network link type, whether the link technology is MPLS, ATM, frame relay, etc. That is, I need a generic link class (called GenericLink), as shown in Listing 2.

Listing 2 Generic network link.

class GenericLink
{
public:
  explicit GenericLink(GenericLinkContext*, char*, char*, char*, char*);
  virtual ~GenericLink(void);

protected:
  GenericLinkContext* linkContext;

public:
  int mySlotNumber;

private:
  char* NodeA;
  char* NodeB;
  char* InterfaceA; // Each interface can support many IP addresses
  char* InterfaceB; // Each interface can support many IP addresses
};

The private data members in GenericLink describe the location of a link in the network—the link joins two interfaces on two nodes. We want to add IP addresses to this data, and the protected data member GenericLinkContext is used for this purpose, as I’ll explain in the next section. We’ll also see the significance of the public data member mySlotNumber.

  • + Share This
  • 🔖 Save To Your Account