Fix return value on timeout
[oweals/nmrpflash.git] / nmrpd.h
1 /**
2  * nmrp-flash - Netgear Unbrick Utility
3  * Copyright (C) 2016 Joseph Lehner <joseph.c.lehner@gmail.com>
4  *
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.
9  *
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.
14  *
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/>.
17  *
18  */
19
20 #ifndef NMRPD_H
21 #define NMRPD_H
22 #include <stdint.h>
23 #include <stdbool.h>
24
25 #define NMRPD_VERSION "0.9"
26
27 enum nmrp_op {
28         NMRP_UPLOAD_FW = 0,
29         NMRP_UPLOAD_ST = 1,
30         NMRP_SET_REGION = 2,
31 };
32
33 struct nmrpd_args {
34         unsigned rx_timeout;
35         unsigned ul_timeout;
36         const char *tftpcmd;
37         const char *filename;
38         const char *ipaddr;
39         const char *ipmask;
40         const char *intf;
41         const char *mac;
42         enum nmrp_op op;
43         uint16_t port;
44         int force_root;
45 };
46
47 int sock_set_rx_timeout(int sock, unsigned msec);
48 int tftp_put(struct nmrpd_args *args);
49 int nmrp_do(struct nmrpd_args *args);
50
51
52 #endif