1/* 2 * Router rc control script 3 * 4 * Copyright 2004, Broadcom Corporation 5 * All Rights Reserved. 6 * 7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY 8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM 9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS 10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. 11 * 12 * $Id: rc.h,v 1.1.1.1 2008/10/15 03:28:48 james26_jang Exp $ 13 */ 14 15#ifndef _rc_h_ 16#define _rc_h_ 17 18#include <bcmconfig.h> 19#include <netinet/in.h> 20 21#ifdef USB_SUPPORT 22#define MASSSTORAGE_SUPPORT 1 23//#define USBCOPY_SUPPORT 1 24#define PRINTER_SUPPORT 1 25//#define PARPORT_SUPPORT 1 26//#define AUDIO_SUPPORT 1 27//#define WEBCAM_SUPPORT 1 28#endif // USB_SUPPORT 29 30#define csprintf(fmt, args...) do{\ 31 FILE *cp = fopen("/dev/console", "w");\ 32 if(cp) {\ 33 fprintf(cp, fmt, ## args);\ 34 fclose(cp);\ 35 }\ 36}while(0) 37 38#define IFUP (IFF_UP | IFF_RUNNING | IFF_BROADCAST | IFF_MULTICAST) 39 40#define sin_addr(s) (((struct sockaddr_in *)(s))->sin_addr) 41 42extern in_addr_t inet_addr_(const char *cp); 43 44/* udhcpc scripts */ 45extern int udhcpc_main(int argc, char **argv); 46 47/* ppp scripts */ 48extern int ipup_main(int argc, char **argv); 49extern int ipdown_main(int argc, char **argv); 50extern int ppp_ifunit(char *ifname); 51 52/* http functions */ 53extern int http_get(const char *server, char *buf, size_t count, off_t offset); 54extern int http_post(const char *server, char *buf, size_t count); 55extern int http_stats(const char *url); 56 57/* init */ 58extern int console_init(void); 59extern pid_t run_shell(int timeout, int nowait); 60extern void signal_init(void); 61extern void fatal_signal(int sig); 62 63/* interface */ 64extern int ifconfig(char *ifname, int flags, char *addr, char *netmask); 65extern int route_add(char *name, int metric, char *dst, char *gateway, char *genmask); 66extern int route_del(char *name, int metric, char *dst, char *gateway, char *genmask); 67extern void config_loopback(void); 68extern int config_vlan(void); 69 70/* network */ 71extern void start_lan(void); 72extern void stop_lan(void); 73extern void start_wan(void); 74extern void stop_wan(void); 75extern void wan_up(char *ifname); 76extern void wan_down(char *ifname); 77extern int hotplug_net(void); 78extern int wan_ifunit(char *ifname); 79extern int wan_primary_ifunit(void); 80extern int update_resolvconf(void); 81 82/* services */ 83extern int start_dhcpd(void); 84extern int stop_dhcpd(void); 85extern int start_dns(void); 86extern int stop_dns(void); 87extern int start_ntpc(void); 88extern int stop_ntpc(void); 89extern int start_nas(char *type); 90extern int stop_nas(void); 91extern int start_services(void); 92extern int stop_services(void); 93 94/* firewall */ 95#ifdef __CONFIG_NETCONF__ 96extern int start_firewall(void); 97extern int stop_firewall(void); 98extern int start_firewall2(char *ifname); 99extern int stop_firewall2(char *ifname); 100#else 101#define start_firewall() do {} while (0) 102#define stop_firewall() do {} while (0) 103#define start_firewall2(ifname) do {} while (0) 104#define stop_firewall2(ifname) do {} while (0) 105#endif 106 107/* routes */ 108extern int preset_wan_routes(char *ifname); 109 110#ifdef BTN_SETUP 111enum BTNSETUP_STATE 112{ 113 BTNSETUP_NONE=0, 114 BTNSETUP_DETECT, 115 BTNSETUP_START, 116 BTNSETUP_DATAEXCHANGE, 117 BTNSETUP_DATAEXCHANGE_FINISH, 118 BTNSETUP_DATAEXCHANGE_EXTEND, 119 BTNSETUP_FINISH 120}; 121#endif 122#endif /* _rc_h_ */ 123