aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r--src/microhttpd/internal.h74
1 files changed, 51 insertions, 23 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index c2cab42d..c0700ddf 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2007-2013 Daniel Pittman and Christian Grothoff 3 Copyright (C) 2007-2015 Daniel Pittman and Christian Grothoff
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -487,8 +487,10 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state);
487 * @param max_bytes maximum number of bytes to receive 487 * @param max_bytes maximum number of bytes to receive
488 * @return number of bytes written to write_to 488 * @return number of bytes written to write_to
489 */ 489 */
490typedef ssize_t (*ReceiveCallback) (struct MHD_Connection * conn, 490typedef ssize_t
491 void *write_to, size_t max_bytes); 491(*ReceiveCallback) (struct MHD_Connection *conn,
492 void *write_to,
493 size_t max_bytes);
492 494
493 495
494/** 496/**
@@ -499,8 +501,10 @@ typedef ssize_t (*ReceiveCallback) (struct MHD_Connection * conn,
499 * @param max_bytes maximum number of bytes to transmit 501 * @param max_bytes maximum number of bytes to transmit
500 * @return number of bytes transmitted 502 * @return number of bytes transmitted
501 */ 503 */
502typedef ssize_t (*TransmitCallback) (struct MHD_Connection * conn, 504typedef ssize_t
503 const void *write_to, size_t max_bytes); 505(*TransmitCallback) (struct MHD_Connection *conn,
506 const void *write_to,
507 size_t max_bytes);
504 508
505 509
506/** 510/**
@@ -578,14 +582,23 @@ struct MHD_Connection
578 struct MemoryPool *pool; 582 struct MemoryPool *pool;
579 583
580 /** 584 /**
581 * We allow the main application to associate some 585 * We allow the main application to associate some pointer with the
582 * pointer with the connection. Here is where we 586 * HTTP request, which is passed to each #MHD_AccessHandlerCallback
583 * store it. (MHD does not know or care what it 587 * and some other API calls. Here is where we store it. (MHD does
584 * is). 588 * not know or care what it is).
585 */ 589 */
586 void *client_context; 590 void *client_context;
587 591
588 /** 592 /**
593 * We allow the main application to associate some pointer with the
594 * TCP connection (which may span multiple HTTP requests). Here is
595 * where we store it. (MHD does not know or care what it is).
596 * The location is given to the #MHD_NotifyConnectionCallback and
597 * also accessible via #MHD_CONNECTION_INFO_SOCKET_CONTEXT.
598 */
599 void *socket_context;
600
601 /**
589 * Request method. Should be GET/POST/etc. Allocated 602 * Request method. Should be GET/POST/etc. Allocated
590 * in pool. 603 * in pool.
591 */ 604 */
@@ -606,7 +619,7 @@ struct MHD_Connection
606 /** 619 /**
607 * Buffer for reading requests. Allocated 620 * Buffer for reading requests. Allocated
608 * in pool. Actually one byte larger than 621 * in pool. Actually one byte larger than
609 * read_buffer_size (if non-NULL) to allow for 622 * @e read_buffer_size (if non-NULL) to allow for
610 * 0-termination. 623 * 0-termination.
611 */ 624 */
612 char *read_buffer; 625 char *read_buffer;
@@ -620,7 +633,8 @@ struct MHD_Connection
620 /** 633 /**
621 * Last incomplete header line during parsing of headers. 634 * Last incomplete header line during parsing of headers.
622 * Allocated in pool. Only valid if state is 635 * Allocated in pool. Only valid if state is
623 * either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED. 636 * either #MHD_CONNECTION_HEADER_PART_RECEIVED or
637 * #MHD_CONNECTION_FOOTER_PART_RECEIVED.
624 */ 638 */
625 char *last; 639 char *last;
626 640
@@ -628,12 +642,13 @@ struct MHD_Connection
628 * Position after the colon on the last incomplete header 642 * Position after the colon on the last incomplete header
629 * line during parsing of headers. 643 * line during parsing of headers.
630 * Allocated in pool. Only valid if state is 644 * Allocated in pool. Only valid if state is
631 * either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED. 645 * either #MHD_CONNECTION_HEADER_PART_RECEIVED or
646 * #MHD_CONNECTION_FOOTER_PART_RECEIVED.
632 */ 647 */
633 char *colon; 648 char *colon;
634 649
635 /** 650 /**
636 * Foreign address (of length addr_len). MALLOCED (not 651 * Foreign address (of length @e addr_len). MALLOCED (not
637 * in pool!). 652 * in pool!).
638 */ 653 */
639 struct sockaddr *addr; 654 struct sockaddr *addr;
@@ -676,7 +691,7 @@ struct MHD_Connection
676 691
677 /** 692 /**
678 * How many more bytes of the body do we expect 693 * How many more bytes of the body do we expect
679 * to read? MHD_SIZE_UNKNOWN for unknown. 694 * to read? #MHD_SIZE_UNKNOWN for unknown.
680 */ 695 */
681 uint64_t remaining_upload_size; 696 uint64_t remaining_upload_size;
682 697
@@ -800,17 +815,17 @@ struct MHD_Connection
800 /** 815 /**
801 * Handler used for processing read connection operations 816 * Handler used for processing read connection operations
802 */ 817 */
803 int (*read_handler) (struct MHD_Connection * connection); 818 int (*read_handler) (struct MHD_Connection *connection);
804 819
805 /** 820 /**
806 * Handler used for processing write connection operations 821 * Handler used for processing write connection operations
807 */ 822 */
808 int (*write_handler) (struct MHD_Connection * connection); 823 int (*write_handler) (struct MHD_Connection *connection);
809 824
810 /** 825 /**
811 * Handler used for processing idle connection operations 826 * Handler used for processing idle connection operations
812 */ 827 */
813 int (*idle_handler) (struct MHD_Connection * connection); 828 int (*idle_handler) (struct MHD_Connection *connection);
814 829
815 /** 830 /**
816 * Function used for reading HTTP request stream. 831 * Function used for reading HTTP request stream.
@@ -864,9 +879,10 @@ struct MHD_Connection
864 * @param con connection handle 879 * @param con connection handle
865 * @return new closure 880 * @return new closure
866 */ 881 */
867typedef void * (*LogCallback)(void * cls, 882typedef void *
868 const char * uri, 883(*LogCallback)(void * cls,
869 struct MHD_Connection *con); 884 const char * uri,
885 struct MHD_Connection *con);
870 886
871/** 887/**
872 * Signature of function called to unescape URIs. See also 888 * Signature of function called to unescape URIs. See also
@@ -877,9 +893,10 @@ typedef void * (*LogCallback)(void * cls,
877 * @param uri 0-terminated string to unescape (should be updated) 893 * @param uri 0-terminated string to unescape (should be updated)
878 * @return length of the resulting string 894 * @return length of the resulting string
879 */ 895 */
880typedef size_t (*UnescapeCallback)(void *cls, 896typedef size_t
881 struct MHD_Connection *conn, 897(*UnescapeCallback)(void *cls,
882 char *uri); 898 struct MHD_Connection *conn,
899 char *uri);
883 900
884 901
885/** 902/**
@@ -1000,6 +1017,17 @@ struct MHD_Daemon
1000 void *notify_completed_cls; 1017 void *notify_completed_cls;
1001 1018
1002 /** 1019 /**
1020 * Function to call when we are starting/stopping
1021 * a connection. May be NULL.
1022 */
1023 MHD_NotifyConnectionCallback notify_connection;
1024
1025 /**
1026 * Closure argument to notify_connection.
1027 */
1028 void *notify_connection_cls;
1029
1030 /**
1003 * Function to call with the full URI at the 1031 * Function to call with the full URI at the
1004 * beginning of request processing. May be NULL. 1032 * beginning of request processing. May be NULL.
1005 * <p> 1033 * <p>