Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

MCFTPid Struct Reference

#include <MCFTPid.h>

Collaboration diagram for MCFTPid:

Collaboration graph
[legend]

Public Member Functions

MCFTPidcopy (const MCFTPid id)
unsigned char dst_ip (int b)
unsigned int dst_ip ()
unsigned int dst_port ()
string filename ()
string hex ()
bool is_equal (const MCFTPid &rhs)
 MCFTPid (unsigned int dst_ip, unsigned int dst_port, unsigned int src_ip, unsigned int src_port, unsigned int mssgnum)
 MCFTPid (const MCFTPid &)
 MCFTPid ()
unsigned int mssgnum ()
bool operator!= (const MCFTPid &rhs)
MCFTPidoperator() (unsigned int dst_ip, unsigned int dst_port, unsigned int src_ip, unsigned int src_port, unsigned int mssgnum)
MCFTPidoperator() (const MCFTPid &)
MCFTPidoperator() ()
MCFTPidoperator<< (BufferBase &)
MCFTPidoperator= (const MCFTPid &rhs)
bool operator== (const MCFTPid &rhs)
MCFTPidoperator>> (BufferBase &)
void read (ostream &)
void read (BufferBase &)
void report (ostream &=cout)
void set_dst_ip (unsigned char ip3, unsigned char ip2, unsigned char ip1, unsigned char ip0)
void set_dst_ip (unsigned int dst_ip)
void set_dst_port (unsigned int dst_port)
void set_mssgnum (unsigned int mssgnum)
void set_src_ip (unsigned char ip3, unsigned char ip2, unsigned char ip1, unsigned char ip0)
void set_src_ip (unsigned int src_ip)
void set_src_port (unsigned int src_port)
unsigned char src_ip (int b)
unsigned int src_ip ()
unsigned int src_port ()
void write (istream &)
void write (BufferBase &)

Private Attributes

unsigned int _dst_ip
unsigned int _dst_port
unsigned int _mssgnum
unsigned int _src_ip
unsigned int _src_port

Friends

ostream & operator<< (ostream &, MCFTPid &)
BufferBaseoperator<< (BufferBase &, MCFTPid &)
istream & operator>> (istream &, MCFTPid &)
BufferBaseoperator>> (BufferBase &, MCFTPid &)

Constructor & Destructor Documentation

MCFTPid::MCFTPid  ) 
 

Definition at line 106 of file MCFTPid.h.

00107   : _dst_ip(0), _dst_port(0), 
00108     _src_ip(0), _src_port(0), 
00109     _mssgnum(0)
00110 {}

MCFTPid::MCFTPid const MCFTPid  ) 
 

Definition at line 113 of file MCFTPid.h.

00114   : _dst_ip(id._dst_ip), _dst_port(id._dst_port), 
00115     _src_ip(id._src_ip), _src_port(id._src_port), 
00116     _mssgnum(id._mssgnum)
00117 {}

MCFTPid::MCFTPid unsigned int  dst_ip,
unsigned int  dst_port,
unsigned int  src_ip,
unsigned int  src_port,
unsigned int  mssgnum
 

Definition at line 120 of file MCFTPid.h.

00124   : _dst_ip(dst_ip), _dst_port(dst_port), 
00125     _src_ip(src_ip), _src_port(src_port), 
00126     _mssgnum(mssgnum)
00127 {}


Member Function Documentation

MCFTPid & MCFTPid::copy const MCFTPid  id  ) 
 

Definition at line 167 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

Referenced by operator=().

00168 {
00169    _dst_ip = id._dst_ip;
00170    _dst_port = id._dst_port;
00171    _src_ip = id._src_ip;
00172    _src_port = id._src_port;
00173    _mssgnum = id._mssgnum;
00174    return *this;
00175 }

unsigned char MCFTPid::dst_ip int  b  ) 
 

Definition at line 319 of file MCFTPid.h.

References _dst_ip.

00320 {
00321    int itmp = 0;
00322    switch ( b ) {
00323       case 0:
00324          itmp = _dst_ip & 0x000000FF;
00325          break;
00326       case 1:
00327          itmp = (_dst_ip & 0x0000FF00) >> 8;
00328          break;
00329       case 2:
00330          itmp = (_dst_ip & 0x00FF0000) >> 16;
00331          break;
00332       case 3:
00333          itmp = (_dst_ip & 0xFF000000) >> 24;
00334          break;
00335    }
00336    return (unsigned char)(itmp);
00337 }

unsigned int MCFTPid::dst_ip  ) 
 

Definition at line 316 of file MCFTPid.h.

References _dst_ip.

Referenced by report().

00316 { return _dst_ip; }

unsigned int MCFTPid::dst_port  ) 
 

Definition at line 340 of file MCFTPid.h.

References _dst_port.

00340 { return _dst_port; }

string MCFTPid::filename  ) 
 

Definition at line 390 of file MCFTPid.h.

References hex().

00391 {
00392    return hex() + ".mcftp";
00393 }

string MCFTPid::hex  ) 
 

Definition at line 373 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, _src_port, and inttohex().

Referenced by filename(), and report().

00374 {
00375    string s = "";
00376 
00377    char* tmp2 = new char[4+1];
00378    char* tmp4 = new char[8+1];
00379 
00380    inttohex( int(_dst_ip), tmp4, 4 ); s += tmp4;
00381    inttohex( _dst_port, tmp2, 2 ); s += tmp2;
00382    inttohex( _src_ip, tmp4, 4 ); s += tmp4;
00383    inttohex( _src_port, tmp2, 2 ); s += tmp2;
00384    inttohex( _mssgnum, tmp4, 4 ); s += tmp4;
00385 
00386    return s;
00387 }

bool MCFTPid::is_equal const MCFTPid rhs  ) 
 

Definition at line 184 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

Referenced by operator!=(), and operator==().

00185 {
00186    if ( _dst_ip != id._dst_ip ) return false;
00187    if ( _dst_port != id._dst_port ) return false;
00188    if ( _src_ip != id._src_ip ) return false;
00189    if ( _src_port != id._src_port ) return false;
00190    if ( _mssgnum != id._mssgnum ) return false;
00191    return true;
00192 }

unsigned int MCFTPid::mssgnum  ) 
 

Definition at line 370 of file MCFTPid.h.

References _mssgnum.

00370 { return _mssgnum; }

bool MCFTPid::operator!= const MCFTPid rhs  ) 
 

Definition at line 201 of file MCFTPid.h.

References is_equal().

00202 { 
00203    return !is_equal(rhs); 
00204 }

MCFTPid & MCFTPid::operator() unsigned int  dst_ip,
unsigned int  dst_port,
unsigned int  src_ip,
unsigned int  src_port,
unsigned int  mssgnum
 

Definition at line 152 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

00157 {
00158    _dst_ip = dst_ip;
00159    _dst_port = dst_port;
00160    _src_ip = src_ip;
00161    _src_port = src_port;
00162    _mssgnum = mssgnum;
00163    return *this;
00164 }

MCFTPid & MCFTPid::operator() const MCFTPid  ) 
 

Definition at line 141 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

00142 {
00143    _dst_ip = id._dst_ip;
00144    _dst_port = id._dst_port;
00145    _src_ip = id._src_ip;
00146    _src_port = id._src_port;
00147    _mssgnum = id._mssgnum;
00148    return *this;
00149 }

MCFTPid & MCFTPid::operator()  ) 
 

Definition at line 130 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

00131 {
00132    _dst_ip = 0;
00133    _dst_port = 0;
00134    _src_ip = 0;
00135    _src_port = 0;
00136    _mssgnum = 0;
00137    return *this;
00138 }

MCFTPid & MCFTPid::operator<< BufferBase  ) 
 

Definition at line 218 of file MCFTPid.h.

References write().

00219 {
00220    write(buffer);
00221    return *this;
00222 }

MCFTPid & MCFTPid::operator= const MCFTPid rhs  ) 
 

Definition at line 178 of file MCFTPid.h.

References copy().

00179 { 
00180    return copy(rhs); 
00181 }

bool MCFTPid::operator== const MCFTPid rhs  ) 
 

Definition at line 195 of file MCFTPid.h.

References is_equal().

00196 { 
00197    return is_equal(rhs); 
00198 }

MCFTPid & MCFTPid::operator>> BufferBase  ) 
 

Definition at line 236 of file MCFTPid.h.

References read().

00237 {
00238    read(buffer);
00239    return *this;
00240 }

void MCFTPid::read ostream &   ) 
 

Definition at line 261 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

00262 {
00263    bytepack bp;
00264    os << bp( int(_dst_ip), 4 );
00265    os << bp( int(_dst_port), 2 );
00266    os << bp( int(_src_ip), 4 );
00267    os << bp( int(_src_port), 2 );
00268    os << bp( int(_mssgnum), 4 );
00269 }

void MCFTPid::read BufferBase  ) 
 

Definition at line 225 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

Referenced by operator>>().

00226 {
00227    bytepack bp;
00228    buffer << bp( int(_dst_ip), 4 );
00229    buffer << bp( int(_dst_port), 2 );
00230    buffer << bp( int(_src_ip), 4 );
00231    buffer << bp( int(_src_port), 2 );
00232    buffer << bp( int(_mssgnum), 4 );
00233 }

void MCFTPid::report ostream &  = cout  ) 
 

Definition at line 396 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, _src_port, dst_ip(), hex(), and src_ip().

Referenced by MCFTPheader.report().

00397 {
00398    os << "MCFTPid::report(){\n";
00399    os << "dst_ip = " << _dst_ip << " = " 
00400         << int(dst_ip(3)) << '.' << int(dst_ip(2)) << '.' 
00401         << int(dst_ip(1)) << '.' << int(dst_ip(0)) << '\n';
00402    os << "dst_port = " << _dst_port << '\n';
00403    os << "src_ip = " << _src_ip << '\n';
00404    os << "src_ip = " << _src_ip << " = " 
00405         << int(src_ip(3)) << '.' << int(src_ip(2)) << '.' 
00406         << int(src_ip(1)) << '.' << int(src_ip(0)) << '\n';
00407    os << "src_port = " << _src_port << '\n';
00408    os << "mssgnum = " << _mssgnum << '\n';
00409    os << "hex = " << hex() << '\n';
00410    os << "}\n";
00411 }

void MCFTPid::set_dst_ip unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1,
unsigned char  ip0
 

Definition at line 282 of file MCFTPid.h.

References _dst_ip.

00285 { 
00286    _dst_ip = ip3;
00287    _dst_ip = _dst_ip*256 + ip2;
00288    _dst_ip = _dst_ip*256 + ip1;
00289    _dst_ip = _dst_ip*256 + ip0;
00290 }

void MCFTPid::set_dst_ip unsigned int  dst_ip  ) 
 

Definition at line 279 of file MCFTPid.h.

References _dst_ip.

00279 { _dst_ip = dst_ip; }

void MCFTPid::set_dst_port unsigned int  dst_port  ) 
 

Definition at line 293 of file MCFTPid.h.

References _dst_port.

00293 { _dst_port = dst_port; }

void MCFTPid::set_mssgnum unsigned int  mssgnum  ) 
 

Definition at line 313 of file MCFTPid.h.

References _mssgnum.

00313 { _mssgnum = mssgnum; }

void MCFTPid::set_src_ip unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1,
unsigned char  ip0
 

Definition at line 299 of file MCFTPid.h.

References _src_ip.

00302 { 
00303    _src_ip = ip3;
00304    _src_ip = _src_ip*256 + ip2;
00305    _src_ip = _src_ip*256 + ip1;
00306    _src_ip = _src_ip*256 + ip0;
00307 }

void MCFTPid::set_src_ip unsigned int  src_ip  ) 
 

Definition at line 296 of file MCFTPid.h.

References _src_ip.

00296 { _src_ip = src_ip; }

void MCFTPid::set_src_port unsigned int  src_port  ) 
 

Definition at line 310 of file MCFTPid.h.

References _src_port.

00310 { _src_port = src_port; }

unsigned char MCFTPid::src_ip int  b  ) 
 

Definition at line 346 of file MCFTPid.h.

References _src_ip.

00347 {
00348    int itmp = 0;
00349    switch ( b ) {
00350       case 0:
00351          itmp = _src_ip & 0x000000FF;
00352          break;
00353       case 1:
00354          itmp = (_src_ip & 0x0000FF00) >> 8;
00355          break;
00356       case 2:
00357          itmp = (_src_ip & 0x00FF0000) >> 16;
00358          break;
00359       case 3:
00360          itmp = (_src_ip & 0xFF000000) >> 24;
00361          break;
00362    }
00363    return (unsigned char)(itmp);
00364 }

unsigned int MCFTPid::src_ip  ) 
 

Definition at line 343 of file MCFTPid.h.

References _src_ip.

Referenced by report().

00343 { return _src_ip; }

unsigned int MCFTPid::src_port  ) 
 

Definition at line 367 of file MCFTPid.h.

References _src_port.

00367 { return _src_port; }

void MCFTPid::write istream &   ) 
 

Definition at line 243 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

00244 {
00245    bytepack bp;
00246    is >> bp( 0, 4 ); _dst_ip = int(bp);
00247    is >> bp( 0, 2 ); _dst_port = int(bp);
00248    is >> bp( 0, 4 ); _src_ip = int(bp);
00249    is >> bp( 0, 2 ); _src_port = int(bp);
00250    is >> bp( 0, 4 ); _mssgnum = int(bp);
00251 }

void MCFTPid::write BufferBase  ) 
 

Definition at line 207 of file MCFTPid.h.

References _dst_ip, _dst_port, _mssgnum, _src_ip, and _src_port.

Referenced by operator<<().

00208 {
00209    bytepack bp;
00210    buffer >> bp( 0, 4 ); _dst_ip = int(bp);
00211    buffer >> bp( 0, 2 ); _dst_port = int(bp);
00212    buffer >> bp( 0, 4 ); _src_ip = int(bp);
00213    buffer >> bp( 0, 2 ); _src_port = int(bp);
00214    buffer >> bp( 0, 4 ); _mssgnum = int(bp);
00215 }


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
MCFTPid id
[friend]
 

Definition at line 430 of file MCFTPid.h.

00431 {
00432    id.read(os);
00433    return os;
00434 }

BufferBase& operator<< BufferBase buffer,
MCFTPid id
[friend]
 

Definition at line 416 of file MCFTPid.h.

00417 {
00418    id.read(buffer);
00419    return buffer;
00420 }

istream& operator>> istream &  is,
MCFTPid id
[friend]
 

Definition at line 437 of file MCFTPid.h.

00438 {
00439    id.write(is);
00440    return is;
00441 }

BufferBase& operator>> BufferBase buffer,
MCFTPid id
[friend]
 

Definition at line 423 of file MCFTPid.h.

00424 {
00425    id.write(buffer);
00426    return buffer;
00427 }


Field Documentation

unsigned int MCFTPid._dst_ip [private]
 

Definition at line 91 of file MCFTPid.h.

Referenced by copy(), dst_ip(), hex(), is_equal(), operator()(), read(), report(), set_dst_ip(), and write().

unsigned int MCFTPid._dst_port [private]
 

Definition at line 92 of file MCFTPid.h.

Referenced by copy(), dst_port(), hex(), is_equal(), operator()(), read(), report(), set_dst_port(), and write().

unsigned int MCFTPid._mssgnum [private]
 

Definition at line 95 of file MCFTPid.h.

Referenced by copy(), hex(), is_equal(), mssgnum(), operator()(), read(), report(), set_mssgnum(), and write().

unsigned int MCFTPid._src_ip [private]
 

Definition at line 93 of file MCFTPid.h.

Referenced by copy(), hex(), is_equal(), operator()(), read(), report(), set_src_ip(), src_ip(), and write().

unsigned int MCFTPid._src_port [private]
 

Definition at line 94 of file MCFTPid.h.

Referenced by copy(), hex(), is_equal(), operator()(), read(), report(), set_src_port(), src_port(), and write().


The documentation for this struct was generated from the following file:
Generated on Mon May 31 21:41:19 2004 for SR2k4 Assembler by doxygen 1.3.6