medfall

A super great game engine
Log | Files | Refs

http.h (767B)


      1 #pragma once
      2 
      3 #include <string>
      4 
      5 #include "intrinsics.h"
      6 #include "array.h"
      7 #include "platform_network.h"
      8 
      9 enum GetResult {
     10 	GET_OK,
     11 	GET_ERROR_CANT_CONNECT,
     12 	GET_ERROR_TIMEOUT,
     13 	GET_ERROR_DISCONNECTED,
     14 	GET_ERROR_HTTP_BAD_REQUEST,
     15 	GET_ERROR_HTTP_NOT_FOUND,
     16 	GET_ERROR_HTTP_INTERNAL_SERVER_ERROR,
     17 	GET_ERROR_HTTP_OTHER,
     18 };
     19 
     20 #define HTTP_PROGRESS_CALLBACK( f ) void f( size_t bytes_downloaded, void * data )
     21 typedef HTTP_PROGRESS_CALLBACK( HttpProgressCallback );
     22 
     23 array< NetAddress > dns( const char * host, array< NetAddress > out );
     24 bool dns_first( const char * host, NetAddress * address );
     25 GetResult http_get( const NetAddress & address, const char * host, const char * path, std::string * body, HttpProgressCallback progress_cb = NULL, void * cb_data = NULL );