view service.h @ 0:e70ea46d6073

Initial import from http://wouhanegaine.free.fr/dev/DSPad02b_neo07.zip
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 22 Feb 2015 01:38:06 +0100
parents
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 */