Network.h
Upcoming SlideShare
Loading in...5
×
 

Network.h

on

  • 548 views

 

Statistics

Views

Total Views
548
Views on SlideShare
415
Embed Views
133

Actions

Likes
0
Downloads
0
Comments
0

4 Embeds 133

http://os-class.blogspot.com 114
http://os-class.blogspot.mx 17
http://www.blogger.com 1
http://os-class.blogspot.fr 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Network.h Network.h Presentation Transcript

  • Network.h
  • #ifndef NETWORK_H#define NETWORK_H#include "copyright.h"#include "utility.h“When using ifndef conditional we mean the specialist tosee if a macro identifier is defined or not.
  • class Network { public: Network(NetworkAddress addr, double reliability, VoidFunctionPtr readAvail, VoidFunctionPtrwriteDone, int callArg);~Network(); // De-allocate the network driverdata void Send(PacketHeader hdr, char* data); PacketHeader Receive(char* data); void SendDone(); void CheckPktAvail(); View slide
  • 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 cango out on the wire.#define MaxPacketSize View slide
  • private: NetworkAddress ident; // This machines networkaddress double chanceToWork; // Likelihood packet will bedropped int sock; // UNIX socket number for incomingpackets char sockName[32]; VoidFunctionPtr writeHandler; VoidFunctionPtr readHandler;
  • int handlerArg; // Argument to be passed tointerrupt handler bool sendBusy; bool packetAvail;// network PacketHeader inHdr;char inbox[MaxPacketSize];};#endif