diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-12 19:37:20 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-12 19:37:20 (GMT) |
commit | e8044713d41f5ef1d9ce814df4a079d8f92306b0 (patch) | |
tree | e4b6f3d068c850774b9cda16f7c5830b9fc15774 /lib/utils_tcp.h | |
parent | 662997251d4fc43f4155784f9e7df827f193305e (diff) | |
download | monitoring-plugins-e8044713d41f5ef1d9ce814df4a079d8f92306b0.tar.gz |
check_tcp: Properly deal will partial recv(3)s
The np_expect_match() function now returns one of three possible states
instead of just TRUE or FALSE:
- NP_MATCH_SUCCESS
- NP_MATCH_FAILURE
- NP_MATCH_RETRY
The NP_MATCH_RETRY state indicates that matching might succeed if
np_expect_match() is called with a longer input string. This allows
check_tcp to decide whether it makes sense to wait for additional data
from the server.
Diffstat (limited to 'lib/utils_tcp.h')
-rw-r--r-- | lib/utils_tcp.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/utils_tcp.h b/lib/utils_tcp.h index 34b771d..0328a9c 100644 --- a/lib/utils_tcp.h +++ b/lib/utils_tcp.h | |||
@@ -4,5 +4,19 @@ | |||
4 | #define NP_MATCH_EXACT 0x2 | 4 | #define NP_MATCH_EXACT 0x2 |
5 | #define NP_MATCH_VERBOSE 0x4 | 5 | #define NP_MATCH_VERBOSE 0x4 |
6 | 6 | ||
7 | int np_expect_match(char* status, char** server_expect, int server_expect_count, | 7 | /* |
8 | int flags); | 8 | * The NP_MATCH_RETRY state indicates that matching might succeed if |
9 | * np_expect_match() is called with a longer input string. This allows the | ||
10 | * caller to decide whether it makes sense to wait for additional data from the | ||
11 | * server. | ||
12 | */ | ||
13 | enum np_match_result { | ||
14 | NP_MATCH_FAILURE, | ||
15 | NP_MATCH_SUCCESS, | ||
16 | NP_MATCH_RETRY | ||
17 | }; | ||
18 | |||
19 | enum np_match_result np_expect_match(char *status, | ||
20 | char **server_expect, | ||
21 | int server_expect_count, | ||
22 | int flags); | ||