2 * nmrp-flash - Netgear Unbrick Utility
3 * Copyright (C) 2016 Joseph Lehner <joseph.c.lehner@gmail.com>
5 * nmrp-flash is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * nmrp-flash is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with nmrp-flash. If not, see <http://www.gnu.org/licenses/>.
25 #if defined(_WIN32) || defined(_WIN64)
26 #define NMRPFLASH_WINDOWS
27 #elif defined(__linux__)
28 #define NMRPFLASH_LINUX
29 #elif defined(__APPLE__) && defined(__MACH__)
31 #elif defined(__unix__)
32 #define NMRPFLASH_UNIX
33 #warning "nmrp-flash is not fully supported on your operating system"
36 #ifndef NMRPFLASH_WINDOWS
37 #include <arpa/inet.h>
38 #include <sys/socket.h>
47 #define NMRPD_VERSION "0.9"
69 int tftp_put(struct nmrpd_args *args);
70 int nmrp_do(struct nmrpd_args *args);
71 int select_fd(int fd, unsigned timeout);
73 #ifdef NMRPFLASH_WINDOWS
74 void win_perror2(const char *msg, DWORD err);
75 void sock_perror(const char *msg);
77 #define sock_perror(x) perror(x)
84 struct ethsock *ethsock_create(const char *intf, uint16_t protocol);
85 int ethsock_close(struct ethsock *sock);
86 int ethsock_send(struct ethsock *sock, void *buf, size_t len);
87 ssize_t ethsock_recv(struct ethsock *sock, void *buf, size_t len);
88 int ethsock_set_timeout(struct ethsock *sock, unsigned msec);
89 uint8_t *ethsock_get_hwaddr(struct ethsock *sock);
90 int ethsock_list_all(void);