lwip-1.4.1 (partial)
Embed:
(wiki syntax)
Show/hide line numbers
dhserver.h
00001 /* 00002 * The MIT License (MIT) 00003 * 00004 * Copyright (c) 2015 by Sergey Fetisov <fsenok@gmail.com> 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a copy 00007 * of this software and associated documentation files (the "Software"), to deal 00008 * in the Software without restriction, including without limitation the rights 00009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 * copies of the Software, and to permit persons to whom the Software is 00011 * furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included in all 00014 * copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00022 * SOFTWARE. 00023 */ 00024 00025 /* 00026 * version: 1.0 demo (7.02.2015) 00027 * brief: tiny dhcp ipv4 server using lwip (pcb) 00028 * ref: https://lists.gnu.org/archive/html/lwip-users/2012-12/msg00016.html 00029 */ 00030 00031 #ifndef DHSERVER_H 00032 #define DHSERVER_H 00033 00034 #include <stdint.h> 00035 #include <stdbool.h> 00036 #include <stdio.h> 00037 #include <string.h> 00038 #include "lwip/err.h" 00039 #include "lwip/udp.h" 00040 #include "netif/etharp.h" 00041 00042 typedef struct dhcp_entry 00043 { 00044 uint8_t mac[6]; 00045 uint8_t addr[4]; 00046 uint8_t subnet[4]; 00047 uint32_t lease; 00048 } dhcp_entry_t; 00049 00050 typedef struct dhcp_config 00051 { 00052 uint8_t addr[4]; 00053 uint16_t port; 00054 uint8_t dns[4]; 00055 const char *domain; 00056 int num_entry; 00057 dhcp_entry_t *entries; 00058 } dhcp_config_t; 00059 00060 err_t dhserv_init(dhcp_config_t *config); 00061 void dhserv_free(void); 00062 00063 #endif /* DHSERVER_H */
Generated on Wed Jul 13 2022 09:48:37 by 1.7.2