23 #include "FwSmConstants.h"
24 #include "FwSmConfig.h"
26 #include "FwPrConfig.h"
28 #include "FwPrConstants.h"
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <netinet/in.h>
77 struct sockaddr_in serv_addr,
cli_addr;
78 pthread_t acceptThread;
82 sockfd = socket(AF_INET, SOCK_STREAM, 0);
84 perror(
"CrFwInStreamSocketInitAction, Socket creation");
89 bzero((
char*) &serv_addr,
sizeof(serv_addr));
90 serv_addr.sin_family = AF_INET;
91 serv_addr.sin_addr.s_addr = INADDR_ANY;
92 serv_addr.sin_port = htons(
portno);
93 if (bind(
sockfd, (
struct sockaddr*) &serv_addr,
sizeof(serv_addr)) < 0) {
94 perror(
"CrFwOutStreamSocketInitAction, Bind Socket");
102 pthread_attr_init(&attr);
103 if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) {
104 perror(
"CrFwOutStreamSocketInitAction, set detached state");
135 printf(
"CrFwOutStreamSocketInitAction: error writing to socket\n");
149 perror(
"CrFwInStreamSocketInitAction, Socket Accept");
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
void CrFwOutStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an OutStream.
void CrFwOutStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an OutStream.
static CrFwCmpData_t outStreamData[CR_FW_NOF_OUTSTREAM]
The base data structures for the OutStream State Machines and their Procedures.
Definition of the OutStream component.
void CrFwOutStreamSocketInitAction(FwPrDesc_t prDesc)
Initialization action for the socket-based OutStream.
static socklen_t clilen
Socket variable.
static struct sockaddr_in cli_addr
Socket variable.
CrFwBool_t CrFwOutStreamSocketPcktHandover(CrFwPckt_t pckt)
Function implementing the hand-over operation for the socket-based OutStream.
static void * acceptThreadEntry(void *ptr)
Entry point for the thread which waits for the incoming connection from the InStream.
void CrFwOutStreamSocketConfigCheck(FwPrDesc_t prDesc)
Configuration check for the socket-based OutStream.
void CrFwOutStreamSocketShutdownAction(FwSmDesc_t smDesc)
Shutdown action for the socket-based OutStream.
void CrFwOutStreamSocketInitCheck(FwPrDesc_t prDesc)
Initialization check for the socket-based OutStream.
static int sockfd
The file descriptors for the socket.
void CrFwOutStreamSocketSetPort(unsigned short n)
Set the port number for the socket.
static int newsockfd
The file descriptors for the socket.
static unsigned short portno
Set the port number (must be same as the port number specified in CrFwOutStreamSocket....
Interface for the Socket-Based OutStream.
User-modifiable parameters for the OutStream components (see CrFwOutStream.h).
Interface for creating and accessing a report or command packet.
CrFwPcktLength_t CrFwPcktGetLength(CrFwPckt_t pckt)
Return the length (in number of bytes) of a packet.
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
Interface through which framework components access the current time.
Definition of the utility functions for the CORDET Framework.
Type for the Framework Component Data (FCD).
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.