SlideShare ist ein Scribd-Unternehmen logo
1 von 6
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

Weitere ähnliche Inhalte

Ähnlich wie Network.h

#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h
SilvaGraf83
 
#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h
MoseStaton39
 
Chatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptopChatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptop
yayaria
 
Nachos3 - Theoretical Part
Nachos3 - Theoretical PartNachos3 - Theoretical Part
Nachos3 - Theoretical Part
Eduardo Triana
 
TCP IP
TCP IPTCP IP
TCP IP
hivasu
 

Ähnlich wie Network.h (20)

Socket Programming Intro.pptx
Socket  Programming Intro.pptxSocket  Programming Intro.pptx
Socket Programming Intro.pptx
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h
 
#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h#include stdio.h#include systypes.h#include syssocket.h
#include stdio.h#include systypes.h#include syssocket.h
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
 
Multithreaded sockets c++11
Multithreaded sockets c++11Multithreaded sockets c++11
Multithreaded sockets c++11
 
Chatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptopChatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptop
 
Nachos3 - Theoretical Part
Nachos3 - Theoretical PartNachos3 - Theoretical Part
Nachos3 - Theoretical Part
 
Socket programming
Socket programming Socket programming
Socket programming
 
TCP IP
TCP IPTCP IP
TCP IP
 
Pemrograman Jaringan
Pemrograman JaringanPemrograman Jaringan
Pemrograman Jaringan
 
Octo talk : docker multi-host networking
Octo talk : docker multi-host networking Octo talk : docker multi-host networking
Octo talk : docker multi-host networking
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
Os 2
Os 2Os 2
Os 2
 
Lecture6
Lecture6Lecture6
Lecture6
 
nw-lab_dns-server.pdf
nw-lab_dns-server.pdfnw-lab_dns-server.pdf
nw-lab_dns-server.pdf
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
 
Npc14
Npc14Npc14
Npc14
 
Virus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperVirus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing Gatekeeper
 

Mehr von naniix21_3 (16)

Semaphore
SemaphoreSemaphore
Semaphore
 
Encriptacion
EncriptacionEncriptacion
Encriptacion
 
Vm
VmVm
Vm
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Rsa
RsaRsa
Rsa
 
Encriptacion
EncriptacionEncriptacion
Encriptacion
 
Vm
VmVm
Vm
 
Rsa
RsaRsa
Rsa
 
Encriptacion
EncriptacionEncriptacion
Encriptacion
 
Clock
ClockClock
Clock
 
Sockets in nach0s
Sockets in nach0sSockets in nach0s
Sockets in nach0s
 
Security
SecuritySecurity
Security
 
Sockets
SocketsSockets
Sockets
 
Nach os network
Nach os networkNach os network
Nach os network
 
Nach os network
Nach os networkNach os network
Nach os network
 
Nach os network
Nach os networkNach os network
Nach os network
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

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