62 #define SOCKET_ERROR -1 63 #define INVALID_SOCKET -1 64 #define closesocket(s) close(s) 65 #include <sys/socket.h> 66 #include <netinet/in.h> 67 #include <arpa/inet.h> 68 #include <netinet/tcp.h> 72 #define SEND_NOSIGPIPE MSG_NOSIGNAL 74 #define SEND_NOSIGPIPE 0 78 #define SOCK_ERR (WSAGetLastError()) 80 #define SOCK_ERR (errno) 82 #define REPORT_ERR(msg) if(errmsg){ YSPRINTF(errmsg,YOCTO_ERRMSG_LEN,"%s (%s:%d / errno=%d)",(msg), __FILE_ID__, __LINE__, SOCK_ERR);errmsg[YOCTO_ERRMSG_LEN-1]='\0';} 84 #define yNetSetErr() yNetSetErrEx(__LINE__,SOCK_ERR,errmsg) 88 #define YTCP_REMOTE_CLOSE 1 98 void yDupSet(
char **storage,
const char *val);
104 int yTcpDownload(
const char *host,
const char *url, u8 **out_buffer, u32 mstimeout,
char *
errmsg);
113 int yReqOpen(
struct _RequestSt *tcpreq,
int wait_for_start,
int tcpchan,
const char *request,
int reqlen, u64 mstimeout,
yapiRequestAsyncCallback callback,
void *
context,
yapiRequestProgressCallback progress_cb,
void *progress_ctx,
char *
errmsg);
130 #define OS_IFACE_CAN_MCAST 1 138 #ifdef YAPI_IN_YDEVICE 145 #define SSDP_UUID_LEN 48 146 #define SSDP_URL_LEN 48 162 #define NB_SSDP_CACHE_ENTRY 32 163 #define NB_OS_IFACES 8 int yStartWakeUpSocket(WakeUpSocket *wuce, char *errmsg)
int ySSDPStart(SSDPInfos *SSDP, ssdpHubDiscoveryCallback callback, char *errmsg)
void yReqClose(struct _RequestSt *tcpreq)
int yNetSetErrEx(u32 line, unsigned err, char *errmsg)
ssdpHubDiscoveryCallback callback
int yReqGet(struct _RequestSt *tcpreq, u8 **buffer)
void ySSDPStop(SSDPInfos *SSDP)
void yDupSet(char **storage, const char *val)
void(* yapiRequestProgressCallback)(void *context, u32 acked, u32 totalbytes)
int yConsumeWakeUpSocket(WakeUpSocket *wuce, char *errmsg)
char errmsg[YOCTO_ERRMSG_LEN]
int yDringWakeUpSocket(WakeUpSocket *wuce, u8 signal, char *errmsg)
void yReqFree(struct _RequestSt *tcpreq)
int yReqMultiSelect(struct _RequestSt **tcpreq, int size, u64 ms, WakeUpSocket *wuce, char *errmsg)
os_ifaces detectedIfaces[NB_OS_IFACES]
void yFreeWakeUpSocket(WakeUpSocket *wuce)
int yReqOpen(struct _RequestSt *tcpreq, int wait_for_start, int tcpchan, const char *request, int reqlen, u64 mstimeout, yapiRequestAsyncCallback callback, void *context, yapiRequestProgressCallback progress_cb, void *progress_ctx, char *errmsg)
void * ws_thread(void *ctx)
YSTATIC int yDetectNetworkInterfaces(u32 only_ip)
u32 yResolveDNS(const char *name, char *errmsg)
int yReqHasPending(struct _HubSt *hub)
void(* ssdpHubDiscoveryCallback)(const char *serial, const char *urlToRegister, const char *urlToUnregister)
int yReqIsEof(struct _RequestSt *tcpreq, char *errmsg)
void(* yapiRequestAsyncCallback)(void *context, const u8 *result, u32 resultlen, int retcode, const char *errmsg)
int yReqRead(struct _RequestSt *rcoreq, u8 *buffer, int len)
void yInitWakeUpSocket(WakeUpSocket *wuce)
struct _RequestSt * yReqAlloc(struct _HubSt *hub)
yapiRequestAsyncCallback callback
#define NB_SSDP_CACHE_ENTRY
int yTcpInit(char *errmsg)
int yTcpDownload(const char *host, const char *url, u8 **out_buffer, u32 mstimeout, char *errmsg)
int yReqIsAsync(struct _RequestSt *req)
int yReqSelect(struct _RequestSt *tcpreq, u64 ms, char *errmsg)
int ySSDPDiscover(SSDPInfos *SSDP, char *errmsg)