diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2008-09-27 17:52:05 +0000 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2008-09-27 17:52:05 +0000 |
commit | 6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8 (patch) | |
tree | 0c4e761c5b5aad7010c210a4519a2a72760af55d /src/curlhelper.h | |
parent | eedc9cd68aef078e4584e43d8055d70e1fa07351 (diff) | |
download | nagios-plugin-curl-6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8.tar.gz nagios-plugin-curl-6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8.tar.bz2 |
- added first runnig version
Diffstat (limited to 'src/curlhelper.h')
-rw-r--r-- | src/curlhelper.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/curlhelper.h b/src/curlhelper.h new file mode 100644 index 0000000..a027918 --- /dev/null +++ b/src/curlhelper.h @@ -0,0 +1,50 @@ +/* + check_curl - Nagios Curl-based check plugin + Copyright (C) 2008 Andreas Baumann + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __CURLHELPER_H +#define __CURLHELPER_H + +/* callbacks for body, header, debug output */ + +typedef struct { + char *buf; + size_t buflen; + size_t bufsize; +} curlhelp_curlbuf; + +int curlhelp_initbuffer( curlhelp_curlbuf *buf ); +int curlhelp_buffer_callback( void *buffer, size_t size, size_t nmemb, void *stream ); +void curlhelp_freebuffer( curlhelp_curlbuf *buf ); + +/* parsing */ + +typedef struct { + int http_major; /* major version of the protocol, always 1 (HTTP/0.9 + * never reached the big internet most likely) */ + int http_minor; /* minor version of the protocol, usually 0 or 1 */ + int http_code; /* HTTP return code as in RFC 2145 */ + int http_subcode; /* Microsoft IIS extension, HTTP subcodes, see + * http://support.microsoft.com/kb/318380/en-us */ + char *msg; /* the human readable message */ + char *first_line; /* a copy of the first line */ +} curlhelp_statusline; + +int curlhelp_parse_statusline( char *buf, curlhelp_statusline *status_line ); +void curlhelp_free_statusline( curlhelp_statusline *status_line ); + +#endif /* __CURLHELPER_H */ |