#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include "XPort.h"
#include "Utils.h"
#include "qnx_port.h"
#include "BicamConsts.h"
Functions | |
| void | sig_handler (int sig) |
| Signal handler (SIGINT, SIGTERM) for XPortSim process. | |
| int | sendBytes (int sd, char *buf, int len) |
| send bytes to specified socket. | |
| int | sendResponse (int sd, XPortResponse *xpResponse) |
| Send XPortResponse to specified socket. | |
| int | sendMessage (int sd, char *msg) |
| Send bytes to specified socket. | |
| void | startMockXPort (char *host) |
| Start XPortSim server. | |
| int | getListenerSocket (int *sd, char *hostname, unsigned short port, struct sockaddr_in *servAddr) |
| Establish listener socket. | |
| void * | gpioListener () |
| GPIO handler. | |
| void * | serialListener () |
| Serial handler. | |
| void | startMockXPort (const char *host) |
| start XPortSim server | |
| int | main (int argc, char *argv[]) |
| XPortSim Entry Point. | |
Variables | |
| boolean | shutdownFlag = FALSE |
| shutdown if TRUE | |
| pid_t | mockXPortPID |
| Process ID of XPortSim server. | |
| pid_t | gpioPID |
| Process ID of GPIO TCP/IP process. | |
| pid_t | serialPID |
| Process ID of Serial IO TCP/IP process. | |
| int getListenerSocket | ( | int * | sd, | |
| char * | hostname, | |||
| unsigned short | port, | |||
| struct sockaddr_in * | servAddr | |||
| ) |
Establish listener socket.
| sd | socket descriptor to assign | |
| hostname | XPortSim server hostname | |
| port | XPortSim server TCP/IP port | |
| servAddr | socket address |
| void* gpioListener | ( | ) |
GPIO handler.
Receives incoming XPort GPIO traffic and returns appropriate messages.
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
XPortSim Entry Point.
Starts XPortSim server.
| argc | number of command line arguments | |
| argv | command line parameters |
| int sendBytes | ( | int | sd, | |
| char * | buf, | |||
| int | len | |||
| ) |
send bytes to specified socket.
| sd | socket descriptor | |
| buf | byte buffer | |
| len | number of bytes to send |
| int sendMessage | ( | int | sd, | |
| char * | msg | |||
| ) |
Send bytes to specified socket.
| sd | socket descriptor | |
| msg | bytes to send. |
| int sendResponse | ( | int | sd, | |
| XPortResponse * | xpResponse | |||
| ) |
Send XPortResponse to specified socket.
| sd | socket descriptor | |
| xpResponse | pointer to XPortResponse |
| void* serialListener | ( | ) |
Serial handler.
Receives incoming XPort Serial traffic and returns appropriate messages. ToDo: use local serial port for full emulation.
| void sig_handler | ( | int | sig | ) |
Signal handler (SIGINT, SIGTERM) for XPortSim process.
| sig | signal received |
| void startMockXPort | ( | const char * | host | ) |
start XPortSim server
| host | hostname |
| void startMockXPort | ( | char * | host | ) |
Start XPortSim server.
| host | hostname |
1.5.4