1 /* This file is part of sparrow3d.
2 * Sparrow3d is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 2 of the License, or
5 * (at your option) any later version.
7 * Sparrow3d is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with Foobar. If not, see <http://www.gnu.org/licenses/>
15 * For feedback and questions about my Files and Projects please mail me,
16 * Alexander Matthes (Ziz) , zizsdl_at_googlemail.com */
18 #ifndef _SPARROW_NET_H
19 #define _SPARROW_NET_H
21 #include "sparrowDefines.h"
23 #include <SDL_thread.h>
28 * SparrowNet is a basic network API based on SDL_net. Until now UDP is not
29 * implemented! However, you can use the ip structs from here for the UDP
30 * part of SDL_net on your own. ;)
32 * Furthermore sparrowNet has some fancy functions for getting and submitting
33 * scores for the compo4all online highscore system.*/
35 enum spAddress {IPV4, IPV6};
37 /* Section: General & TCP Stuff
39 * Types and Functions for initializing sparrowNet and sending data over tcp.*/
43 * An IP address resolved by sparrowNet.
46 * address.ipv4 (Uint32) - 32 bit ipv4 address
47 * address.ipv4_bytes (Uint8[4]) - 4 x 8bit ipv4 address
48 * address.ipv6 (Uint32[4]) - 128 bit ipv6 address
49 * address.ipv6_bytes (Uint8[16]) - 16 x 8bit ipv6 address
50 * port (Uint16) - port of the address
51 * sdl_address (IPaddress) - ip address struct of SDL*/
52 typedef struct spNetIPStruct *spNetIPPointer;
53 typedef struct spNetIPStruct {
62 IPaddress sdl_address;
65 typedef struct spNetC4ATaskStruct *spNetC4ATaskPointer;
66 typedef struct spNetC4ATaskStruct {
67 SDL_mutex* statusMutex;
77 /* Define: SP_INVALID_IP
79 * Same as INADDR_NONE of SDL_Net. Means, that the ip returned by <spNetResolve>
80 * was not found and is invalid. */
81 #define SP_INVALID_IP INADDR_NONE
83 /* Type: spNetTCPConnection
85 * a type for open tcp connections. In fact just SDL_net's TCPsocket.*/
86 typedef TCPsocket spNetTCPConnection;
87 /* Type: spNetTCPServer
89 * a type for server sessions. In fact just SDL_net's TCPsocket.*/
90 typedef TCPsocket spNetTCPServer;
92 /* Function: spInitNet
94 * Initializes sparrowNet. Call always before using this library!*/
95 PREFIX void spInitNet();
97 /* Function: spQuitNet
100 PREFIX void spQuitNet();
102 /* Function: spNetResolve
104 * Resolves a hostname to an ip. Only ipv4 is supported at the moment!
107 * host - the host name
108 * port - the port you want to access (later)
111 * spNetIP - the ip in the type <spNetIP>. If address.ipv4 is SP_INVALID_IP, the
112 * function calls failed!*/
113 PREFIX spNetIP spNetResolve(char* host,Uint16 port);
115 /* Function: spNetResolveHost
117 * Gives you the hostname to an ip.
120 * ip - ip the the host you want to know
121 * host - a pointer, where to put the string
122 * host_len - the maximal length of the host string. Keep the ending 0 in mind!
125 * char* - the pointer "host" from above*/
126 PREFIX char* spNetResolveHost(spNetIP ip,char* host,int host_len);
128 /* Function: spNetOpenClientTCP
130 * Opens a connection to an ip
136 * spNetTCPConnection - handle for the connection */
137 PREFIX spNetTCPConnection spNetOpenClientTCP(spNetIP ip);
139 /* Function: spNetOpenServerTCP
141 * Creates a server, which listens at a port
147 * spNetTCPServer - handle for the server*/
148 PREFIX spNetTCPServer spNetOpenServerTCP(Uint16 port);
150 /* Function: spNetAcceptTCP
152 * If a client tries to connect to your server, this function returns an
153 * established tcp connection from your server to the client.
156 * server - the server returned by <spNetOpenServerTCP>*/
157 PREFIX spNetTCPConnection spNetAcceptTCP(spNetTCPServer server);
159 /* Function: spNetGetConnectionIP
161 * Gives you the ip of your connected client.
164 * connection - a connection, where you want to know other side
167 * spNetIP - the ip as <spNetIP>*/
168 PREFIX spNetIP spNetGetConnectionIP(spNetTCPConnection connection);
170 /* Function: spNetSendTCP
172 * Sends a tcp package to the ether.
175 * connection - the connection to send a tcp package with
176 * data - data to send. Can be a pointer to literally anything.
177 * length - length of the data to be sent (in bytes)
180 * int - the number of sent bytes. If unequal length the connection seem to be
182 PREFIX int spNetSendTCP(spNetTCPConnection connection,void* data,int length);
184 /* Function: spNetSendHTTP
186 * Sends text over TCP with spNetSendTCP.
189 * connection - the connection to send a tcp package with
190 * data - the string to send
193 * int - the number of sent bytes. If unequal length the connection seem to be
195 PREFIX int spNetSendHTTP(spNetTCPConnection connection,char* data);
197 /* Function: spNetReceiveTCP
199 * Receives data from the other side. This function blocks your application
200 * until the client actually sends something!
203 * connection - the connection you want to receive tcp packages from
204 * data - data to receive. Can be a pointer to literally anything.
205 * length - maximal data to receive
208 * int - the number of received bytes. If 0 something strange happend. E.g. your
209 * counterside explodes or just closed the connection. However your connection
210 * is invalid now! Better close, too. */
211 PREFIX int spNetReceiveTCP(spNetTCPConnection connection,void* data,int length);
213 /* Function: spNetReceiveHTTP
215 * Receives data from the other side until the other side disconnects. This
216 * function blocks your application until the client actually sends something!
217 * You can of course use other protocols than http. ;)
220 * connection - the connection you want to receive tcp packages from
221 * data - pointer to the text to receive
222 * length - maximal length of the text
225 * int - the number of received characters. If 0 something strange happend. E.g.
226 * your counterside explodes or just closed the connection. However your
227 * connection is invalid now! Better close, too. */
228 PREFIX int spNetReceiveHTTP(spNetTCPConnection connection,char* data,int length);
230 /* Function: spNetReceiveTCPUnblocked
232 * Receives data from the other side. This function does not block your
233 * application! However, it may need a while until your counterpart sends
234 * something and your data string stays invalid.
237 * connection - the connection you want to receive tcp packages from
238 * data - data to receive. Can be a pointer to literally anything.
239 * length - maximal data to receive
242 * SDL_Thread* - a handle to the created background thread. E.g. you can kill
243 * it with SDL_KillThread if you don't want to wait anymore. If (void*)(-1) is
244 * returned the connection is closed (or your counterside exploded).*/
245 PREFIX SDL_Thread* spNetReceiveTCPUnblocked(spNetTCPConnection connection,void* data,int length);
247 /* Function: spNetReceiveHTTPUnblocked
249 * Receives data from the other side until the other side disconnects. This
250 * function does not block your application! However, it may need a while until
251 * your counterpart sends something and your data string stays invalid. You
252 * can of course use other protocols than http. ;)
256 * connection - the connection you want to receive tcp packages from
257 * data - pointer to the text to receive
258 * length - maximal length of the text
261 * SDL_Thread* - a handle to the created background thread. E.g. you can kill
262 * it with SDL_KillThread if you don't want to wait anymore. If (void*)(-1) is
263 * returned the connection is closed (or your counterside exploded).*/
264 PREFIX SDL_Thread* spNetReceiveHTTPUnblocked(spNetTCPConnection connection,char* data,int length);
266 /* Function: spNetReceiveStillWaiting
268 * Says, whether a receive call (identified by the thread handle) still waits
269 * for an incoming signal. Usefull for timeouts.
272 * thread - thread of the receiving call, which is maybe still running
275 * int - 1 if the thread still waits or 0 if not.*/
276 PREFIX int spNetReceiveStillWaiting(SDL_Thread* thread);
278 /* Function: spNetCloseTCP
280 * Closes a tcp connection or a server session.
283 * connection - connection to close*/
284 PREFIX void spNetCloseTCP(spNetTCPConnection connection);
286 /* Section: Compo4all stuff
288 * Types and Functions for sending and receiving data to and from the compo4all
291 /* Defines: Compo4all statuses
293 * Statuses for the committing and score-loading functions.
295 * SP_C4A_PROGRESS - transfer of data is in progress
296 * SP_C4A_OK - process is done and everything was fine
297 * SP_C4A_ERROR - process is done, but something went wrong */
298 #define SP_C4A_PROGRESS 1
300 #define SP_C4A_ERROR -1
301 #define SP_C4A_TIMEOUT -2
302 #define SP_C4A_CANCELED -3
304 /* Type: spNetC4AGame
306 * Type for a linked list of games from the compo4all highscore servers
309 * longname - full name of the game
310 * shortname - short name of the game
311 * status - the status of the highscore: 1 means available, 2 even more
312 * available (called "active" by skeezix, don't really know, what this means),
313 * 0 inactive, which means, you shouldn't show that game except for testing
315 * genre - the genre of the game.
316 * field - which kind of game is it? 0 means just an indie game, 1 is a mame
317 * game, -1 means "don't know" or "to be decided".
318 * next - pointer to the next element in the list*/
319 typedef struct spNetC4AGameStruct *spNetC4AGamePointer;
320 typedef struct spNetC4AGameStruct {
326 spNetC4AGamePointer next;
329 /* Type: spNetC4AScore
331 * Type for a linked list of scores gotten from the compo4all highscore servers
334 * longname - full name of the player
335 * shortname - three digit short name of the player
336 * score - the reached points
337 * commitTime - time of type time_t (seconds since 1.1.1970 00:00:00),
338 * when the score was committed. Use localtime of time.h to "decrypt"
340 * next - pointer to the next element in the list
341 * rank - rank in the score */
342 typedef struct spNetC4AScoreStruct *spNetC4AScorePointer;
343 typedef struct spNetC4AScoreStruct {
348 spNetC4AScorePointer next;
352 /* Type: spNetC4AProfile
354 * A struct for your *unique* C4A Profile.
357 * prid - unique id of your account. Keep it for you. ;)
358 * longname - your full name
359 * shortname - your 3 digit short name */
360 typedef struct spNetC4AProfileStruct *spNetC4AProfilePointer;
361 typedef struct spNetC4AProfileStruct {
370 /* Function: spNetC4AGetProfile
372 * Reads your profile out of your c4a-prof file. On the pandora the file is
373 * created by compo4all and stored on a pandora specific place. On other systems
374 * for now your c4a-prof should be in the folder of your application.
377 * spNetC4AProfilePointer - a pointer to an <spNetC4AProfile> struct*/
378 PREFIX spNetC4AProfilePointer spNetC4AGetProfile();
380 /* Function: spNetC4AFreeProfile
382 * Frees the profile you got from <spNetC4AGetProfile>.
385 * profile - profile to free. However of course your profile is not deleted. ;)*/
386 PREFIX void spNetC4AFreeProfile(spNetC4AProfilePointer profile);
388 /* Function: spNetC4AGetGame
390 * Loads all games listed on the C4A server. Use <spNetC4AGetStatus> to get the
391 * status of the task. Only one compo4all background task can run at one time!
394 * gameList - a pointer to spNetC4AGamePointer, which is in fact a pointer to
395 * <spNetC4AGame>. The available games are saved here.
396 * timeOut - after this time in ms the thread is killed. Get it with
397 * <spNetC4AGetTimeOut>
400 * int - 1 if the function failed for some reason, 0 at success starting
402 PREFIX int spNetC4AGetGame(spNetC4AGamePointer* gameList,int timeOut);
404 /* Function: spNetC4AGetGameParallel
406 * Loads all games listed on the C4A server. Use
407 * <spNetC4AGetStatusParallel> to get the status of the task. Don't
408 * forget to delete the returned task struct with <spNetC4ADeleteTask>
412 * gameList - a pointer to spNetC4AGamePointer, which is in fact a pointer to
413 * <spNetC4AGame>. The available games are saved here.
414 * timeOut - after this time in ms the thread is killed. Get it with
415 * <spNetC4AGetTimeOut>
418 * spNetC4ATaskPointer - Pointer to <spNetC4ATask> at success and NULL if an
420 PREFIX spNetC4ATaskPointer spNetC4AGetGameParallel(spNetC4AGamePointer* gameList,int timeOut);
422 /* Function: spNetC4ADeleteGames
424 * Frees the linked list returned by <spNetC4AGetGame>.
427 * firstGame - pointer to <spNetC4AGame> to free*/
428 PREFIX void spNetC4ADeleteGames(spNetC4AGamePointer* gameList);
430 /* Function: spNetC4AGetScore
432 * Loads a top 500 for a given game from the compo4all server. The task runs
433 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
434 * one compo4all background task can run at one time!
437 * scoreList - a pointer to spNetC4AScorePointer, which is in fact a pointer to
438 * <spNetC4AScore>. The scores are saved here.
439 * profile - an optional pointer to your profile. If given only your scores are
440 * added to the scores-list above
441 * game - name of the game on the server
442 * timeOut - after this time in ms the thread is killed. Get it with
443 * <spNetC4AGetTimeOut>
446 * int - 1 if the function failed for some reason, 0 at success starting
449 * See also: <spNetC4AGetScoreOfMonth>*/
450 PREFIX int spNetC4AGetScore(spNetC4AScorePointer* scoreList,spNetC4AProfilePointer profile,char* game,int timeOut);
452 /* Function: spNetC4AGetScoreOfMonth
454 * Loads a top 500 of a month for a given game from the compo4all
455 * server. The task runs
456 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
457 * one compo4all background task can run at one time!
460 * scoreList - a pointer to spNetC4AProfilePointer, which is in fact a pointer to
461 * <spNetC4AScore>. The scores are saved here.
462 * profile - an optional pointer to your profile. If given only your scores are
463 * added to the scores-list above
464 * game - name of the game on the server
465 * year - year to load (e.g. 2013)
466 * month - month to load (e.g. 3 for march)
467 * timeOut - after this time in ms the thread is killed. Get it with
468 * <spNetC4AGetTimeOut>
471 * int - 1 if the function failed for some reason, 0 at success starting
474 * See also: <spNetC4AGetScore>*/
475 PREFIX int spNetC4AGetScoreOfMonth(spNetC4AScorePointer* scoreList,spNetC4AProfilePointer profile,char* game,int year,int month,int timeOut);
477 /* Function: spNetC4AGetScore
479 * Loads a top 500 for a given game from the compo4all server. The task runs
480 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
481 * one compo4all background task can run at one time!
484 * scoreList - a pointer to spNetC4AScorePointer, which is in fact a pointer to
485 * <spNetC4AScore>. The scores are saved here.
486 * profile - an optional pointer to your profile. If given only your scores are
487 * added to the scores-list above
488 * game - name of the game on the server
489 * timeOut - after this time in ms the thread is killed. Get it with
490 * <spNetC4AGetTimeOut>
493 * spNetC4ATaskPointer - Pointer to <spNetC4ATask> at success and NULL if an
496 * See also: <spNetC4AGetScoreOfMonthParallel>*/
497 PREFIX spNetC4ATaskPointer spNetC4AGetScoreParallel(spNetC4AScorePointer* scoreList,spNetC4AProfilePointer profile,char* game,int timeOut);
499 /* Function: spNetC4AFilterScore
501 * Makes, that every name appears only once in the scoreList
504 * scoreList - a pointer to spNetC4AScorePointer, which is in fact a pointer to
505 * <spNetC4AScore>. These scores are changed.*/
506 PREFIX void spNetC4AFilterScore(spNetC4AScorePointer* scoreList);
508 /* Function: spNetC4AGetScoreOfMonth
510 * Loads a top 500 of a month for a given game from the compo4all
511 * server. The task runs in background! Use
512 * <spNetC4AGetStatusParallel> to get the status of the task. Don't
513 * forget to delete the returned task struct with <spNetC4ADeleteTask>
517 * scoreList - a pointer to spNetC4AProfilePointer, which is in fact a pointer to
518 * <spNetC4AScore>. The scores are saved here.
519 * profile - an optional pointer to your profile. If given only your scores are
520 * added to the scores-list above
521 * game - name of the game on the server
522 * year - year to load (e.g. 2013)
523 * month - month to load (e.g. 3 for march)
524 * timeOut - after this time in ms the thread is killed. Get it with
525 * <spNetC4AGetTimeOut>
528 * spNetC4ATaskPointer - Pointer to <spNetC4ATask> at success and NULL if an
531 * See also: <spNetC4AGetScoreParallel>*/
532 PREFIX spNetC4ATaskPointer spNetC4AGetScoreOfMonthParallel(spNetC4AScorePointer* scoreList,spNetC4AProfilePointer profile,char* game,int year,int month,int timeOut);
534 /* Function: spNetC4CopyScoreList
536 * Makes an unique copy of the passed scorelist, e.g. if you want to remove
537 * double names with <spNetC4AMakeScoresUnique> afterwards. Don't forget to
538 * free every copy with <spNetC4ADeleteScores> afterwards!
541 * scoreList - a pointer to spNetC4AProfilePointer, which is in fact a pointer to
542 * <spNetC4AScore>, which shall be copied
543 * newList - a pointer to spNetC4AProfilePointer, which is in fact a pointer to
544 * <spNetC4AScore>, to which the copy shall be written*/
545 PREFIX void spNetC4ACopyScoreList(spNetC4AScorePointer* scoreList,spNetC4AScorePointer* newList);
547 /* Function: spNetC4AMakeScoresUnique
549 * Removes any double occurence of names in the score. Afterwars every
550 * name only occurs ones with the best score of this player. Be careful:
551 * Afterwards you can't use this list for uploading scores if they don't
552 * exist anymore. If you want both make a copy of the list with
553 * <spNetC4ACopyScoreList> before (instead of getting the scores twice).
556 * scoreList - a pointer to spNetC4AProfilePointer, which is in fact a pointer to
558 PREFIX void spNetC4AMakeScoresUnique(spNetC4AScorePointer* scoreList);
560 /* Function: spNetC4ADeleteScores
562 * Frees the linked list returned by <spNetC4AGetScore>.
565 * firstScore - pointer to <spNetC4AScore> to free*/
566 PREFIX void spNetC4ADeleteScores(spNetC4AScorePointer* scoreList);
568 /* Function: spNetC4ACommitScore
570 * Commits a score to a specific game to compo4all server. The task runs
571 * in background! Use <spNetC4AGetStatusParallel> to get the status of the task.
572 * Don't forget to delete the returned task struct with <spNetC4ADeleteTask>
576 * profile - the profile you want to commit tthe score with
577 * game - name of the game on the server. If this is empty (""), at least the
578 * c4a cache will be tried to commit.
579 * score - reached score
580 * scoreList - pass the struct returned by <spNetC4AGetScore> to compare
581 * your score to that list and avoid committing the same score twice. If
582 * it is not in the list, it will added afterwards for later
584 * timeOut - after this time in ms the thread is killed. Get it with
585 * <spNetC4AGetTimeOut>. If timeOut is 0, no thread is started, but the
586 * score is written to the cache if enabled!
589 * int - 1 if the function failed for some reason (e.g. the score is
590 * already in the scoreList), 0 at success starting the task.*/
591 PREFIX int spNetC4ACommitScore(spNetC4AProfilePointer profile,char* game,int score,spNetC4AScorePointer* scoreList,int timeOut);
593 /* Function: spNetC4ACommitScoreParallel
595 * Commits a score to a specific game to compo4all server. The task runs
596 * in background! Use <spNetC4AGetStatusParallel> to get the status of the task.
597 * Don't forget to delete the returned task struct with <spNetC4ADeleteTask>
601 * profile - the profile you want to commit tthe score with
602 * game - name of the game on the server
603 * score - reached score
604 * scoreList - pass the struct returned by <spNetC4AGetScore> to compare
605 * your score to that list and avoid committing the same score twice. If
606 * it is not in the list, it will added afterwards for later
608 * timeOut - after this time in ms the thread is killed. Get it with
609 * <spNetC4AGetTimeOut> If timeOut is 0, no thread is started, but the
610 * score is written to the cache if enabled!
613 * spNetC4ATaskPointer - Pointer to <spNetC4ATask> at success and NULL if an
615 PREFIX spNetC4ATaskPointer spNetC4ACommitScoreParallel(spNetC4AProfilePointer profile,char* game,int score,spNetC4AScorePointer* scoreList,int timeOut);
617 /* Function: spNetC4ACreateProfile
619 * Creates a new profile on skeezix' server. Blocks your application! However,
620 * if network is avaible, should be quite fast. Furthermore it creates the
621 * c4a-prof file needed by all supported applications. The path of the file is
622 * platform depended. Overwrites an already existing file! The task runs
623 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
624 * one compo4all background task can run at one time!
625 * Only for Pandora: If no c4a-prof is created until now and no c4a-mame appdata
626 * folder is available it will be created in the first folder in /media with
627 * pandora/appdata in it. It MAY be, that skeezix's C4A Manager will not find
628 * this c4a-prof if it will be installed later on another SD card! However the
629 * spaghetti client, the fusilli client and the Sparrow C4A Manager will find
630 * this profile file in any case (if you don't create a second c4a-prof with
631 * skeezix c4a manager. It that case it is random which c4a-prof is used in the
636 * profile - a pointer to a pointer to <spNetC4AProfile>, where the profile
638 * longname - the long name of the player. Should only be alphanumeric.
639 * shortname - the short name of the player. Should exactly 3 alphanumeric,
641 * password - alphanumeric password
642 * email - the mail address of the new account. Can be "".
643 * timeOut - after this time in ms the thread is killed. Get it with
644 * <spNetC4AGetTimeOut>
647 * int - 1 if the function failed for some reason, 0 at success starting
651 * <spNetC4AEditProfile>*/
652 PREFIX int spNetC4ACreateProfile(spNetC4AProfilePointer* profile, char* longname,char* shortname,char* password,char* email,int timeOut);
654 /* Function: spNetC4ADeleteAccount
656 * Deletes the given profile on skeezix server and maybe the file on your
657 * system. The task runs
658 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
659 * one compo4all background task can run at one time!
662 * profile - profile to delete from the server.
663 * deleteFile - 1 if you want to delete the c4a-prof file at the end
664 * (at success), too. 0 leaves to file.
665 * timeOut - after this time in ms the thread is killed. Get it with
666 * <spNetC4AGetTimeOut>
669 * int - 1 if the function failed for some reason, 0 at success starting
671 PREFIX int spNetC4ADeleteAccount(spNetC4AProfilePointer* profile,int deleteFile,int timeOut);
673 /* Function: spNetC4AEditProfile
675 * Edits an already existing profile on skeezix' server. Blocks your
676 * application! However, if network is avaible, should be quite fast.
677 * Furthermore it rewrites the c4a-prof file needed by all supported
678 * applications. The path of the file is platform depended. If the account
679 * doesn't exist now, it will created. The big difference to
680 * <spNetC4ACreateProfile> is, that the prid is read from the profile struct
681 * instead of being new created. The task runs
682 * in background! Use <spNetC4AGetStatus> to get the status of the task. Only
683 * one compo4all background task can run at one time!
687 * profile - the profile to change.
688 * longname - the long name of the player. Should only be alphanumeric.
689 * shortname - the short name of the player. Should exactly 3 alphanumeric,
691 * password - alphanumeric password
692 * email - the mail address of the new account. Can be "".
693 * timeOut - after this time in ms the thread is killed. Get it with
694 * <spNetC4AGetTimeOut>
697 * int - 1 if the function failed for some reason, 0 at success starting
701 * <spNetC4ACreateProfile>*/
702 PREFIX int spNetC4AEditProfile(spNetC4AProfilePointer* profile,char* longname,char* shortname,char* password,char* email,int timeOut);
704 /* Function: spNetC4ACancelTask
706 * Cancels the C4A task running right now (if one is started).*/
707 PREFIX void spNetC4ACancelTask();
709 /* Function: spNetC4ACancelTaskParallel
711 * Cancels the given C4A task. Don't forget to delete it afterwards with
712 * <spNetC4ADeleteTask>!
715 * task - pointer to <spNetC4ATask> returned from the parallel functions.*/
716 PREFIX void spNetC4ACancelTaskParallel(spNetC4ATaskPointer task);
718 /* Function: spNetC4AGetTaskResult
720 * Gets the result of the task when finished (check with
721 * <spNetC4AGetStatus>).
724 * int - 0 if everything went fine, 1 at error*/
725 PREFIX int spNetC4AGetTaskResult();
727 /* Function: spNetC4AGetTaskResultParallel
729 * Gets the result of the given task when finished (check with
730 * <spNetC4AGetStatusParallel>).
733 * task - pointer to <spNetC4ATask> returned from the parallel functions.
736 * int - 0 if everything went fine, 1 at error*/
737 PREFIX int spNetC4AGetTaskResultParallel(spNetC4ATaskPointer task);
739 /* Function: spNetC4AGetTimeOut
741 * Gives you the time out of the C4A tasks.
744 * int - the timeOut in ms.*/
745 PREFIX int spNetC4AGetTimeOut();
747 /* Function: spNetC4AGetTimeOutParallel
749 * Gives you the time out of the given C4A task.
752 * task - pointer to <spNetC4ATask> returned from the parallel functions.
755 * int - the timeOut in ms.*/
756 PREFIX int spNetC4AGetTimeOutParallel(spNetC4ATaskPointer task);
758 /* Function: spNetC4AGetStatus
760 * Gets the status of <spNetC4AGetScore>, <spNetC4ACommitScore>,
761 * <spNetC4ACreateProfile>, <spNetC4AEditProfile> & <spNetC4ADeleteAccount>.
764 * int - <Compo4all statuses>*/
765 PREFIX int spNetC4AGetStatus();
767 /* Function: spNetC4AGetStatusParallel
769 * Gets the status of <spNetC4AGetScoreParallel> & <spNetC4ACommitScoreParallel>.
772 * task - pointer to <spNetC4ATask> returned from the parallel functions
775 * int - <Compo4all statuses>*/
776 PREFIX int spNetC4AGetStatusParallel(spNetC4ATaskPointer task);
779 /* Function: spNetC4ADeleteProfileFile
781 * Deletes the profile file on your system, NOT the online account at skeezix
782 * server. See also <spNetC4ADeleteAccount>.*/
783 PREFIX void spNetC4ADeleteProfileFile();
785 /* Function: spNetC4ADeleteTask
787 * Deletes the task struct returned by the parallel working task functions.
790 * task - Pointer to <spNetC4ATask>, which is returned by the parallel functions.*/
791 PREFIX void spNetC4ADeleteTask(spNetC4ATaskPointer task);
793 /* Function: spNetC4ASetCaching
795 * (De)Activates caching for C4A scores. If caching is enabled every time
796 * spNetC4ACommitScore* fails, it is written to a cache file and the next time
797 * spNetC4ACommitScore* is called it will be tried to be committed again
800 * value - 0: No caching
801 * 1: Everything is cached
802 * 2: Only the best score of a game is cached
803 * 3: Same like 2, but lower score is better*/
804 PREFIX void spNetC4ASetCaching(int value);
806 /* Function: spNetC4AHowManyCached
808 * Returns how many scores are cached
811 * int - the number of cached scores*/
812 PREFIX int spNetC4AHowManyCached();