haiku/headers/private/kernel/boot/net/ChainBuffer.h
Ingo Weinhold d561d0ad68 Added a mini networking stack to the boot loader. It speaks basic ARP,
IP, and UDP, as well as a home brewn UDP based protocol, "remote disk",
which provides random access to a single remote file/device. The Open
Firmware flavored boot loader automatically initializes the net stack,
searches for a remote disk, and tries to boot from it, if the boot
device is a network device (e.g. when loading the boot loader via
TFTP).

This is quite nice for developing with a two-machine setup, since one
doesn't even need to install Haiku on the test machine anymore, but can
serve it directly from the development machine. When the networking
support in the kernel is working, this method could even be used to
fully boot, not just for loading kernel and initial modules.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-27 22:01:33 +00:00

50 lines
1.1 KiB
C++

/*
* Copyright 2005, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _BOOT_NET_CHAIN_BUFFER_H
#define _BOOT_NET_CHAIN_BUFFER_H
#include <SupportDefs.h>
class ChainBuffer {
public:
ChainBuffer(void *data = 0, uint32 size = 0, ChainBuffer *next = NULL,
bool freeData = false);
~ChainBuffer();
void *Data() const { return fData; }
uint32 Size() const { return fSize; }
uint32 TotalSize() const { return fTotalSize; }
ChainBuffer *Next() const { return fNext; }
ChainBuffer *DetachNext();
void Append(ChainBuffer *next);
void Flatten(void *_buffer) const;
private:
// TODO: Implement Create() and Delete(). Make new and delete operators private.
enum {
CHAIN_BUFFER_HEAD = 0x1,
CHAIN_BUFFER_EMBEDDED_DATA = 0x2,
CHAIN_BUFFER_FREE_DATA = 0x4,
CHAIN_BUFFER_ON_STACK = 0x8,
};
void _Init(void *data, uint32 size, ChainBuffer *next, uint32 flags);
void _Destroy();
uint32 fFlags:4;
uint32 fSize:14;
uint32 fTotalSize:14;
void *fData;
ChainBuffer *fNext;
uint8 fBuffer[0];
};
#endif // _BOOT_NET_CHAIN_BUFFER_H