Annotation of parser3/src/include/pa_socks.h, revision 1.29
1.2 paf 1: /** @file
2: Parser: socks initialization/finalization decls.
1.1 paf 3:
1.24 moko 4: Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.22 moko 5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.1 paf 6: */
7:
8: #ifndef PA_SOCKS_H
9: #define PA_SOCKS_H
1.9 paf 10:
1.29 ! moko 11: #define IDENT_PA_SOCKS_H "$Id: pa_socks.h,v 1.28 2026/10/17 23:11:25 moko Exp $"
1.25 moko 12:
13: #ifdef _MSC_VER
14: #define socklen_t int
15: #else
16: #define closesocket close
17: #define INVALID_SOCKET -1
18: typedef int SOCKET;
19: #endif
1.1 paf 20:
1.15 paf 21: void pa_socks_init();
22: void pa_socks_done();
1.16 paf 23:
24: int pa_socks_errno();
25: const char* pa_socks_strerr(int no);
1.1 paf 26:
1.26 moko 27: /// true if the error means that the connection is reset or aborted
28: bool pa_socks_is_reset(int no);
29:
1.27 moko 30: /// true if the error means that the call is interrupted by a signal
31: bool pa_socks_is_interrupted(int no);
32:
1.29 ! moko 33: /// recv and send, restarted if interrupted by a signal: GC stops the threads with signals, the socket timeout (SO_RCVTIMEO, SO_SNDTIMEO) is not restarted
1.27 moko 34: ssize_t pa_sock_recv(SOCKET sock, char *buf, size_t len);
35: ssize_t pa_sock_send(SOCKET sock, const char *buf, size_t len);
36:
1.28 moko 37: /// waits up to timeout_ms (negative is forever) for the socket to be ready for reading (or writing): >0 ready, 0 timeout, <0 error
1.25 moko 38: int pa_sock_ready(SOCKET sock, bool for_write, int timeout_ms);
39:
1.1 paf 40: #endif
E-mail: