* Copyright 2003-2004, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _K_PPP_CONFIGURE_PACKET__H
#define _K_PPP_CONFIGURE_PACKET__H
#include <TemplateList.h>
#include <net_buffer.h>
typedef struct ppp_configure_item {
uint8 type;
uint8 length;
uint8 data[0];
} ppp_configure_item;
class KPPPConfigurePacket {
private:
KPPPConfigurePacket(const KPPPConfigurePacket& copy);
KPPPConfigurePacket& operator= (const KPPPConfigurePacket& copy);
public:
KPPPConfigurePacket(uint8 code);
KPPPConfigurePacket(net_buffer *packet);
~KPPPConfigurePacket();
bool SetCode(uint8 code);
uint8 Code() const
{ return fCode; }
void SetID(uint8 id)
{ fID = id; }
uint8 ID() const
{ return fID; }
bool AddItem(const ppp_configure_item *item, int32 index = -1);
bool RemoveItem(ppp_configure_item *item);
int32 CountItems() const
{ return fItems.CountItems(); }
ppp_configure_item *ItemAt(int32 index) const;
ppp_configure_item *ItemWithType(uint8 type) const;
net_buffer *ToNetBuffer(uint32 MRU);
private:
uint8 fCode, fID;
TemplateList<ppp_configure_item*> fItems;
};
#endif