"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isccc/include/isccc/ccmsg.h" (7 Sep 2020, 3647 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ccmsg.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 9.17.3_vs_9.17.4.

    1 /*
    2  * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  *
   11  * Portions Copyright (C) 2001 Nominum, Inc.
   12  *
   13  * Permission to use, copy, modify, and/or distribute this software for any
   14  * purpose with or without fee is hereby granted, provided that the above
   15  * copyright notice and this permission notice appear in all copies.
   16  *
   17  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
   18  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
   19  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
   20  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   22  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   23  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   24  */
   25 
   26 
   27 #ifndef ISCCC_CCMSG_H
   28 #define ISCCC_CCMSG_H 1
   29 
   30 /*! \file isccc/ccmsg.h */
   31 
   32 #include <inttypes.h>
   33 
   34 #include <isc/buffer.h>
   35 #include <isc/lang.h>
   36 #include <isc/socket.h>
   37 
   38 /*% ISCCC Message Structure */
   39 typedef struct isccc_ccmsg {
   40     /* private (don't touch!) */
   41     unsigned int        magic;
   42     uint32_t        size;
   43     isc_buffer_t        buffer;
   44     unsigned int        maxsize;
   45     isc_mem_t          *mctx;
   46     isc_socket_t           *sock;
   47     isc_task_t         *task;
   48     isc_taskaction_t    action;
   49     void               *arg;
   50     isc_event_t     event;
   51     /* public (read-only) */
   52     isc_result_t        result;
   53     isc_sockaddr_t      address;
   54 } isccc_ccmsg_t;
   55 
   56 ISC_LANG_BEGINDECLS
   57 
   58 void
   59 isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg);
   60 /*%
   61  * Associate a cc message state with a given memory context and
   62  * TCP socket.
   63  *
   64  * Requires:
   65  *
   66  *\li   "mctx" and "sock" be non-NULL and valid types.
   67  *
   68  *\li   "sock" be a read/write TCP socket.
   69  *
   70  *\li   "ccmsg" be non-NULL and an uninitialized or invalidated structure.
   71  *
   72  * Ensures:
   73  *
   74  *\li   "ccmsg" is a valid structure.
   75  */
   76 
   77 void
   78 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
   79 /*%
   80  * Set the maximum packet size to "maxsize"
   81  *
   82  * Requires:
   83  *
   84  *\li   "ccmsg" be valid.
   85  *
   86  *\li   512 <= "maxsize" <= 4294967296
   87  */
   88 
   89 isc_result_t
   90 isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg,
   91                isc_task_t *task, isc_taskaction_t action, void *arg);
   92 /*%
   93  * Schedule an event to be delivered when a command channel message is
   94  * readable, or when an error occurs on the socket.
   95  *
   96  * Requires:
   97  *
   98  *\li   "ccmsg" be valid.
   99  *
  100  *\li   "task", "taskaction", and "arg" be valid.
  101  *
  102  * Returns:
  103  *
  104  *\li   #ISC_R_SUCCESS      -- no error
  105  *\li   Anything that the isc_socket_recv() call can return.  XXXMLG
  106  *
  107  * Notes:
  108  *
  109  *\li   The event delivered is a fully generic event.  It will contain no
  110  *  actual data.  The sender will be a pointer to the isccc_ccmsg_t.
  111  *  The result code inside that structure should be checked to see
  112  *  what the final result was.
  113  */
  114 
  115 void
  116 isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg);
  117 /*%
  118  * Cancel a readmessage() call.  The event will still be posted with a
  119  * CANCELED result code.
  120  *
  121  * Requires:
  122  *
  123  *\li   "ccmsg" be valid.
  124  */
  125 
  126 void
  127 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
  128 /*%
  129  * Clean up all allocated state, and invalidate the structure.
  130  *
  131  * Requires:
  132  *
  133  *\li   "ccmsg" be valid.
  134  *
  135  * Ensures:
  136  *
  137  *\li   "ccmsg" is invalidated and disassociated with all memory contexts,
  138  *  sockets, etc.
  139  */
  140 
  141 ISC_LANG_ENDDECLS
  142 
  143 #endif /* ISCCC_CCMSG_H */