Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

mftp_rcv.h

Go to the documentation of this file.
00001 /*
00002  * (c) 1997-98 StarBurst Communications Inc.
00003  *
00004  * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
00005  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00006  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00007  * ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
00008  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00009  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00010  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00011  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00012  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00013  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00014  * SUCH DAMAGE.
00015  *
00016  * Author: Christoph Haenle, chris@cs.vu.nl
00017  * File: mftp_rcv.h
00018  * Last change: Dec 07, 1998
00019  *
00020  * This software may freely be used only for non-commercial purposes
00021  */
00022 
00023 
00024 // This file contains functionality specific to an MFTP receiver.
00025 
00026 #ifndef mftp_rcv_h
00027 #define mftp_rcv_h
00028 
00029 #include "codeword.h"
00030 #include "mftp.h"                        // due to class MFTPAgent
00031 
00032 
00033 class MFTPRcvAgent : public MFTPAgent {
00034 public:
00035     MFTPRcvAgent();
00036     ~MFTPRcvAgent();
00037     int command(int argc, const char*const* argv);
00038     void recv(Packet* p, Handler* h);
00039     
00040 protected:
00041     typedef struct {
00042         CW_PATTERN_t left;
00043         CW_PATTERN_t right;
00044     } CW_MATRIXLINE_t;
00045 
00046     void init();
00047     void addLine(unsigned long dtu_nb_from, unsigned long dtu_nb_to);
00048     int  process_packet(CW_PATTERN_t cw_pat,
00049                         unsigned long group_nb, unsigned long dtu_nb);
00050     int  findStoreLocation(unsigned long group_nb, unsigned long seek_offset, unsigned long* dtu_nb);
00051     void cw_matrixlines_reset();
00052     bool is_group_full(unsigned long group_nb);
00053     int  recv_data(hdr_mftp::Spec::Data& data);
00054     void recv_status_req(hdr_mftp::Spec::StatReq& statreq);
00055     void send_nak(unsigned long pass_nb, unsigned long block_nb);
00056 
00057     // The following variables are accessible from tcl-scripts:
00058 
00059     // note: ns uses dst_ as the multicast address from which packets are received,
00060     // thus we need the (unicast) reply address as well.
00061     ns_addr_t reply_;                   // unicast reply-address for status response messages
00062 
00063     // The following variables are not accessible from tcl-scripts:
00064     unsigned long CurrentPass;           // current pass number
00065     unsigned long CurrentGroup;          // current group number within pass
00066     CW_PATTERN_t  CwPat;                 // current codeword pattern within pass
00067     unsigned long FileDGramsReceived;    // number of datagrams fully received so far
00068     unsigned long FseekOffset;           // current fseek pointer
00069     CW_MATRIXLINE_t* cw_matrixline_buf; // Enables receiver to keep track which coded packets
00070                                         // were received and how to interpret the coding.
00071                                         // Buffer has as many entries as there are packets
00072                                         // in the file (i.e. FileDGrams)
00073 };
00074 
00075 #endif

Generated on Tue Apr 20 12:14:24 2004 for NS2.26SourcesOriginal by doxygen 1.3.3