"Fossies" - the Fresh Open Source Software Archive

Member "open-iscsi-2.0.878/iscsiuio/src/uip/ipv6_ndpc.h" (12 Sep 2019, 2862 Bytes) of package /linux/misc/open-iscsi-2.0.878.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 "ipv6_ndpc.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (c) 2011, Broadcom Corporation
    3  * Copyright (c) 2014, QLogic Corporation
    4  *
    5  * Written by:  Eddie Wai  (eddie.wai@broadcom.com)
    6  *
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. All advertising materials mentioning features or use of this software
   18  *    must display the following acknowledgement:
   19  *      This product includes software developed by Adam Dunkels.
   20  * 4. The name of the author may not be used to endorse or promote
   21  *    products derived from this software without specific prior
   22  *    written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   25  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   28  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   30  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35  *
   36  * ipv6_ndpc.h - Top level IPv6 Network Discovery Protocol Engine (RFC4861)
   37  *
   38  */
   39 #ifndef __NDPC_H__
   40 #define __NDPC_H__
   41 
   42 #include <time.h>
   43 
   44 #include "nic.h"
   45 #include "timer.h"
   46 #include "pt.h"
   47 
   48 struct ndpc_reqptr {
   49     void *eth;
   50     void *ipv6;
   51 };
   52 
   53 struct ndpc_state {
   54     struct pt pt;
   55 
   56     nic_t *nic;
   57     struct uip_stack *ustack;
   58     char state;
   59     struct timer timer;
   60     u16_t ticks;
   61     void *mac_addr;
   62     int mac_len;
   63     int retry_count;
   64 
   65     time_t last_update;
   66 
   67     void *ipv6_context;
   68     void *dhcpv6_context;
   69 };
   70 
   71 enum {
   72     NDPC_STATE_INIT,
   73     NDPC_STATE_RTR_SOL,
   74     NDPC_STATE_RTR_ADV,
   75     NDPC_STATE_DHCPV6_DIS,
   76     NDPC_STATE_DHCPV6_DONE,
   77     NDPC_STATE_BACKGROUND_LOOP
   78 };
   79 
   80 int ndpc_init(nic_t *nic, struct uip_stack *ustack,
   81           const void *mac_addr, int mac_len);
   82 void ndpc_call(struct uip_stack *ustack);
   83 void ndpc_exit(struct ndpc_state *ndp);
   84 
   85 enum {
   86     NEIGHBOR_SOLICIT,
   87     CHECK_LINK_LOCAL_ADDR,
   88     GET_LINK_LOCAL_ADDR,
   89     GET_DEFAULT_ROUTER_ADDR,
   90     CHECK_ARP_TABLE,
   91     GET_HOST_ADDR
   92 };
   93 
   94 int ndpc_request(struct uip_stack *ustack, void *in, void *out, int request);
   95 
   96 #define UIP_NDP_CALL ndpc_call
   97 
   98 #endif /* __NDPC_H__ */