Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include "mynew.h"
  2. #include "tcp.h"
  3.  
  4.  
  5. TCP::TCP(int numPort)
  6. {
  7.     const Port notFound = {0, NULL, 0};
  8.     pt = new PortTable(notFound, 2 * numPort);
  9.  
  10. }  // TCP()
  11.  
  12. TCP::~TCP() {
  13. }
  14.  
  15. // helper function
  16. static void insertIntoPort(int destPackNum, char *data, Packet* head)
  17. {
  18.     Packet* current = head;
  19.     while (destPackNum >= current->packetNumber && current->next != NULL) {
  20.         current = current->next;
  21.     }
  22.     Packet* np = new Packet(destPackNum, data, current->next);
  23.     current->next = np;
  24. }
  25.  
  26. void TCP::receive(int portNum, int packetNum, const char packet[257])
  27. {
  28.    
  29. } // receive()
  30.  
  31. int TCP::getStream(int portNum, char stream[100000])
  32. {
  33.   // getStream() should fill the stream with current packets that have
  34.   // packet numbers greater than the last packet past in the last
  35.   // stream for this port.  The packets must be ascending order, though
  36.   // not necessarily consecutive.  Return the size of the stream in bytes.
  37.  
  38.    
  39.    
  40.    return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement