/************************************************************************
 *
 * Copyrigth: Karl Hammar, Aspö Data, LGPL
 *
 */

#ifndef __IPIO_H__
#define __IPIO_H__

#include <sys/types.h> 
#include <netinet/in.h>
#include <sys/time.h>

#define  IPIOMOD_MAGIC       0x11

#define  IPIOMOD_STATUS      0x00
#define  IPIOMOD_RELAY_WRITE 0x01
#define  IPIOMOD_RELAY_READ  0x02
#define  IPIOMOD_IO_WRITE    0x03
#define  IPIOMOD_IO_READ     0x04
#define  IPIOMOD_DAC_WRITE   0x05
#define  IPIOMOD_DAC_READ    0x06
#define  IPIOMOD_RESET       0x07
#define  IPIOMOD_DAC_CALDATA 0x08

int ipio_open(int *fd, struct sockaddr_in *endpoint, const char *host, unsigned short port);
int ipio_send(int fd, struct sockaddr_in *endpoint, uint8_t const *obuf, int const olen);
int ipio_recv(int fd, uint8_t const *obuf, int const olen, uint8_t *ibuf, int const ilen);
int ipio_exec(int fd, struct sockaddr_in *endpoint, uint8_t const *obuf, int const olen, uint8_t *ibuf, int const ilen, struct timeval *tv);

#endif /* __IPIO_H__ */

