#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pspnet.h>
#include <pspnet_inet.h>
#include <pspnet_apctl.h>
#include <pspnet_resolver.h>
#include <psputility_netparam.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>

#define SITE "http://teamsushi.org/lastcall/lastcall.php"

#define MODULE_NAME "NetSample"


struct wifiConf{
char *name;
int num;
};

struct MemoryStruct{
  char *memory;
  size_t size;
};

int loadInet();

char getWifiName(int conf);

int getWifiList(struct wifiConf *confList);

int connect_to_apctl(int config);

char *fetchData(char *URL);

int fetchFromUrl(char *url, int confNum);

char getScores();

char putScore(char *name, char *level, char *score);

char getMapList();

char getMap(char *name, char *savePath);

char putMap(char *name, char *creator, char *data, char *rating);

char getconfname(int confnum);

