gfamininetdev.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // gfamininetdev.h :
  2. //
  3. #if !defined(AGD_GFAMININETDEV_H__A748DF9B_2D65_499F_952B_104B6F1228F7__INCLUDED_)
  4. #define AGD_GFAMININETDEV_H__A748DF9B_2D65_499F_952B_104B6F1228F7__INCLUDED_
  5. #include <gfagenericdev.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif // __cplusplus
  9. /////////////////////////////////////////////////////////////////////////////
  10. // gfamininetdev.h - Declarations:
  11. typedef void *HMINETDEV;
  12. /////////////////////////////////////////////////////////////////////////////
  13. typedef struct _GFA_MININET_DEV_CFG_PARAMS
  14. {
  15. const char *pszDeviceName;
  16. const void *pDevParams;
  17. size_t nSizeDevParams;
  18. GFA_GENERIC_DEVICE_INTERFACE itf;
  19. }GFA_MININET_DEV_CFG_PARAMS, *LPGFA_MININET_DEV_CFG_PARAMS;
  20. typedef const GFA_MININET_DEV_CFG_PARAMS *LPCGFA_MININET_DEV_CFG_PARAMS;
  21. /////////////////////////////////////////////////////////////////////////////
  22. HMINETDEV GfaMininetDeviceOpen(LPCGFA_MININET_DEV_CFG_PARAMS pmdcp);
  23. void GfaMininetDeviceClose(HMINETDEV hDev);
  24. ssize_t GfaMininetDeviceGetConfigParams(HMINETDEV hDev, void *pDevParams, size_t nSizeDevParams);
  25. int GfaMininetDeviceSetConfigParams(HMINETDEV hDev, const void *pDevParams, size_t nSizeDevParams);
  26. bool GfaMininetDeviceIsValidBaudrate(HMINETDEV hDev, uint32_t nBaudrate);
  27. int GfaMininetDeviceSetBaudrate(HMINETDEV hDev, uint32_t nBaudrate);
  28. bool GfaMininetDeviceGetTimeouts(HMINETDEV hDev, struct timeval *ptvRX, struct timeval *ptvTX);
  29. bool GfaMininetDeviceSetTimeouts(HMINETDEV hDev, const struct timeval *ptvRX, const struct timeval *ptvTX);
  30. ssize_t GfaMininetDevicePurgeRXBuffer(HMINETDEV hDev);
  31. ssize_t GfaMininetDeviceReceive(HMINETDEV hDev, void *pBuf, size_t nCbToRead); // blocking
  32. ssize_t GfaMininetDeviceRead(HMINETDEV hDev, void *pBuf, size_t nCbToRead); // not blocking
  33. ssize_t GfaMininetDevicePop(HMINETDEV hDev, uint8_t *pb); // 1 byte, blocking
  34. ssize_t GfaMininetDevicePeek(HMINETDEV hDev); // not blocking
  35. ssize_t GfaMininetDeviceTransmit(HMINETDEV hDev, const void *pData, size_t nCbData); // blocking
  36. ssize_t GfaMininetDeviceWrite(HMINETDEV hDev, const void *pData, size_t nCbData); // not blocking
  37. ssize_t GfaMininetDevicePush(HMINETDEV hDev, uint8_t b); // 1 byte, blocking
  38. /////////////////////////////////////////////////////////////////////////////
  39. #ifdef __cplusplus
  40. }
  41. #endif // __cplusplus
  42. #endif // !defined(AGD_GFAMININETDEV_H__A748DF9B_2D65_499F_952B_104B6F1228F7__INCLUDED_)