All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Sirius TCP/UDP/IP stack Documentation

The Sirius TCP/UDP/IP stack is specially written for the Cavium OCTEON processor. It has been written from the ground up to get to most of the OCTEON hardware architecture and acceleration modules. It provides a BSD-like socket interface and has functions to process data via a smart memory list, enabling "zero-copy" mode.

The stack has been written in C++ allowing the application programmer to write efficient code at a high abstraction level. Although not advised, for those not fond of C++, a C-Wrapper class is available.
To make the most of the OCTEON multi core system, all functions are non blocking and events are transferred to the application layer via virtual functions the application has to handle.
A simple and more complex echo application example is provided that show the setup of a program using Sirius.

Among others, the following socket API calls are available:

int CSirius::So_Accept(int fd, sir_ip_sockaddr_t *ptSockaddr)
int CSirius::So_Socket(int domain, int type, int protocol)
int CSirius::So_Bind (int fd, const sir_ip_sockaddr_t *ptSockaddr)
int CSirius::So_BindOverload (int fd, const sir_ip_sockaddr_t *ptSockaddr, const int iPortNr)
int CSirius::So_Listen(int fd, int backlog)
int CSirius::So_Connect(int fd, const sir_ip_sockaddr_t *ptSockaddr)
int CSirius::So_Close(int fd)
int CSirius::So_Notify(int fd, void *pReference)
void* CSirius::So_Notify(int fd)
int CSirius::So_Recv(int fd, char *pBuf, int iLen, int iFlags)
int CSirius::So_RecvFrom(int fd, char *pBuf, int iLen, int iFlags, sir_ip_sockaddr_t *ptSrc_Addr)
int CSirius::So_SendTo(int fd, char *pBuf, int iLen, const sir_ip_sockaddr_t *ptSockaddr)
int CSirius::So_SetAppTag(int fd, uint32_t ui32AppTag)
int CSirius::So_SetCanSendEvent(int fd, uint32_t ui32FreeSpace)
int CSirius::So_GetAvailableData(int fd, EPayload_Indicator ePayloadIndicator)
int CSirius::So_SetSockOpt(int fd, ESockOptLevel eSockLevel, ESockOptName eSockOptName, char *pValue, int iValueLength)

Simple Exec and Linux

Sirius will work on Simple Exec as well as on Cavium Linux. When using Linux, special precautions have to be followed regarding the octeon-ethernet driver. This driver is interrupt-driven and will destroy the atomic tag. As the atomic tag is the mechanism Sirius is built on, modifying the atomic tag without notice is killing. Therefore, keep one rule in mind: if using Sirius on more than one core, DO NOT USE the octeon-ethernet driver. A good alternative for the driver in this case is the Sirius tap driver. More information about the Sirius tap driver can be found here :

Making the OCTEON SDK understanding C++

Although Cavium states it supports C++, information about this issue is hard to find. Here is an article that explains how to convert the OCTEON SDK so it will support C++. After the proposed modifications it will compile and link C- and C++-files. This means you can still build the older C-projects.


Sirius has been written in C++ but stay with us if you are stuck to C. A C-wrapper is provided and provides the following API calls (among others):

int Sirius_Init()
int So_Accept(int fd, sir_ip_sockaddr_t *ptSockaddr)
int So_Bind(int fd, const sir_ip_sockaddr_t *ptSockaddr)
int So_BindOverload(int fd, const sir_ip_sockaddr_t *ptSockaddr, const int iPortNr)
int So_CanSend(int fd)
int So_Close(int fd)
int So_Connect(int fd, const sir_ip_sockaddr_t *ptSockaddr)
int So_GetSockName(int fd, sir_ip_sockaddr_t *ptSockaddr)
int So_Listen(int fd, int backlog)
int So_SetNotify(int fd, void *pReference)
void *So_GetNotify(int fd)
int So_Recv(int fd, char *pBuf, int iLen, int iFlags)
int So_RecvFast(int fd, pMemList pMemList, int iFlags)
int So_RecvFrom(int fd, char *pBuf, int iLen, int iFlags, sir_ip_sockaddr_t *ptSrc_Addr)
int So_RecvFromFast(int fd, pMemList ptMemList, int iFlags, sir_ip_sockaddr_t *ptSrc_Addr)
int So_SendTo (int fd, char *pBuf, int iLen, const sir_ip_sockaddr_t *ptSockaddr)
int So_SendToFast(int fd, pMemList ptMemList, const sir_ip_sockaddr_t *ptSockaddr)
int So_SetSockOpt(int fd, ESockOptLevel eSockLevel, ESockOptName eSockOptName, char *pValue, int iValueLength)
int So_Socket(int domain, int type, int protocol)

Some examples

Examining how an example works or is coded is more informative and practical compared to studying the manual. We have supplied two C++-coded examples and one C-coded example.
The first C++ example is a simple echo server. It sets up a listen socket on port 80. After a client connects to this port, all the data it sends will be echoed back. This example is also available as a C-version.
The third example is a more complex C++-coded chat application. Allowing numerous clients to connect via telnet it will transfer all data received on a connection to all other connections.

For more information visit us at