"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/isccc/include/isccc/ccmsg.h" (4 Sep 2020, 3525 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


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 #ifndef ISCCC_CCMSG_H
   27 #define ISCCC_CCMSG_H 1
   28 
   29 /*! \file isccc/ccmsg.h */
   30 
   31 #include <inttypes.h>
   32 
   33 #include <isc/buffer.h>
   34 #include <isc/lang.h>
   35 #include <isc/netmgr.h>
   36 #include <isc/sockaddr.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     bool        length_received;
   44     isc_buffer_t *  buffer;
   45     unsigned int    maxsize;
   46     isc_mem_t * mctx;
   47     isc_nmhandle_t *handle;
   48     isc_nm_cb_t cb;
   49     void *      cbarg;
   50     bool        reading;
   51     /* public (read-only) */
   52     isc_result_t result;
   53 } isccc_ccmsg_t;
   54 
   55 ISC_LANG_BEGINDECLS
   56 
   57 void
   58 isccc_ccmsg_init(isc_mem_t *mctx, isc_nmhandle_t *handle, isccc_ccmsg_t *ccmsg);
   59 /*%
   60  * Associate a cc message state with a given memory context and
   61  * netmgr handle.
   62  *
   63  * Requires:
   64  *
   65  *\li   "mctx" be a valid memory context.
   66  *
   67  *\li   "handle" be a netmgr handle for a stream socket.
   68  *
   69  *\li   "ccmsg" be non-NULL and an uninitialized or invalidated structure.
   70  *
   71  * Ensures:
   72  *
   73  *\li   "ccmsg" is a valid structure.
   74  */
   75 
   76 void
   77 isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
   78 /*%
   79  * Set the maximum packet size to "maxsize"
   80  *
   81  * Requires:
   82  *
   83  *\li   "ccmsg" be valid.
   84  *
   85  *\li   512 <= "maxsize" <= 4294967296
   86  */
   87 
   88 isc_result_t
   89 isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg);
   90 /*%
   91  * Schedule an event to be delivered when a command channel message is
   92  * readable, or when an error occurs on the socket.
   93  *
   94  * Requires:
   95  *
   96  *\li   "ccmsg" be valid.
   97  *
   98  * Returns:
   99  *
  100  *\li   #ISC_R_SUCCESS      -- no error
  101  *\li   Anything that the isc_nm_read() call can return.
  102  *
  103  * Notes:
  104  *
  105  *\li   The event delivered is a fully generic event.  It will contain no
  106  *  actual data.  The sender will be a pointer to the isccc_ccmsg_t.
  107  *  The result code inside that structure should be checked to see
  108  *  what the final result was.
  109  */
  110 
  111 void
  112 isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg);
  113 /*%
  114  * Cancel a readmessage() call.  The event will still be posted with a
  115  * CANCELED result code.
  116  *
  117  * Requires:
  118  *
  119  *\li   "ccmsg" be valid.
  120  */
  121 
  122 void
  123 isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
  124 /*%
  125  * Clean up all allocated state, and invalidate the structure.
  126  *
  127  * Requires:
  128  *
  129  *\li   "ccmsg" be valid.
  130  *
  131  * Ensures:
  132  *
  133  *\li   "ccmsg" is invalidated and disassociated with all memory contexts,
  134  *  sockets, etc.
  135  */
  136 
  137 ISC_LANG_ENDDECLS
  138 
  139 #endif /* ISCCC_CCMSG_H */