Chapter 149. APIs
Table of Contents
149.1. Standard networking
The APIs for the standard networking calls such as
recv() and so on, are
in header files relative to the top-level
include directory, within the standard subdirectories as conventionally
/usr/include. For example:
install/include/arpa/tftp.h install/include/netinet/tcpip.h install/include/sys/socket.h install/include/sys/socketvar.h install/include/sys/sockio.h
network.h at the top level
defines various extensions, for example the API
above. We advise including
you use these features or not.
In general, using the networking code may require definition of two symbols: _KERNEL and __ECOS. _KERNEL is not normally required; __ECOS is normally required. So add this to your compile lines for files which use the network stack:
To expand a little, it‚s like this because this is a port of a standard distribution external to eCos. One goal is to perturb the sources as little as possible, so that upgrading and maintenance from the external distribution is simplified. The __ECOS symbol marks out the eCos additions in making the port. The _KERNEL symbol is traditional UNIX practice: it distinguishes a compilation which is to be linked into the kernel from one which is part of an application. eCos applications are fully linked, so this distinction does not apply. _KERNEL can however be used to control the visibility of the internals of the stack, so depending on what features your application uses, it may or may not be necessary.
The include file
network.h undefines _KERNEL
unconditionally, to provide an application-like compilation environment.
If you were writing code which, for example,
enumerates the stack‚s internal
structures, that is a kernel-like compilation environment, so you
would need to define _KERNEL (in addition to __ECOS)
and avoid including
|2022-03-29||Open Publication License|