4 #include <tomato_profile.h>
6 #include <netinet/in.h>
10 #include <mntent.h> // !!TB
12 #define Y2K 946684800UL // seconds since 1970
14 #define ASIZE(array) (sizeof(array) / sizeof(array[0]))
17 extern const char *tomato_version
;
18 extern const char *tomato_buildtime
;
22 #define WP_DISABLED 0 // order must be synced with def in misc.c
31 ACT_TFTP_UPGRADE_UNUSED
,
33 ACT_WEBS_UPGRADE_UNUSED
,
44 struct in_addr dns
[3];
47 extern int get_wan_proto(void);
48 extern int using_dhcpc(void);
49 extern void notice_set(const char *path
, const char *format
, ...);
50 extern int check_wanup(void);
51 extern const dns_list_t
*get_dns(void);
52 extern void set_action(int a
);
53 extern int check_action(void);
54 extern int wait_action_idle(int n
);
55 extern int wl_client(void);
56 extern const char *get_wanip(void);
57 extern long get_uptime(void);
58 extern int get_radio(void);
59 extern void set_radio(int on
);
60 extern int nvram_get_int(const char *key
);
61 // extern long nvram_xget_long(const char *name, long min, long max, long def);
62 extern int nvram_get_file(const char *key
, const char *fname
, int max
);
63 extern int nvram_set_file(const char *key
, const char *fname
, int max
);
64 extern int nvram_contains_word(const char *key
, const char *word
);
65 extern int connect_timeout(int fd
, const struct sockaddr
*addr
, socklen_t len
, int timeout
);
67 extern struct mntent
*findmntent(char *file
);
112 HW_BCM4704_BCM5325F_EWC
,
113 HW_BCM4705L_BCM5325E_EWC
,
117 #define SUP_SES (1 << 0)
118 #define SUP_BRAU (1 << 1)
119 #define SUP_AOSS_LED (1 << 2)
120 #define SUP_WHAM_LED (1 << 3)
121 #define SUP_HPAMP (1 << 4)
122 #define SUP_NONVE (1 << 5)
123 #define SUP_80211N (1 << 6)
125 extern int check_hw_type(void);
126 // extern int get_hardware(void) __attribute__ ((weak, alias ("check_hw_type")));
127 extern int get_model(void);
128 extern int supports(unsigned long attr
);
133 extern char *psname(int pid
, char *buffer
, int maxlen
);
134 extern int pidof(const char *name
);
135 extern int killall(const char *name
, int sig
);
143 extern unsigned long f_size(const char *path
);
144 extern int f_exists(const char *file
);
145 extern int f_read(const char *file
, void *buffer
, int max
); // returns bytes read
146 extern int f_write(const char *file
, const void *buffer
, int len
, unsigned flags
, unsigned cmode
); //
147 extern int f_read_string(const char *file
, char *buffer
, int max
); // returns bytes read, not including term; max includes term
148 extern int f_write_string(const char *file
, const char *buffer
, unsigned flags
, unsigned cmode
); //
149 extern int f_read_alloc(const char *path
, char **buffer
, int max
);
150 extern int f_read_alloc_string(const char *path
, char **buffer
, int max
);
161 #define LED_MYSTERY 7 // (unmarked LED between wireless and bridge on WHR-G54S)
169 extern const char *led_names
[];
171 extern void gpio_write(uint32_t bit
, int en
);
172 extern uint32_t gpio_read(void);
173 extern int nvget_gpio(const char *name
, int *gpio
, int *inv
);
174 extern int led(int which
, int mode
);
178 extern int base64_encode(unsigned char *in
, char *out
, int inlen
); // returns amount of out buffer used
179 extern int base64_decode(const char *in
, unsigned char *out
, int inlen
); // returns amount of out buffer used
180 extern int base64_encoded_len(int len
);
181 extern int base64_decoded_len(int len
); // maximum possible, not actual
185 extern const char *find_word(const char *buffer
, const char *word
);
186 extern int remove_word(char *buffer
, const char *word
);