# pppfilter.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       pppfilter.h
    00003 ///             Data filter class, to morph PPP data into something that
    00004 ///             the Blackberry / Rogers / ISP can handle.
    00005 ///             This logic is based partly on XmBlackBerry's
    00006 ///             gprs_protocol_fix.c program.
    00007 ///
    00008
    00009 /*
    00010     Copyright (C) 2008-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00011
    00012     This program is free software; you can redistribute it and/or modify
    00013     it under the terms of the GNU General Public License as published by
    00014     the Free Software Foundation; either version 2 of the License, or
    00015     (at your option) any later version.
    00016
    00017     This program is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00020
    00021     See the GNU General Public License in the COPYING file at the
    00022     root directory of this project for more details.
    00023 */
    00024
    00025 #ifndef __BARRY_M_PPPFILTER_H__
    00026 #define __BARRY_M_PPPFILTER_H__
    00027
    00028 #include "dll.h"
    00029 #include "data.h"
    00030
    00031 namespace Barry {
    00032
    00033 class BXEXPORT PppFilter
    00034 {
    00035 private:
    00036         Data m_writeBuf;                        // used for 0x7e handling
    00037
    00038         // write flags
    00039         bool m_ppp_mode;
    00040         unsigned char m_last;
    00041
    00042         BXLOCAL const Data& GetBuffer() const;  // not implemented, since
    00043                 // Write can return either m_writeBuf or data, and
    00044                 // so this would be useless and unsafe
    00045
    00046         BXLOCAL void Filter(Data &dest, const Data &src, unsigned int destoffset);
    00047
    00048 public:
    00049         PppFilter();
    00050
    00051         bool PppMode() const { return m_ppp_mode; }
    00052         const Data& Write(const Data &data);
    00053         Data& Write(const Data &data, unsigned int prepend);
    00054 };
    00055
    00056 } // namespace Barry
    00057
    00058 #endif
    00059