SlideShare a Scribd company logo
Network.h
#ifndef NETWORK_H
#define NETWORK_H
#include "copyright.h"
#include "utility.h“

When using ifndef conditional we mean the specialist to
see if a macro identifier is defined or not.
class Network {
  public:
  Network(NetworkAddress addr, double reliability,
    VoidFunctionPtr readAvail, VoidFunctionPtr
writeDone, int callArg);
~Network();         // De-allocate the network driver
data
    void Send(PacketHeader hdr, char* data);

  PacketHeader Receive(char* data);
          void SendDone();
          void CheckPktAvail();
typedef int NetworkAddress;

class PacketHeader {
public:
 NetworkAddress to;       // Destination machine ID
 NetworkAddress from;    // source machine ID
 unsigned length;        // bytes of packet data
};

#define MaxWireSize 64        // largest packet that can
go out on the wire.
#define MaxPacketSize
private:
  NetworkAddress ident; // This machine's network
address
  double chanceToWork;      // Likelihood packet will be
dropped
  int sock;        // UNIX socket number for incoming
packets
  char sockName[32];
  VoidFunctionPtr writeHandler;
 VoidFunctionPtr readHandler;
int handlerArg;     // Argument to be passed to
interrupt handler
         bool sendBusy;
         bool packetAvail;
// network
  PacketHeader inHdr;

char inbox[MaxPacketSize];
};

#endif

More Related Content

PPT
ACIT - CCNA Training India - VPN
DOCX
I psec tunnel vs transport mode
ODP
PDF
TLB - rocket booster for your build
PPTX
Translation lookaside buffer
PPT
Translation Lookaside Buffer & Inverted Page Table
PPTX
Implementation of page table
ACIT - CCNA Training India - VPN
I psec tunnel vs transport mode
TLB - rocket booster for your build
Translation lookaside buffer
Translation Lookaside Buffer & Inverted Page Table
Implementation of page table

Similar to Network.h (20)

PPT
Introduction to Computer Networks
ODP
Nach os network
ODP
Nach os network
ODP
Nach os network
DOCX
Networking concept with chat server programming
PPT
Fundamentals and Basics
PPTX
ch1_vbest.pptx
PDF
IT Networks and Vulnarabilities .pdf
PPT
Ccna introduction
PPT
chapter1.ppt
PPT
chapter1.ppt
PPT
chapter1.ppt
PPTX
Computer Networks IEEE 802.3 standard-2021.pptx
PPT
Telecom Network
PPT
Networks (Distributed computing)
PPT
chapter1.ppt
PPT
Chapter9
PPT
chapter1.ppt
PPT
chapter1.ppt
Introduction to Computer Networks
Nach os network
Nach os network
Nach os network
Networking concept with chat server programming
Fundamentals and Basics
ch1_vbest.pptx
IT Networks and Vulnarabilities .pdf
Ccna introduction
chapter1.ppt
chapter1.ppt
chapter1.ppt
Computer Networks IEEE 802.3 standard-2021.pptx
Telecom Network
Networks (Distributed computing)
chapter1.ppt
Chapter9
chapter1.ppt
chapter1.ppt
Ad

More from naniix21_3 (13)

ODP
Semaphore
ODP
Encriptacion
ODP
ODP
Semaphore
ODP
ODP
Encriptacion
ODP
ODP
ODP
Encriptacion
ODP
Clock
ODP
Sockets in nach0s
ODP
Security
ODP
Sockets
Semaphore
Encriptacion
Semaphore
Encriptacion
Encriptacion
Clock
Sockets in nach0s
Security
Sockets
Ad

Recently uploaded (20)

PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Empowerment Technology for Senior High School Guide
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
IGGE1 Understanding the Self1234567891011
PDF
HVAC Specification 2024 according to central public works department
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
Computer Architecture Input Output Memory.pptx
Introduction to pro and eukaryotes and differences.pptx
Empowerment Technology for Senior High School Guide
Practical Manual AGRO-233 Principles and Practices of Natural Farming
IGGE1 Understanding the Self1234567891011
HVAC Specification 2024 according to central public works department
Indian roads congress 037 - 2012 Flexible pavement
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
My India Quiz Book_20210205121199924.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Share_Module_2_Power_conflict_and_negotiation.pptx
Unit 4 Computer Architecture Multicore Processor.pptx
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)

Network.h

  • 2. #ifndef NETWORK_H #define NETWORK_H #include "copyright.h" #include "utility.h“ When using ifndef conditional we mean the specialist to see if a macro identifier is defined or not.
  • 3. class Network { public: Network(NetworkAddress addr, double reliability, VoidFunctionPtr readAvail, VoidFunctionPtr writeDone, int callArg); ~Network(); // De-allocate the network driver data void Send(PacketHeader hdr, char* data); PacketHeader Receive(char* data); void SendDone(); void CheckPktAvail();
  • 4. typedef int NetworkAddress; class PacketHeader { public: NetworkAddress to; // Destination machine ID NetworkAddress from; // source machine ID unsigned length; // bytes of packet data }; #define MaxWireSize 64 // largest packet that can go out on the wire. #define MaxPacketSize
  • 5. private: NetworkAddress ident; // This machine's network address double chanceToWork; // Likelihood packet will be dropped int sock; // UNIX socket number for incoming packets char sockName[32]; VoidFunctionPtr writeHandler; VoidFunctionPtr readHandler;
  • 6. int handlerArg; // Argument to be passed to interrupt handler bool sendBusy; bool packetAvail; // network PacketHeader inHdr; char inbox[MaxPacketSize]; }; #endif