Renamed wget() to wget_get() and added server port as argument
This commit is contained in:
parent
f537fac5f0
commit
f8078ae277
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: websense-remote.c,v 1.1 2010/06/08 22:39:30 nifi Exp $
|
||||
* $Id: websense-remote.c,v 1.2 2010/06/14 14:12:43 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ send_command(const char *server, const char *command)
|
|||
{
|
||||
int ret;
|
||||
printf("Sending to [%s]: %s\n", server, command);
|
||||
ret = wget(server, command, &callbacks);
|
||||
ret = wget_get(server, 80, command, &callbacks);
|
||||
if(ret != WGET_OK) {
|
||||
if(ret == WGET_ALREADY_RUNNING) {
|
||||
printf("Waiting for previous command to finish.\n");
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wget.c,v 1.1 2010/06/08 22:39:30 nifi Exp $
|
||||
* $Id: wget.c,v 1.2 2010/06/14 14:12:43 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -65,6 +65,7 @@ static unsigned long fetch_counter;
|
|||
|
||||
static const char *server;
|
||||
static const char *file;
|
||||
static uint16_t port;
|
||||
static const struct wget_callbacks *callbacks;
|
||||
|
||||
PROCESS(wget_process, "wget");
|
||||
|
@ -88,7 +89,7 @@ PROCESS_THREAD(wget_process, ev, data)
|
|||
fetch_started = clock_time();
|
||||
#endif /* STATS */
|
||||
LEDS_ON(LEDS_YELLOW);
|
||||
if(webclient_get((char *)server, 80, (char *)file) == 0) {
|
||||
if(webclient_get(server, port, file) == 0) {
|
||||
PRINTF("wget: failed to connect\n");
|
||||
LEDS_OFF(LEDS_YELLOW);
|
||||
fetch_running = 0;
|
||||
|
@ -186,13 +187,15 @@ wget_init(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
wget(const char *s, const char *f, const struct wget_callbacks *c)
|
||||
wget_get(const char *s, uint16_t p, const char *f,
|
||||
const struct wget_callbacks *c)
|
||||
{
|
||||
if(fetch_running) {
|
||||
return WGET_ALREADY_RUNNING;
|
||||
}
|
||||
fetch_running = 1;
|
||||
server = s;
|
||||
port = p;
|
||||
file = f;
|
||||
callbacks = c;
|
||||
process_start(&wget_process, NULL);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wget.h,v 1.1 2010/06/08 22:39:30 nifi Exp $
|
||||
* $Id: wget.h,v 1.2 2010/06/14 14:12:43 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,8 @@ struct wget_callbacks {
|
|||
};
|
||||
|
||||
void wget_init(void);
|
||||
int wget(const char *server, const char *file, const struct wget_callbacks *c);
|
||||
int wget_get(const char *server, uint16_t port, const char *file,
|
||||
const struct wget_callbacks *c);
|
||||
|
||||
enum {
|
||||
WGET_OK,
|
||||
|
|
Loading…
Reference in a new issue