2 * Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net>
3 * Distributed under the terms of the MIT License.
6 #ifndef DISCOVERY_PACKET__H
7 #define DISCOVERY_PACKET__H
11 #include <TemplateList.h>
16 SERVICE_NAME
= 0x0101,
20 VENDOR_SPECIFIC
= 0x0105,
21 RELAY_SESSION_ID
= 0x0110,
22 SERVICE_NAME_ERROR
= 0x0201,
23 AC_SYSTEM_ERROR
= 0x0202,
24 GENERIC_ERROR
= 0x0203
36 typedef struct pppoe_tag
{
43 class DiscoveryPacket
{
45 DiscoveryPacket(uint8 code
, uint16 sessionID
= 0x0000);
46 DiscoveryPacket(struct mbuf
*packet
, uint32 start
= 0);
49 status_t
InitCheck() const
50 { return fInitStatus
; }
52 void SetCode(uint8 code
)
57 void SetSessionID(uint16 sessionID
)
58 { fSessionID
= sessionID
; }
59 uint16
SessionID() const
60 { return fSessionID
; }
62 bool AddTag(uint16 type
, const void *data
, uint16 length
, int32 index
= -1);
63 bool RemoveTag(pppoe_tag
*tag
);
64 int32
CountTags() const
65 { return fTags
.CountItems(); }
66 pppoe_tag
*TagAt(int32 index
) const;
67 pppoe_tag
*TagWithType(uint16 type
) const;
69 struct mbuf
*ToMbuf(uint32 MTU
, uint32 reserve
= ETHER_HDR_LEN
);
70 // the user is responsible for freeing the mbuf
75 TemplateList
<pppoe_tag
*> fTags
;