Mercurial > remote-gamepad-server
view service.h @ 9:5e15d64a2d24 default tip
If somebody closed stdin, fd could be both valid and 0, don’t check for that.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 18 Aug 2015 02:09:55 +0100 |
parents | e70ea46d6073 |
children |
line wrap: on
line source
#ifndef SERVICE_H #define SERVICE_H #include "uinput.h" #include "ds.h" #include "restartOp.h" #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdlib.h> #include <string.h> #define DEFAULT_DEV_QTY 2 /* How many jsX devices */ #define DEFAULT_BASE_UDP_PORT 16150 /* Listen DS datagrams */ /* Globals... */ #ifndef __MAIN_FILE__ extern uint8_t nbdev; extern uint8_t curdev; extern uint16_t base_port; extern char* uinput_dev; #else uint8_t nbdev = DEFAULT_DEV_QTY; uint8_t curdev; uint16_t base_port = DEFAULT_BASE_UDP_PORT; char* uinput_dev = NULL; #endif /* Create a socket Returns socket descriptor (-1 if error) */ extern int create_socket(unsigned short *port, int type); /* Receive a DS datagram */ extern ssize_t receive_ds_info(int socket, ds_t* ds); /* Start the listening service yeah! */ extern void start_service(void); #endif /* SERVICE_H */