oriented and template based. For compatibility reasons, the libraries are therefore built
together with every project making use of the framework.
- When starting a new Projekt based on the SENF framework, it is advisable, to make use of the
+ When starting a new project based on the SENF framework, it is advisable, to make use of the
SENFSCons build environment and use SVN to manage the code repository. This is the
configuration, described in this documentation.
\section Preliminaries
- Before starting the devlopment, make sure to fulfill the following requirements:
+ Before starting the development, make sure to fulfill the following requirements:
\li GNU g++, version at least 3.4
\li The Boost libraries (http://www.boost.org)
\section libPackets libPackets: Network packet manipulation
- This libarary provides a very flexible infrastructure to parse, create and otherwise manipulate
+ This library provides a very flexible infrastructure to parse, create and otherwise manipulate
packetized network data. Included is a library of several protocol parsers covering the basic
IPv4 and IPv6 network protocols down to the Ethernet layer.
You now have to decide, which modules you want to use. Every module resides in it's own
subdirectory in the SENF repository. Instead of directly checking out the code, we will use \c
- svn:externals. This will instruct \c svn to auutomatically check out the needed directories from
+ svn:externals. This will instruct \c svn to automatically check out the needed directories from
the BerliOS SENF repository. Change to the 'Foo' directory and type
<pre>
The default editor (probably VI) will be started with the current value of the svn:externals
property (which will probably be empty). Now add all the modules you want plus \c senfscons and
- possibly \c doclib (if you want to build the documentation). You will almost certainly neeed the
+ possibly \c doclib (if you want to build the documentation). You will almost certainly need the
\c Utils module, since all other modules depend on it.
For example, if you want to use the \c Scheduler and \c Socket module, the file will look like
To set up the build environment, copy the <tt>senfscons/SConstruct.template</tt> to
<tt>SConstruct</tt> in the project root. The default setup of this file is to build all
- subdirectories (using the \c SConscript files of the subdirectories). You can add additonal
+ subdirectories (using the \c SConscript files of the subdirectories). You can add additional
global targets and configuration parameters here.
If you want to use a non-default compiler or the boost library is not installed in the system
$ scons
</pre>
- If you have not changed the \c SConstruct file, this will build all modules you have importet
+ If you have not changed the \c SConstruct file, this will build all modules you have imported
into your project. To build and execute the unit tests, use
<pre>
<tr><td>\c .cci</td><td>C++ implementation of inline non-template functions and
members</td></tr>
- <tr><td>\c .cti</td><td>C++ implementation of inline template fuanctions and members</td></tr>
+ <tr><td>\c .cti</td><td>C++ implementation of inline template functions and members</td></tr>
<tr><td>\c .mpp</td><td>Special include file used for external iteration by the
Boost.Preprocessor library</td></tr> </table>
\todo Implement special container replacing vector which manages
some headroom to allow efficient insertion of elements at the
- beginning. This really is just another type of deque
+ beginning. This really is just another type of dequeue
implementation.
*/
This class is the base class of all Packets. It implements the
generic Packet interface and provides the packet management
framework. senf::Packet manages the necessary memory
- resources and controlls the chain of packet interpreters.
+ resources and controls the chain of packet interpreters.
The Packet user always interfaces with the pkf via a Packet
derived class. This is the only external entity ever held by a
Internally, every Packet references a PacketImpl instance which
manages the raw packet data and the interpreter list. This raw
data is interpreted by the concrete Packet derived class
- according to the definition of that derived class's packet
+ according to the definition of that derived classes packet
type (i.e. EthernetPacket or UDPPacket).
Packet provides several interfaces:
senf:PacketRegistry, it must not take any additional
constructor parameters.
- After having implemented the bare framework, the most comman
+ After having implemented the bare framework, the most common
way to implement access to the packets specific data is to use
the parser framework by additionally inheriting a
corresponding parser. This also automatically implements the
The Packet interface is implemented to minimize overhead as
far as possible without getting to complex. One area for
- improvement ist the container class used to hold the raw
+ improvement is the container class used to hold the raw
data. This currently is an \a std::vector. This could be
- imporved by either allocating some headroom/tailroom in the
+ improved by either allocating some headroom/tailroom in the
vector and using this when inserting data at the beginning or
end. Alternatively, a new container class (like the
senf::deque_list) could be used to support zero-copy
we cannot construct the \a writev() data structures.
The interpreter list managed by Packet is lazy, meaning packet
- interpreter facades are added only when requestd by next(),
+ interpreter facades are added only when requested by next(),
last() or find_next(). v_nextInterpreter() is called if
necessary by these methods to complete the interpreter chain.
interpreter list to the Packet facades must not be
counted. They are therefore implemented differently (
boost::shared_ptr vs. boost::intrusive_ptr). The choice of
- boost::intrusive_ptr for the externaly visible smart pointer
+ boost::intrusive_ptr for the externally visible smart pointer
for all Packet facades is taken to reduce the overhead (an
intrusive_ptr is only the size of an ordinary pointer, a
smart_ptr has the size of two pointers).
\param e corresponding end iterator
\return smart pointer to new packet
\throws TruncatedPacketException The data cannot be parsed
- securely (the data might be trunctated or just
+ securely (the data might be truncated or just
plain invalid)
*/
template <class OtherPacket, class InputIterator>
OtherPacket. \e Assert's, that a packet of this type exists */
template <class OtherPacket> typename ptr_t<OtherPacket>::ptr get_prev() const;
- /** \brief check, wether the packet is of the given type
- \return true, if packt is of type \a OtherPacket, false
+ /** \brief check, whether the packet is of the given type
+ \return true, if packet is of type \a OtherPacket, false
otherwise */
template <class OtherPacket> bool is() const;
/** \brief cast packet pointer to the given type
\return smart pointer to a \e new packet facade
\throws TruncatedPacketException there is not enough data
- to savely interpret the packet as the given type. The
+ to safely interpret the packet as the given type. The
original packet is \e not invalidated
*/
template <class OtherPacket>
///\name Raw packet data
///@{
- /** \brief begin interator of raw packet data
+ /** \brief begin iterator of raw packet data
This iterator allows access to the raw data interpreted by
the packet facade. This \e includes any header possibly
This method is called by the packet framework to let the
interpreter facade do some final calculations/packet
cleanup before the packet is sent out or digested in some
- other way. This is the place to calcaulate checksums and
+ other way. This is the place to calculate checksums and
such.
- This method is autmatically called for all interpreters on
+ This method is automatically called for all interpreters on
the interpreter chain.
*/
virtual void v_finalize() = 0;
typedef some_key_type key_t;
};
\endcode
- The key type can be an arbitrary valuetype. The PacketRegistry
+ The key type can be an arbitrary value type. The PacketRegistry
for this Tag can then be accessed using
<code>PacketRegistry<SomeTag>::</code>.
any other packet class in this registry.
The Packet must not already be registered in the registry.
- \param OtherPacket packet to regiser
+ \param OtherPacket packet to register
\param key key of the packet
*/
template <class OtherPacket>
\param key Key of packet type to create instance of
\param b begin iterator argument to Packet::create()
- \param e end iterator argment to Packet::create()
+ \param e end iterator argument to Packet::create()
\returns new Instance of the packet type registered under
key or DataPacket, if the key is not registered.
*/
This mixin class provides a new registerInterpreter
implementation which can be used besides the methods provided
- bei senf::Packet to add a new interpreter to the
+ by senf::Packet to add a new interpreter to the
interpreter chain.
\code
transition function. See ParseListS.hh for more.
We should write a baseclass for sentinels which has no \c check()
- member, en empty \c next() member and \c void as the state
+ member, an empty \c next() member and \c void as the state
type. This simplifies writing simple sentinels.
The parse_listS iterator will have to pass the state in addition
// return true, if the data in the range [begin,end)
// can be safely interpreted by the parser without
// causing invalid memory access. This means,
- // check, wether the data is truncated
+ // check, whether the data is truncated
return static_cast<unsigned>(end-begin) >= bytes();
}
/** \brief Addtiional Parser information
- Parser_traits provids abstract information about an unknown
+ Parser_traits provides abstract information about an unknown
parser. Besides the information already available within the
Parser it provides an additional 'fixed_sized' member which is
true if and only if the Parser has a static bytes() member.
/** \brief Asyncronous reading helper
This class provides a simple asynchronous reading facility. This helper will register with
- the Scheduler and read incoming data. It will collect the data until a specific numbner of
+ the Scheduler and read incoming data. It will collect the data until a specific number of
bytes has been read or some Predicate evaluated on the data read thus far signals end of
data.
The predicate is any class instance with an <tt>operator(std::string const &)</tt>. This
operator is called, whenever some data has been read. If the data is not yet complete, the
- predicate must return \c std::string::npos. If the ReadHelper should stop readeing more
+ predicate must return \c std::string::npos. If the ReadHelper should stop reading more
data, the predicate must return the number of bytes which are to be considered 'matched'.
\todo Move all not Handle dependent members to a ReadHandleBase class
std::string const & data() const; ///< return data read
std::string const & tail() const; ///< return data read but not matched by the predicate
- bool complete() const; ///< Check wether the read has completed successfully
+ bool complete() const; ///< Check whether the read has completed successfully
bool error() const; ///< Check for error condition
- void throw_error() const; ///< If an error occured, throw it
+ void throw_error() const; ///< If an error occurred, throw it
void revoke(); ///< Remove the ReadHelper from the scheduler
/** \brief Singleton class to manage the event loop
This class manages a single select() type event loop. A customer of this class may register
- any number of file descriptiors with this class and pass callback functions to be called on
+ any number of file descriptors with this class and pass callback functions to be called on
input, output or error. This functions are specified using boost::function objects (See <a
href="http://www.boost.org/doc/html/function.html">Boost.Function</a>)
\code
int fd = retrieve_filehandle(object);
\endcode
- is valid and places the relevent file descriptor into fd can be used as a Handle type. There
+ is valid and places the relevant file descriptor into fd can be used as a Handle type. There
is an implementation of retrieve_filehandle(int) within the library to handle explicit file
- descrptors. The <a href="../../../Socket/doc/html/index.html">Socket library</a> provides an
- implementation of <tt>retrive_filehandle(FileHandle handle)</tt>. If you want to support
- some other handle type, just define an apropriate \c retrieve_filehandle function <em>in
+ descriptors. The <a href="../../../Socket/doc/html/index.html">Socket library</a> provides an
+ implementation of <tt>retrieve_filehandle(FileHandle handle)</tt>. If you want to support
+ some other handle type, just define an appropriate \c retrieve_filehandle function <em>in
that types namespace</em>.
It is important to note, that for every combination of file descriptor and event, only a \e
single handler may be installed. Installing more handlers does not make sense. If you need
- to distribute data to serveral interested parties, you must take care of this yourself.
+ to distribute data to several interested parties, you must take care of this yourself.
\todo Fix EventId parameter (probably to int) to allow |-ing without casting ...
*/
time
\implementation This static member just defines the Scheduler as a static method
- variable. The C++ standard then provides above guaratee. The instance will be
+ variable. The C++ standard then provides above guarantee. The instance will be
initialized the first time, the code flow passes the variable declaration found in
the instance() body.
*/
typename GenericCallback<Handle>::Callback const & cb,
int eventMask = EV_ALL); ///< Add file handle event callback
/**< add() will add a callback to the Scheduler. The
- callbeck will be called for the given type of event on
+ callback will be called for the given type of event on
the given arbitrary file-descriptor or
handle-like object. If there already is a Callback
register ed for one of the events requested, the new
/** \brief Asyncronous writing helper
- This class provides a simple asyncronous writing facility. This helper will register with
- the Scheduler to write the requested data. It will stay registered until the data has benen
+ This class provides a simple asynchronous writing facility. This helper will register with
+ the Scheduler to write the requested data. It will stay registered until the data has been
completely sent or some error condition is encountered. As soon as the WriteHelper is done,
the callback will be called.
an empty string. Until then, the complete string will
be returned. */
- bool complete() const; ///< Check wether the write has completed successfully
+ bool complete() const; ///< Check whether the write has completed successfully
bool error() const; ///< Check for error condition
- void throw_error() const; ///< If an error occured, throw it
+ void throw_error() const; ///< If an error occurred, throw it
void revoke(); ///< Remove the WriteHelper from the scheduler
/**< If linger is enabled, the timeout value specifies, how
long to wait before returning while data is unsent in
seconds. If this value is 0, a close() might wait
- forvever.
+ forever.
\param[in] enable \c true to activate linger
\param[in] timeout linger timeout in seconds */
\returns timestamp when packet was received */
};
- /** \brief Protocol facat providing basic connection oriented BSD socket functions
+ /** \brief Protocol facet providing basic connection oriented BSD socket functions
AddressableBSDSocketProtocol provides the BSD socket API as it generically applies to
addressable (connection oriented) sockets.
that the socket buffer will be empty after read() returns.
\attention If the space available for the data read is limited, the read will return no
- more than that amount of data. For a datagram socket, a full datagram is still dequed
+ more than that amount of data. For a datagram socket, a full datagram is still dequeued
from the socket buffer, the remainder of the datagram will be lost.
There are three variants of read which differ in how they return the read string.
now. If you do not want to block, you \e must make the
socket non-blocking (using FileHandle::blocking()).
\param[out] buffer data read
- \param[in] limit Maximum number of buytes to read or 0
+ \param[in] limit Maximum number of bytes to read or 0
if unlimited
\see \ref read() */
unsigned read (char * buffer, unsigned size);
\param[out] from peer address
\see \ref readfrom() */
unsigned readfrom (char * buffer, unsigned size, Address & from);
- ///< Read data into memory byffer
+ ///< Read data into memory buffer
/**< This variant will read data into the memory area at \c
buffer of size \c size. This is the most performant
version of readfrom().
\param[in] buffer address of buffer to store data at
- \param[in] size size of bnuffer
+ \param[in] size size of buffer
\param[out] from peer address
\returns Number of bytes read
\see \ref readfrom() */
A single write call might depending on the circumstances write only part of the data.
- There are two variants of thie member
+ There are two variants of this member
\throws senf::SystemException
unsigned writeto (AddressParam addr, std::string const & data);
unsigned writeto (AddressParam addr, char const * buffer, unsigned size);
///< Write data from memory buffer to unconnected socket
- /**< \param[in] addr Address o fpeer to send data to
+ /**< \param[in] addr Address of peer to send data to
\param[in] buffer address of buffer to write
\param[in] size amount of data to write
\returns Number of bytes written
/**< \param[in] handle socket handle to enable reception on
\param[in] backlog size of backlog queue
- \fixme listen probably makes no sense without accpept,
- so listen() should debend on AddressingPolicy
+ \fixme listen probably makes no sense without accept,
+ so listen() should depend on AddressingPolicy
too. */
template <class Policy>
static int accept(ServerSocketHandle<Policy> handle,
This is different from UndefinedCommunicationPolicy (which is the same as
CommunicationPolicyBase). This policy class defines the communication policy -- it
explicitly states, that the socket does not support connected communication. This
- effektively disables ther ServerSocketHandle.
+ effectively disables the ServerSocketHandle.
*/
struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase
{};
not readable or writable or only using special function calls like sendto).
The FileHandle class provides handle/body handling and uses automatic reference
- counting. The senf::FileHandle istance is very lightweight and should be used like a
+ counting. The senf::FileHandle instance is very lightweight and should be used like a
built-in type.
- \attention You should mostly pass around senf::FileHandle objects by \e value und not by
+ \attention You should mostly pass around senf::FileHandle objects by \e value and not by
reference.
The FileHandle abstraction is only applicable to real filehandles. It is \e not possible to
\section filehandle_new Writing senf::FileHandle derived classes
To build a new FileHandle type you need to derive from senf::FileHandle. The derived class
- will have to call the protocted FileHandle constructor passing a new senf::FileBody
+ will have to call the protected FileHandle constructor passing a new senf::FileBody
instance. This instance may either be a simple senf::FileBody or a class derived from
senf::FileBody.
/**< \throws senf::SystemException */
void terminate(); ///< Close filehandle ignoring error conditions
- bool readable() const; ///< Check, wether a read on the handle would not block
+ bool readable() const; ///< Check, whether a read on the handle would not block
///< (ignoring blocking state)
void waitReadable() const; ///< Wait, until read on the handle would not block (ignoring
///< blocking state)
- bool writeable() const; ///< Check, wether a write on the handle would not block
+ bool writeable() const; ///< Check, whether a write on the handle would not block
///< (ignoring blocking state)
void waitWriteable() const; ///< Wait, until a write on the handle would not block
///< (ignoring blocking state)
FileHandle */
bool boolean_test() const; ///< Short for valid() && ! eof()
- /**< This is called when using a FileHandle instance in a boolen
+ /**< This is called when using a FileHandle instance in a boolean
context
See the performance comments for the eof() member */
pointing to a different body type).
To customize the behavior, a virtual interface is provided. This interface only covers some
- basic funcionality which is only used infrequently during the lifetime of a FileHandle
+ basic functionality which is only used infrequently during the lifetime of a FileHandle
instance.
*/
/// \addtogroup policy_impl_group
/// @{
- /** \brief Non-template implemenatation class of GenericAddressingPolicy template
+ /** \brief Non-template implementation class of GenericAddressingPolicy template
\internal
*/
members. sockaddr_p could always return a const * whereas open_sockaddr_p should return a
non-const pointer. The close operation would then explicitly signal, that the new value
should be incorporated into the class. With our current implementation, the close member
- would be a no-op, however this ould free us from using the sockaddr values as a direct
- sotrage representation of the address.
+ would be a no-op, however this should free us from using the sockaddr values as a direct
+ storage representation of the address.
*/
template <class Address>
struct GenericAddressingPolicy
address interface.
\returns non-const (!) pointer to sockaddr structure */
struct sockaddr const * sockaddr_p() const; ///< Return a pointer to sockaddr structure
- /**< This member is like sockaddr_p(), hoewever it does not
+ /**< This member is like sockaddr_p(), however it does not
allow changing the address.
\returns const pointer to sockaddr structure */
unsigned sockaddr_len() const; ///< Return size of address
- /**< This meember return the size of the socket address
+ /**< This member return the size of the socket address
structure as returned by sockaddr_p() in bytes.
\returns size of respective sockaddr structure in bytes
*/
/** \brief IPv4 socket address
- INet4Address wrapps the standard sockaddr_in datatype. It provides simple accessor methods
- to accss the host and port. It does \e not integrate \c gethostbyname or DNS lookup.
+ INet4Address wraps the standard sockaddr_in datatype. It provides simple accessor methods
+ to access the host and port. It does \e not integrate \c gethostbyname or DNS lookup.
\todo Implement real INet4Address datatype and rename this one to INet4SockAddress ...
\todo Implement more complete interface
numeric string representations of IPv6 addresses. This class does not integrate with \c
gethostbyname() and so does not support host names.
- The conversion constructors allow the use of string constants whereever an INet6Address is
+ The conversion constructors allow the use of string constants wherever an INet6Address is
expected. Especially, it is possible to assign a string to an address to change it's value.
\implementation The <tt>char const *</tt> constructor overload is needed to support
/** \brief IPv6 socket address
- This class wrapps the standard \c sockaddr_in6 structure. INet6SocketAddress provides access
+ This class wraps the standard \c sockaddr_in6 structure. INet6SocketAddress provides access
to all members of the sockaddr_in6 structure. Additionally, INet6SocketAddress supports the
string representation
INet6SocketAddress(); ///< Create empty instance
INet6SocketAddress(std::string const & addr);
- ///< Initialize/convert from string represenation
+ ///< Initialize/convert from string representation
INet6SocketAddress(char const * addr); ///< Same as above to support string literals
INet6SocketAddress(INet6Address const & addr, unsigned port);
///< Initialize from address and port
This addressing policy implements addressing using Internet V4
addresses.
- The various members are directly importet from
+ The various members are directly imported from
GenericAddressingPolicy which see for a detailed
documentation.
*/
This addressing policy implements addressing using Internet V6
addresses.
- The various members are directly importet from
+ The various members are directly imported from
GenericAddressingPolicy which see for a detailed
documentation.
*/
addressing.
\todo Is it safe, not to allow setting the interface index on add/drop? what does it do
- (especially if the local addres is given ?). What have I been thinking here ???
+ (especially if the local address is given ?). What have I been thinking here ???
\todo move all multicast-methods into an extra IPv4MulticastProtocol class (it's only
available on datagram sockets)
\todo the multicast add/remove/iface semantics are quite unclear ...
- \todo connect() is only available on stream sockets. We want to access bind() and connet()
+ \todo connect() is only available on stream sockets. We want to access bind() and connect()
via the ClientSocketHandle -> see SocketProtocol todo point
*/
class IPv4Protocol
interface.
\param[in] mcAddr address of group to join
\todo fix this as soon as we have a real address class
- (differend from the sockaddress class */
+ (different from the sockaddress class */
void mcAddMembership(INet4Address const & mcAddr, INet4Address const & localAddr) const;
///< join multicast group on a specific address/interface
/**< This member will add \a mcAddr to the list of multicast
\param[in] mcAddr address of group to join
\param[in] localAddr address of interface to join on
\todo fix this as soon as we have a real address class
- (differend from the sockaddress class */
+ (different from the sockaddress class */
void mcDropMembership(INet4Address const & mcAddr) const;
///< Leave multicast group
default interface.
\param[in] mcAddr address of group to leave
\todo fix this as soon as we have a real address class
- (differend from the sockaddress class */
+ (different from the sockaddress class */
void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr) const;
///< leave multicast group on a specific address/interface
/**< This member will remove \a mcAddr from the list of
\param[in] mcAddr address of group to leave
\param[in] localAddr address of interface to leave from
\todo fix this as soon as we have a real address class
- (differend from the sockaddress class */
+ (different from the sockaddress class */
void mcIface(std::string iface = std::string()) const;
///< set default multicast interface of the socket
/** \brief Link local address
- LLSocketAddress wrapps the standard sockaddr_ll datatype.
+ LLSocketAddress wraps the standard sockaddr_ll datatype.
\todo I don't think the current implementation is
sensible. I'll have to reimplement this class probably
'ForwardRange' representation for a raw ll
address (See <a
href="http://www.boost.org/libs/range/index.html">Boost.Range</a>).
- This representation allows zero-copy imlementations of
+ This representation allows zero-copy implementations of
many operations, however it is probably not worth the
effort since the ll address is restricted to a max of 8
bytes. Therefore this will be changed and the concrete
// as the representation for a hardware address. The restrictions
// for the range are:
// a) the range must never be larger than 8 elements
- // b) the value_type must be convertible to unsigend char
+ // b) the value_type must be convertible to unsigned char
// and really we need only a single-pass range.
//
// Since a hardware address is so short (a maximum of 8
/** \brief ReadPolicy for readable sockets
This policy provides support for readable sockets via the standard UNIX read/recvfrom system
- cals. The concreate semantics of the read calls depend on the framing policy of the socket.
+ calls. The concrete semantics of the read calls depend on the framing policy of the socket.
*/
struct ReadablePolicy : public ReadPolicyBase
{
/** \brief WritePolicy for writeable sockets
This policy provides support for writable sockets via the standard UNIX write/sendto system
- cals. The concreate semantics of the write calls depend on the framing policy of the socket.
+ calls. The concrete semantics of the write calls depend on the framing policy of the socket.
*/
struct WriteablePolicy : public WritePolicyBase
{
void state(SocketStateMap & map, unsigned lod=0);
///< Inquire state information of socket handle
/**< The map argument (a string to string mapping) will be
- filled with information coverning the current state of
+ filled with information covering the current state of
the socket. The information provided depends on the
socket protocol. The amount of information returned can
be controlled using the \p lod value.
\param map string to string mapping to be filled with
state information
- \param lod level of detail requesten. The interpretation
+ \param lod level of detail requested. The interpretation
of this value is protocol specific
\implementation This member will be re-implemented in
/** \brief dynamically check cast validity
- This function will check, wether the given cast is valid. This is the same as checking, that
+ This function will check, whether the given cast is valid. This is the same as checking, that
dynamic_socket_cast does not throw.
This member is needed, since there is no 'null' SocketHandle (comparable to a null pointer)
this Unspecified type, the axis is left unspecified, the concrete policy will be incomplete.
The senf::SocketPolicy template defines the behavior of a socket handle. The socket handle
- instances do not implement any socket functionality themselves instead defering the
+ instances do not implement any socket functionality themselves instead deferring the
implementation to the policy classes. The SocketHandle interface is therefore \e not implemented
using virtual members, all important socket functions can be inlined by the compiler to create
highly efficient code.
A senf::SocketPolicy instance can be incomplete. In this case it does \e not completely specify
the socket interface, it leaves some aspects open by assigning the Unspecified value to one or
more of the policy axis. A senf::SocketHandle based on such a policy will have a reduced
- interface: It will only support those members for wich the corresponding policies are defined.
+ interface: It will only support those members for which the corresponding policies are defined.
To build a senf::SocketPolicy instance the senf::MakeSocketPolicy helper is provided. This
helper template takes any number (it is really limited to 6 Arguments but more arguments don't
\section policy_group_details The Policy Framework Classes
In the following discussion, deeper insight into C++ and especially the concepts of template
- meta-programming are needed. Hoewever, this information is only needed if you want to write new
+ meta-programming are needed. However, this information is only needed if you want to write new
policy classes or want to use the policy framework explicitly for your own involved
optimizations ... or if you are just plain curious :-)
<dl><dt>\c class \c SocketPolicyBase</dt> <dd>This class is the base class of the SocketPolicy
template. It is used to validate, that a class is really a SocketPolicy (by checking, that it
- derives from SocketPolicyBase. This is simpler than chacking the template directly).</dd>
+ derives from SocketPolicyBase. This is simpler than checking the template directly).</dd>
<dt>\c template \c SocketPolicy < \e addressingPolicy, \e framingPolicy, \e communicationPolicy,
\e readPolicy, \e writePolicy, \e bufferingPolicy ></dt> <dd>This is the central SocketPolicy
arbitrary SocketPolicy. It will provide default values for unspecified axis</dd>
<dt>\c template \c SocketPolicyIsBaseOf < \e base, \e derived ></dt> <dd>This template
- metafunction will check, wether the socket policy \e derived is convertible to \e base. This
+ metafunction will check, whether the socket policy \e derived is convertible to \e base. This
means, that for each axis, the corresponding policy class in \e derived must be derived or be
the same as the one on \e base.</dd> </dl>
- \implementation All these classes are created automatically. The \c SENF_SOCKET_POLICIES makro
+ \implementation All these classes are created automatically. The \c SENF_SOCKET_POLICIES macro
is a Boost.Preprocessor style sequence listing all policy axis. The Boost.Preprocessor library
is then used to generate the respective classes.
\section policy_implement Implementing Policy Classes
To define a new policy class, derive from the corresponding base class for your policy
- axies. The only policy axis which might possibly need to be extended are the addressing policy
+ axes. The only policy axis which might possibly need to be extended are the addressing policy
(AddressingPolicyBase) and the buffering policy (BufferingPolicyBase). See the Documentation of
these classes for more information on which members can be implemented.
\idea We could combine all the \e Axis \c Is templates into a single template. Since the \e
trait argument will automatically specify the axis to be used, it is not necessary to specify
- that axis in the tempalte functor's name. We could even combine this with \c
+ that axis in the template functor's name. We could even combine this with \c
SocketPolicyIsBaseOf.
*/
This policy does not define any operations since it does have no influence on any method
signature. It does however affect the semantics of the \c read() and \c write() operations.
- \note This policy axis probably only has two sensible statess: StreamFramingPolicy and
+ \note This policy axis probably only has two sensible states: StreamFramingPolicy and
DatagramFramingPolicy.
\see policy_group
/** \brief Policy defining the readability
- The ReadPolicy defines, wether the socket is readable. It may define two members:
+ The ReadPolicy defines, whether the socket is readable. It may define two members:
<table class="senf">
<tr><td>method</td> <td><tt>unsigned read(FileHandle, char * buffer, unsigned size)</tt></td> <td>read data from socket</td></tr>
/** \brief Policy defining the writability
- The WritePolicy defines, wether the socket is writable. It may define two members:
+ The WritePolicy defines, whether the socket is writable. It may define two members:
<table class="senf">
<tr><td>method</td> <td><tt>unsigned write(FileHandle, char * buffer, unsigned size)</tt></td> <td>read data from socket</td></tr>
/** \brief Policy defining the buffering interface
- The BufferingPolicy defines the buffer handling of the socket. It may provide the follogin
+ The BufferingPolicy defines the buffer handling of the socket. It may provide the following
members:
\see policy_group
/** \brief Check single policy axis
- This template is an example of the \e Axis \c Is family of tempalte metafunctions. It will
- check, wether \c Trait is a valid compatible Policy class of \c SocketPolicy. \c Trait must
+ This template is an example of the \e Axis \c Is family of template metafunctions. It will
+ check, whether \c Trait is a valid compatible Policy class of \c SocketPolicy. \c Trait must
be derived from AddressingPolicyBase (respectively \i Policy \c Base).
\see \ref policy_group
/** \brief Enable template overload depending on policy value
- This template is an exmaple of the \c If \e Axis \c Is family of templates. It is used like
+ This template is an example of the \c If \e Axis \c Is family of templates. It is used like
<a href="http://www.boost.org/libs/utility/enable_if.html">Boost.enable_if</a> to enable a
templated overload only, if the AddressingPolicy of \e Axis is compatible with \c Trait
(that is the AddressingPolicy of \c Policy is derived from \c Trait).
/** \brief Polymorphic access to policy axes
This is an example of a policy axes accessor. It returns a reference to the policy axes
- used by the conrecte protocol bundle. This reference can then be checked using RTTI
+ used by the concrete protocol bundle. This reference can then be checked using RTTI
information.
*/
AddressingPolicyBase const & theAddressingPolicy() const = 0;
/** \brief Check dynamic policy compatibility
This method will check the socket policy \a other against this policy. It will check,
- wether \a other is a base policy (or the same) of this policy. This check is done
+ whether \a other is a base policy (or the same) of this policy. This check is done
against the \e dynamic type of \a other using RTTI. It will throw \c std::bad_cast, if
the policy is not compatible.
/** \brief Check policy compatibility
- This tempalte metafunction checks, wether the SocketPolicy \c Derived is more specialized
+ This template metafunction checks, whether the SocketPolicy \c Derived is more specialized
than \c Base (and therefore a SocketHandle with policy \c Derived is convertible to a
SocketHandle with policy \c Base).
the number of heap-allocations per socket to one which is good.
*/
-// The private inheritance idea should indeed work very well: We just need to chnage the
+// The private inheritance idea should indeed work very well: We just need to change the
// implementations of body() and protocol() and that of the ProtocolClient/ServerSocketHandle
// constructors and the SocketBody constructor. The body and the protocol would still be visible
// like several instances because of the private inheritance but we would save the backwards
///< Return number of bytes available for reading without
///< blocking
/**< This member will check in a (very, sigh) protocol
- deqpendent way, how many bytes are guarateed to be
+ dependent way, how many bytes are guaranteed to be
readable from the socket without blocking even if the
socket is blocking. */
SocketPolicy must be set to the complete socket policy of the protocol.
A protocol implementation may define the protocol interface directly. It can also
- (additnally) make use of multiple inheritance to combine a set of protocol facets into a
+ (additionally) make use of multiple inheritance to combine a set of protocol facets into a
specific protocol implementation (i.e. TCPv4SocketProtocol inherits from
ConcreteSocketProtocol and from the protocol facets IPv4Protocol, TCPProtocol,
BSDSocketProtocol and AddressableBSDSocketProtocol). The protocol facets are not concrete
\idea Add communication between parent and child process to daemonize() and add things like
init_done(), failure() etc which allow the daemon process to tell the frontend of successful
- startup or failure. This proabably means moving all the methods into a DaemonTools class (as
+ startup or failure. This probably means moving all the methods into a DaemonTools class (as
statics or via a singleton). This would also allow for automatic pid file creation and
removal (remove in global destructor).
- \idea Add a DaemonProcess baseclass whith init() and main() abstract members which wraps the
+ \idea Add a DaemonProcess baseclass with init() and main() abstract members which wraps the
startup process. DaeminProcess::run() would fork, call init(), create a pid file and then
call main(). Exceptions during init()'s execution would be passed to the parent
process. This is based on the above API.
/** \brief Exception handling standard UNIX errors (errno)
- This exception is thrown to signal generic errno failuers.
+ This exception is thrown to signal generic errno failures.
\todo make where and err accessors and make the member vars private
string and errno value as an argument and will throw a
corresponding template class instance. This would just be a
big switch statement containing all possible errno values,
- probably created using some makro metaprogramming.
+ probably created using some macro metaprogramming.
*/
class SystemException : public std::exception
{
public:
explicit SystemException(int err); ///< SystemException without error lokus info
- /**< \param[in] err errror number (the errno value) */
+ /**< \param[in] err error number (the errno value) */
SystemException(char const * where, int err); ///< SystemException with error lokus info
/**< \param[in] where description of error origin
\param[in] err error number (the errno value) */
/** \defgroup logger The SENF Logger
- The Loggger infrastructure shall implement a highliy flexible compile- and run-time configurable
- logging infrastructure supporting multiple streams, user defineable log areas and fine grained
+ The Loggger infrastructure shall implement a highly flexible compile- and run-time configurable
+ logging infrastructure supporting multiple streams, user definable log areas and fine grained
log levels. Logging can be configured at compile and runtime on any combination of above
parameters. The library supports a host of log targets and messages can be routed into multiple
- targets at the same time. To allow concise usage of the libarary, a utlity to define logging
+ targets at the same time. To allow concise usage of the library, a utility to define logging
defaults for any scope is provided.
An important basic concept of the library is, that most of the macros take a variable number of
\endcode
Currently, the library is not implemented in any way. The interface has been defined up to a
- point and we have dummy implementations of the 'in-code' part ot the interface. This is the
+ point and we have dummy implementations of the 'in-code' part of the interface. This is the
part, which is called throughout the code. The configuration API is defined but we don't even
have a template implementation. However, this allows starting to use the SENF Logger in newly
developed code. Even though this code will unconditionally log everything to \c std::cerr for
type precise to 10<sup>-6</sup> seconds. Up to now, the only
supported members are the datatype (which just uses a 64 bit
integer) and the now() function to get the current UTC time in
- microsecods since the Epoch.
+ microseconds since the Epoch.
\idea This thing only exists as a quick hack. We can probably make
use of Boost.Time or some such thing so it probably does not
better in this respect but still allows two instances of any
class having such a <tt>void *</tt> conversion to be compared
for equality. This again will produce absolutely unexpected
- results since it will not check wethere the objects are
+ results since it will not check whether the objects are
identical, it will only check, that both return the same
boolean state.
required interface. To make a class compatible with \c boost::intrusive_ptr, just derive
publicly from intrusive_refcount.
- Two additional benifits of using intrusive_refcount are
+ Two additional benefits of using intrusive_refcount are
\li The object can access it's own refcount
\li It is valid and safe to convert a plain object pointer to an intrusive_ptr at any time
(not only after new)
\idea Make the \a ob argument type an additional P template
parameter (using call_traits for the exact arg type? Probably
we'll get deduction problems then) . The only operation this
- object musst suppoprt is ob->*fn. This would allow the use of
+ object must support is ob->*fn. This would allow the use of
smart pointers. We should keep the T & version to still support
ob.*fn use.
*/
<dt><tt>scons all_docs</tt></dt><dd>Build documentation of all modules</dd>
<dt><tt>scons all</tt></dt><dd>Build all targets including binaries, libraries, documentation,
- tests andpossible further targets </dd>
+ tests and possible further targets </dd>
<dt><tt>scons -u doc</tt></dt><dd>Run from within a module directory will build the
documentation of that module</dd>
and have a prefix of \c Use. See \ref use.
After all frameworks are configured, you can use SEFNScons.MakeEnvironment() to create a
- corretly configured construction environment.
+ correctly configured construction environment.
To <i>configure the construction environment</i> you can set Variables in the construction
environment. See the SCons manpage for a list of supported variables. Some additional variables