/usr/include/xmlrpc-c/abyss.h is in libxmlrpc-core-c3-dev 1.16.33-3.1ubuntu5.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | /*****************************************************************************
abyss.h
******************************************************************************
This file is the interface header for the Abyss HTTP server component of
XML-RPC For C/C++ (Xmlrpc-c).
The Abyss component of Xmlrpc-c is based on the independently developed
and distributed Abyss web server package from 2001.
Copyright information is at the end of the file.
****************************************************************************/
#ifndef XMLRPC_ABYSS_H_INCLUDED
#define XMLRPC_ABYSS_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <xmlrpc-c/inttypes.h>
/****************************************************************************
STUFF FOR THE OUTER CONTROL PROGRAM TO USE
****************************************************************************/
typedef int abyss_bool;
/****************************************************************************
GLOBAL (STATIC) PROGRAM STUFF
****************************************************************************/
void
AbyssInit(const char ** const errorP);
void
AbyssTerm(void);
/*********************************************************************
** MIMEType
*********************************************************************/
typedef struct MIMEType MIMEType;
MIMEType *
MIMETypeCreate(void);
void
MIMETypeDestroy(MIMEType * const MIMETypeP);
void
MIMETypeInit(void);
void
MIMETypeTerm(void);
abyss_bool
MIMETypeAdd2(MIMEType * const MIMETypeP,
const char * const type,
const char * const ext);
abyss_bool
MIMETypeAdd(const char * const type,
const char * const ext);
enum abyss_foreback {ABYSS_FOREGROUND, ABYSS_BACKGROUND};
#define HAVE_CHANSWITCH
typedef struct _TChanSwitch TChanSwitch;
typedef struct _TChannel TChannel;
typedef struct _TSocket TSocket;
#ifdef WIN32
#include <xmlrpc-c/abyss_winsock.h>
#else
#include <xmlrpc-c/abyss_unixsock.h>
#endif
void
ChanSwitchInit(const char ** const errorP);
void
ChanSwitchTerm(void);
/* If you're wondering where the constructors for TChanSwitch,
TChannel, and TSocket are: They're implementation-specific, so look
in abyss_unixsock.h, etc.
*/
void
ChanSwitchDestroy(TChanSwitch * const chanSwitchP);
void
ChannelInit(const char ** const errorP);
void
ChannelTerm(void);
void
ChannelDestroy(TChannel * const channelP);
void
SocketDestroy(TSocket * const socketP);
typedef struct {
/* Before Xmlrpc-c 1.04, the internal server representation,
struct _TServer, was exposed to users and was the only way to
set certain parameters of the server. Now, use the (new)
ServerSet...() functions. Use the HAVE_ macros to determine
which method you have to use.
*/
struct _TServer * srvP;
} TServer;
typedef struct _TSession TSession;
abyss_bool
ServerCreate(TServer * const serverP,
const char * const name,
xmlrpc_uint16_t const port,
const char * const filespath,
const char * const logfilename);
void
ServerCreateSwitch(TServer * const serverP,
TChanSwitch * const chanSwitchP,
const char ** const errorP);
abyss_bool
ServerCreateSocket(TServer * const serverP,
const char * const name,
TOsSocket const socketFd,
const char * const filespath,
const char * const logfilename);
#define HAVE_SERVER_CREATE_SOCKET_2
void
ServerCreateSocket2(TServer * const serverP,
TSocket * const socketP,
const char ** const errorP);
abyss_bool
ServerCreateNoAccept(TServer * const serverP,
const char * const name,
const char * const filespath,
const char * const logfilename);
void
ServerFree(TServer * const serverP);
void
ServerSetName(TServer * const serverP,
const char * const name);
void
ServerSetFilesPath(TServer * const serverP,
const char * const filesPath);
void
ServerSetLogFileName(TServer * const serverP,
const char * const logFileName);
#define HAVE_SERVER_SET_KEEPALIVE_TIMEOUT 1
void
ServerSetKeepaliveTimeout(TServer * const serverP,
xmlrpc_uint32_t const keepaliveTimeout);
#define HAVE_SERVER_SET_KEEPALIVE_MAX_CONN 1
void
ServerSetKeepaliveMaxConn(TServer * const serverP,
xmlrpc_uint32_t const keepaliveMaxConn);
#define HAVE_SERVER_SET_TIMEOUT 1
void
ServerSetTimeout(TServer * const serverP,
xmlrpc_uint32_t const timeout);
#define HAVE_SERVER_SET_ADVERTISE 1
void
ServerSetAdvertise(TServer * const serverP,
abyss_bool const advertise);
#define HAVE_SERVER_SET_MIME_TYPE 1
void
ServerSetMimeType(TServer * const serverP,
MIMEType * const MIMETypeP);
void
ServerInit(TServer * const serverP);
void
ServerRun(TServer * const serverP);
void
ServerRunOnce(TServer * const serverP);
/* ServerRunOnce2() is obsolete. See user's guide. */
void
ServerRunOnce2(TServer * const serverP,
enum abyss_foreback const foregroundBackground);
void
ServerRunChannel(TServer * const serverP,
TChannel * const channelP,
void * const channelInfoP,
const char ** const errorP);
#define HAVE_SERVER_RUN_CONN_2
void
ServerRunConn2(TServer * const serverP,
TSocket * const connectedSocketP,
const char ** const errorP);
void
ServerRunConn(TServer * const serverP,
TOsSocket const connectedSocket);
void
ServerDaemonize(TServer * const serverP);
void
ServerTerminate(TServer * const serverP);
void
ServerResetTerminate(TServer * const serverP);
void
ServerUseSigchld(TServer * const serverP);
#ifndef WIN32
void
ServerHandleSigchld(pid_t const pid);
#endif
typedef abyss_bool (*URIHandler) (TSession *); /* deprecated */
struct URIHandler2;
typedef void (*initHandlerFn)(struct URIHandler2 *, abyss_bool *);
typedef void (*termHandlerFn)(void *);
typedef void (*handleReq3Fn)(void *,
TSession *,
abyss_bool *);
typedef void (*handleReq2Fn)(struct URIHandler2 *,
TSession *,
abyss_bool *);
struct ServerReqHandler3 {
termHandlerFn term;
handleReq3Fn handleReq;
void * userdata;
size_t handleReqStackSize; /* zero = default */
};
void
ServerAddHandler3(TServer * const serverP,
const struct ServerReqHandler3 * const handlerP,
abyss_bool * const successP);
typedef struct URIHandler2 {
initHandlerFn init;
termHandlerFn term;
handleReq2Fn handleReq2;
URIHandler handleReq1; /* deprecated */
void * userdata;
} URIHandler2;
void
ServerAddHandler2(TServer * const srvP,
URIHandler2 * const handlerP,
abyss_bool * const successP);
abyss_bool
ServerAddHandler(TServer * const srvP,
URIHandler const handler);
typedef abyss_bool (*THandlerDflt) (TSession *);
/* Note: 'handler' used to be URIHandler; THandlerDflt is a newer name
for the same type
*/
void
ServerDefaultHandler(TServer * const srvP,
THandlerDflt const handler);
/* ConfReadServerFile() is inappropriately named; it was a mistake.
But then, so is having this function at all. The config file is
inappropriate for an API.
*/
abyss_bool
ConfReadServerFile(const char * const filename,
TServer * const srvP);
void
LogWrite(TServer * const srvP,
const char * const c);
/****************************************************************************
STUFF FOR HTTP REQUEST HANDLERS TO USE
****************************************************************************/
typedef enum {
m_unknown, m_get, m_put, m_head, m_post, m_delete, m_trace, m_options
} TMethod;
typedef struct {
TMethod method;
const char * uri;
/* This is NOT the URI. It is the pathname part of the URI.
We really should fix that and put the pathname in another
member. If the URI does not contain a pathname, this is "*".
*/
const char * query;
/* The query part of the URI (stuff after '?'). NULL if none. */
const char * host;
/* NOT the value of the host: header. Rather, the name of the
target host (could be part of the host: value; could be from the
URI). No port number. NULL if request does not specify a host
name.
*/
const char * from;
const char * useragent;
const char * referer;
const char * requestline;
const char * user;
/* Requesting user (from authorization: header). NULL if
request doesn't specify or handler has not authenticated it.
*/
xmlrpc_uint16_t port;
/* The port number from the URI, or default 80 if the URI doesn't
specify a port.
*/
abyss_bool keepalive;
} TRequestInfo;
abyss_bool
SessionRefillBuffer(TSession * const sessionP);
size_t
SessionReadDataAvail(TSession * const sessionP);
void
SessionGetReadData(TSession * const sessionP,
size_t const max,
const char ** const outStartP,
size_t * const outLenP);
void
SessionGetRequestInfo(TSession * const sessionP,
const TRequestInfo ** const requestInfoPP);
void
SessionGetChannelInfo(TSession * const sessionP,
void ** const channelInfoPP);
void *
SessionGetDefaultHandlerCtx(TSession * const sessionP);
char *
RequestHeaderValue(TSession * const sessionP,
const char * const name);
abyss_bool
ResponseAddField(TSession * const sessionP,
const char * const name,
const char * const value);
void
ResponseWriteStart(TSession * const sessionP);
/* For backward compatibility: */
#define ResponseWrite ResponseWriteStart
abyss_bool
ResponseWriteBody(TSession * const sessionP,
const char * const data,
xmlrpc_uint32_t const len);
abyss_bool
ResponseWriteEnd(TSession * const sessionP);
abyss_bool
ResponseChunked(TSession * const sessionP);
xmlrpc_uint16_t
ResponseStatusFromErrno(int const errnoArg);
void
ResponseStatus(TSession * const sessionP,
xmlrpc_uint16_t const code);
void
ResponseStatusErrno(TSession * const sessionP);
abyss_bool
ResponseContentType(TSession * const serverP,
const char * const type);
abyss_bool
ResponseContentLength(TSession * const sessionP,
xmlrpc_uint64_t const len);
void
ResponseError2(TSession * const sessionP,
const char * const explanation);
void
ResponseError(TSession * const sessionP);
const char *
MIMETypeFromExt(const char * const ext);
const char *
MIMETypeFromExt2(MIMEType * const MIMETypeP,
const char * const ext);
const char *
MIMETypeFromFileName2(MIMEType * const MIMETypeP,
const char * const fileName);
const char *
MIMETypeFromFileName(const char * const fileName);
const char *
MIMETypeGuessFromFile2(MIMEType * const MIMETypeP,
const char * const fileName);
const char *
MIMETypeGuessFromFile(const char * const filename);
/****************************************************************************
STUFF THAT PROBABLY DOESN'T BELONG IN THIS FILE BECAUSE IT IS INTERNAL
Some day, we sort this out.
****************************************************************************/
#define CR '\r'
#define LF '\n'
#define CRLF "\r\n"
/*********************************************************************
** Paths and so on...
*********************************************************************/
#ifdef WIN32
#define DEFAULT_ROOT "c:\\abyss"
#define DEFAULT_DOCS DEFAULT_ROOT"\\htdocs"
#define DEFAULT_CONF_FILE DEFAULT_ROOT"\\conf\\abyss.conf"
#define DEFAULT_LOG_FILE DEFAULT_ROOT"\\log\\abyss.log"
#else
#ifdef __rtems__
#define DEFAULT_ROOT "/abyss"
#else
#define DEFAULT_ROOT "/usr/local/abyss"
#endif
#define DEFAULT_DOCS DEFAULT_ROOT"/htdocs"
#define DEFAULT_CONF_FILE DEFAULT_ROOT"/conf/abyss.conf"
#define DEFAULT_LOG_FILE DEFAULT_ROOT"/log/abyss.log"
#endif
/*********************************************************************
** Maximum number of simultaneous connections
*********************************************************************/
#define MAX_CONN 16
/*********************************************************************
** General purpose definitions
*********************************************************************/
#ifndef NULL
#define NULL ((void *)0)
#endif /* NULL */
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
/*********************************************************************
** Range
*********************************************************************/
abyss_bool
RangeDecode(char * const str,
xmlrpc_uint64_t const filesize,
xmlrpc_uint64_t * const start,
xmlrpc_uint64_t * const end);
abyss_bool DateInit(void);
/*********************************************************************
** Base64
*********************************************************************/
void
Base64Encode(const char * const chars,
char * const base64);
/*********************************************************************
** Session
*********************************************************************/
abyss_bool SessionLog(TSession * const s);
#ifdef __cplusplus
}
#endif
/*****************************************************************************
** Here is the copyright notice from the Abyss web server project file from
** which this file is derived.
**
** Copyright (C) 2000 by Moez Mahfoudh <mmoez@bigfoot.com>.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
******************************************************************************/
#endif /* _ABYSS_H_ */
|