SparrowNet is a basic network API based on SDL_net. Until now UDP is not implemented! However, you can use the ip structs from here for the UDP part of SDL_net on your own. ;)
Furthermore sparrowNet has some fancy functions for getting and submitting scores for the compo4all online highscore system and for the IRC chat protocol.
sparrowNet | SparrowNet is a basic network API based on SDL_net. |
General & TCP Stuff | Types and Functions for initializing sparrowNet and sending data over tcp. |
Types and Macros | |
spNetIP | An IP address resolved by sparrowNet. |
SP_INVALID_IP | Same as INADDR_NONE of SDL_Net. |
spNetTCPConnection | a type for open tcp connections. |
spNetTCPServer | a type for server sessions. |
Functions | |
spInitNet | Initializes sparrowNet. |
spQuitNet | Quits sparrowNet. |
spNetResolve | Resolves a ip to a hostname. |
spNetResolveHost | Gives you the hostname to an ip. |
spNetOpenClientTCP | Opens a connection to an ip |
spNetOpenServerTCP | Creates a server, which listens at a port |
spNetAcceptTCP | If a client tries to connect to your server, this function returns an established tcp connection from your server to the client. |
spNetGetConnectionIP | Gives you the ip of your connected client. |
spNetSendTCP | Sends a tcp package to the ether. |
spNetSendHTTP | Sends text over TCP with spNetSendTCP. |
spNetReceiveTCP | Receives data from the other side. |
spNetReceiveHTTP | Receives data from the other side until the other side disconnects. |
spNetReceiveTCPUnblocked | Receives data from the other side. |
spNetReceiveHTTPUnblocked | Receives data from the other side until the other side disconnects. |
spNetReceiveStillWaiting | Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. |
spNetReceiveFinished | Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. |
spNetCloseTCP | Closes a tcp connection or a server session. |
Compo4all stuff | Types and Functions for sending and receiving data to and from the compo4all server. |
Macros | |
Compo4all statuses | Statuses for the committing and score-loading functions. |
Types | |
spNetC4AGame | Type for a linked list of games from the compo4all highscore servers |
spNetC4AScore | Type for a linked list of scores gotten from the compo4all highscore servers |
spNetC4AProfile | A struct for your unique C4A Profile. |
Functions | |
spNetC4AGetProfile | Reads your profile out of your c4a-prof file. |
spNetC4AFreeProfile | Frees the profile you got from spNetC4AGetProfile. |
spNetC4AGetGame | Loads all games listed on the C4A server. |
spNetC4AGetGameParallel | Loads all games listed on the C4A server. |
spNetC4ADeleteGames | Frees the linked list returned by spNetC4AGetGame. |
spNetC4AGetScore | Loads a top 500 for a given game from the compo4all server. |
spNetC4AGetScoreOfMonth | Loads a top 500 of a month for a given game from the compo4all server. |
spNetC4AGetScore | Loads a top 500 for a given game from the compo4all server. |
spNetC4AFilterScore | Makes, that every name appears only once in the scoreList |
spNetC4AGetScoreOfMonth | Loads a top 500 of a month for a given game from the compo4all server. |
spNetC4CopyScoreList | Makes an unique copy of the passed scorelist, e.g. |
spNetC4AMakeScoresUnique | Removes any double occurence of names in the score. |
spNetC4ADeleteScores | Frees the linked list returned by spNetC4AGetScore. |
spNetC4ACommitScore | Commits a score to a specific game to compo4all server. |
spNetC4ACommitScoreParallel | Commits a score to a specific game to compo4all server. |
spNetC4ACreateProfile | Creates a new profile on skeezix’ server. |
spNetC4ADeleteAccount | Deletes the given profile on skeezix server and maybe the file on your system. |
spNetC4AEditProfile | Edits an already existing profile on skeezix’ server. |
spNetC4ACancelTask | Cancels the C4A task running right now (if one is started). |
spNetC4ACancelTaskParallel | Cancels the given C4A task. |
spNetC4AGetTaskResult | Gets the result of the task when finished (check with spNetC4AGetStatus). |
spNetC4AGetTaskResultParallel | Gets the result of the given task when finished (check with spNetC4AGetStatusParallel). |
spNetC4AGetTimeOut | Gives you the time out of the C4A tasks. |
spNetC4AGetTimeOutParallel | Gives you the time out of the given C4A task. |
spNetC4AGetStatus | Gets the status of spNetC4AGetScore, spNetC4ACommitScore, spNetC4ACreateProfile, spNetC4AEditProfile & spNetC4ADeleteAccount. |
spNetC4AGetStatusParallel | Gets the status of <spNetC4AGetScoreParallel> & spNetC4ACommitScoreParallel. |
spNetC4ADeleteProfileFile | Deletes the profile file on your system, NOT the online account at skeezix server. |
spNetC4ADeleteTask | Deletes the task struct returned by the parallel working task functions. |
spNetC4ASetCaching | (De)Activates caching for C4A scores. |
spNetC4AHowManyCached | Returns how many scores are cached |
IRC chat protocol stuff | Types and Functions for connecting to an IRC server, join channels and receive and send message. |
Types | |
spNetIRCMessage | Type for a linked list of IRC messages managed from the IRC server. |
spNetIRCNick | Type for a linked list of IRC nicks managed from the IRC server. |
spNetIRCChannel | Type for a linked list of IRC channels managed from the IRC server. |
spNetIRCServer | Handle type for interaction with the irc server. |
Functions | |
spNetIRCConnectServer | Connects to an IRC server. |
spNetIRCServerReady | Returns, whether the server is ready to be used, e.g. |
spNetIRCJoinChannel | Joins an IRC channel. |
spNetIRCChannelReady | Returns, whether the channel is ready to be used, e.g. |
spNetIRCSendMessage | Sends a message (PRIVMSG) to a channel or another user. |
spNetIRCPartChannel | Leave a channel / conversation. |
spNetIRCCloseServer | Closes the connection to the server, finishs the thread and releases the pointer handle! |
Types and Functions for initializing sparrowNet and sending data over tcp.
Types and Macros | |
spNetIP | An IP address resolved by sparrowNet. |
SP_INVALID_IP | Same as INADDR_NONE of SDL_Net. |
spNetTCPConnection | a type for open tcp connections. |
spNetTCPServer | a type for server sessions. |
Functions | |
spInitNet | Initializes sparrowNet. |
spQuitNet | Quits sparrowNet. |
spNetResolve | Resolves a ip to a hostname. |
spNetResolveHost | Gives you the hostname to an ip. |
spNetOpenClientTCP | Opens a connection to an ip |
spNetOpenServerTCP | Creates a server, which listens at a port |
spNetAcceptTCP | If a client tries to connect to your server, this function returns an established tcp connection from your server to the client. |
spNetGetConnectionIP | Gives you the ip of your connected client. |
spNetSendTCP | Sends a tcp package to the ether. |
spNetSendHTTP | Sends text over TCP with spNetSendTCP. |
spNetReceiveTCP | Receives data from the other side. |
spNetReceiveHTTP | Receives data from the other side until the other side disconnects. |
spNetReceiveTCPUnblocked | Receives data from the other side. |
spNetReceiveHTTPUnblocked | Receives data from the other side until the other side disconnects. |
spNetReceiveStillWaiting | Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. |
spNetReceiveFinished | Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. |
spNetCloseTCP | Closes a tcp connection or a server session. |
An IP address resolved by sparrowNet.
address.ipv4 (Uint32) | 32 bit ipv4 address |
address.ipv4_bytes (Uint8[4]) | 4 x 8bit ipv4 address |
address.ipv6 (Uint32[4]) | 128 bit ipv6 address |
address.ipv6_bytes (Uint8[16]) | 16 x 8bit ipv6 address |
port (Uint16) | port of the address |
sdl_address (IPaddress) | ip address struct of SDL |
Same as INADDR_NONE of SDL_Net. Means, that the ip returned by spNetResolve was not found and is invalid.
PREFIX spNetIP spNetResolve( char * host, Uint16 port )
Resolves a ip to a hostname. Only ipv4 is supported at the moment!
host | the host name |
port | the port you want to access (later) |
spNetIP | the ip in the type spNetIP. If address.ipv4 is SP_INVALID_IP, the function calls failed! |
PREFIX char* spNetResolveHost( spNetIP ip, char * host, int host_len )
Gives you the hostname to an ip.
ip | ip the the host you want to know |
host | a pointer, where to put the string |
host_len | the maximal length of the host string. Keep the ending 0 in mind! |
char* | the pointer “host” from above |
PREFIX spNetTCPConnection spNetAcceptTCP( spNetTCPServer server )
If a client tries to connect to your server, this function returns an established tcp connection from your server to the client.
server | the server returned by spNetOpenServerTCP |
PREFIX spNetIP spNetGetConnectionIP( spNetTCPConnection connection )
Gives you the ip of your connected client.
connection | a connection, where you want to know other side |
Returns spNetIP - the ip as spNetIP
PREFIX int spNetSendTCP( spNetTCPConnection connection, void * data, int length )
Sends a tcp package to the ether.
connection | the connection to send a tcp package with |
data | data to send. Can be a pointer to literally anything. |
length | length of the data to be sent (in bytes) |
int | the number of sent bytes. If unequal length the connection seem to be closed |
PREFIX int spNetReceiveTCP( spNetTCPConnection connection, void * data, int length )
Receives data from the other side. This function blocks your application until the client actually sends something!
connection | the connection you want to receive tcp packages from |
data | data to receive. Can be a pointer to literally anything. |
length | maximal data to receive |
int | the number of received bytes. If 0 something strange happend. E.g. your counterside explodes or just closed the connection. However your connection is invalid now! Better close, too. |
PREFIX int spNetReceiveHTTP( spNetTCPConnection connection, char * data, int length )
Receives data from the other side until the other side disconnects. This function blocks your application until the client actually sends something! You can of course use other protocols than http. ;)
connection | the connection you want to receive tcp packages from |
data | pointer to the text to receive |
length | maximal length of the text |
int | the number of received characters. If 0 something strange happend. E.g. your counterside explodes or just closed the connection. However your connection is invalid now! Better close, too. |
PREFIX SDL_Thread* spNetReceiveTCPUnblocked( spNetTCPConnection connection, void * data, int length )
Receives data from the other side. This function does not block your application! However, it may need a while until your counterpart sends something and your data string stays invalid.
connection | the connection you want to receive tcp packages from |
data | data to receive. Can be a pointer to literally anything. |
length | maximal data to receive |
SDL_Thread* | a handle to the created background thread. E.g. you can kill it with SDL_KillThread if you don’t want to wait anymore. If (void*)(-1) is returned the connection is closed (or your counterside exploded). |
PREFIX SDL_Thread* spNetReceiveHTTPUnblocked( spNetTCPConnection connection, char * data, int length )
Receives data from the other side until the other side disconnects. This function does not block your application! However, it may need a while until your counterpart sends something and your data string stays invalid. You can of course use other protocols than http. ;)
connection | the connection you want to receive tcp packages from |
data | pointer to the text to receive |
length | maximal length of the text |
SDL_Thread* | a handle to the created background thread. E.g. you can kill it with SDL_KillThread if you don’t want to wait anymore. If (void*)(-1) is returned the connection is closed (or your counterside exploded). |
PREFIX int spNetReceiveStillWaiting( SDL_Thread * thread )
Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. Usefull for timeouts.
thread | thread of the receiving call, which is maybe still running |
int | 1 if the thread still waits or 0 if not. |
PREFIX int spNetReceiveFinished( SDL_Thread * thread )
Says, whether a receive call (identified by the thread handle) still waits for an incoming signal. Usefull for timeouts. If the thread is finished the number of received bytes is returned.
thread | thread of the receiving call, which is maybe still running |
int | 0 if the thread still waits, -1 if the thread is not found and the number of received bytes else. |
Types and Functions for sending and receiving data to and from the compo4all server.
Macros | |
Compo4all statuses | Statuses for the committing and score-loading functions. |
Types | |
spNetC4AGame | Type for a linked list of games from the compo4all highscore servers |
spNetC4AScore | Type for a linked list of scores gotten from the compo4all highscore servers |
spNetC4AProfile | A struct for your unique C4A Profile. |
Functions | |
spNetC4AGetProfile | Reads your profile out of your c4a-prof file. |
spNetC4AFreeProfile | Frees the profile you got from spNetC4AGetProfile. |
spNetC4AGetGame | Loads all games listed on the C4A server. |
spNetC4AGetGameParallel | Loads all games listed on the C4A server. |
spNetC4ADeleteGames | Frees the linked list returned by spNetC4AGetGame. |
spNetC4AGetScore | Loads a top 500 for a given game from the compo4all server. |
spNetC4AGetScoreOfMonth | Loads a top 500 of a month for a given game from the compo4all server. |
spNetC4AGetScore | Loads a top 500 for a given game from the compo4all server. |
spNetC4AFilterScore | Makes, that every name appears only once in the scoreList |
spNetC4AGetScoreOfMonth | Loads a top 500 of a month for a given game from the compo4all server. |
spNetC4CopyScoreList | Makes an unique copy of the passed scorelist, e.g. |
spNetC4AMakeScoresUnique | Removes any double occurence of names in the score. |
spNetC4ADeleteScores | Frees the linked list returned by spNetC4AGetScore. |
spNetC4ACommitScore | Commits a score to a specific game to compo4all server. |
spNetC4ACommitScoreParallel | Commits a score to a specific game to compo4all server. |
spNetC4ACreateProfile | Creates a new profile on skeezix’ server. |
spNetC4ADeleteAccount | Deletes the given profile on skeezix server and maybe the file on your system. |
spNetC4AEditProfile | Edits an already existing profile on skeezix’ server. |
spNetC4ACancelTask | Cancels the C4A task running right now (if one is started). |
spNetC4ACancelTaskParallel | Cancels the given C4A task. |
spNetC4AGetTaskResult | Gets the result of the task when finished (check with spNetC4AGetStatus). |
spNetC4AGetTaskResultParallel | Gets the result of the given task when finished (check with spNetC4AGetStatusParallel). |
spNetC4AGetTimeOut | Gives you the time out of the C4A tasks. |
spNetC4AGetTimeOutParallel | Gives you the time out of the given C4A task. |
spNetC4AGetStatus | Gets the status of spNetC4AGetScore, spNetC4ACommitScore, spNetC4ACreateProfile, spNetC4AEditProfile & spNetC4ADeleteAccount. |
spNetC4AGetStatusParallel | Gets the status of <spNetC4AGetScoreParallel> & spNetC4ACommitScoreParallel. |
spNetC4ADeleteProfileFile | Deletes the profile file on your system, NOT the online account at skeezix server. |
spNetC4ADeleteTask | Deletes the task struct returned by the parallel working task functions. |
spNetC4ASetCaching | (De)Activates caching for C4A scores. |
spNetC4AHowManyCached | Returns how many scores are cached |
Type for a linked list of games from the compo4all highscore servers
longname | full name of the game |
shortname | short name of the game |
status | the status of the highscore: 1 means available, 2 even more available (called “active” by skeezix, don’t really know, what this means), 0 inactive, which means, you shouldn’t show that game except for testing purpose. |
genre | the genre of the game. |
field | which kind of game is it? 0 means just an indie game, 1 is a mame game, -1 means “don’t know” or “to be decided”. |
next | pointer to the next element in the list |
Type for a linked list of scores gotten from the compo4all highscore servers
longname | full name of the player |
shortname | three digit short name of the player |
score | the reached points |
commitTime | time of type time_t (seconds since 1.1.1970 00:00:00), when the score was committed. Use localtime of time.h to “decrypt” this type. ;) |
next | pointer to the next element in the list |
rank | rank in the score |
PREFIX spNetC4AProfilePointer spNetC4AGetProfile( void )
Reads your profile out of your c4a-prof file. On the pandora the file is created by compo4all and stored on a pandora specific place. On other systems for now your c4a-prof should be in the folder of your application.
spNetC4AProfilePointer | a pointer to an spNetC4AProfile struct |
PREFIX void spNetC4AFreeProfile( spNetC4AProfilePointer profile )
Frees the profile you got from spNetC4AGetProfile.
profile | profile to free. However of course your profile is not deleted. ;) |
PREFIX int spNetC4AGetGame( spNetC4AGamePointer * gameList, int timeOut )
Loads all games listed on the C4A server. Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
gameList | a pointer to spNetC4AGamePointer, which is in fact a pointer to spNetC4AGame. The available games are saved here. |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
PREFIX spNetC4ATaskPointer spNetC4AGetGameParallel( spNetC4AGamePointer * gameList, int timeOut )
Loads all games listed on the C4A server. Use spNetC4AGetStatusParallel to get the status of the task. Don’t forget to delete the returned task struct with spNetC4ADeleteTask at the end.
gameList | a pointer to spNetC4AGamePointer, which is in fact a pointer to spNetC4AGame. The available games are saved here. |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
spNetC4ATaskPointer | Pointer to <spNetC4ATask> at success and NULL if an error occured. |
PREFIX void spNetC4ADeleteGames( spNetC4AGamePointer * gameList )
Frees the linked list returned by spNetC4AGetGame.
firstGame | pointer to spNetC4AGame to free |
PREFIX int spNetC4AGetScore( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int timeOut )
Loads a top 500 for a given game from the compo4all server. The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
scoreList | a pointer to spNetC4AScorePointer, which is in fact a pointer to spNetC4AScore. The scores are saved here. |
profile | an optional pointer to your profile. If given only your scores are added to the scores-list above |
game | name of the game on the server |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
See also: spNetC4AGetScoreOfMonth
PREFIX int spNetC4AGetScoreOfMonth( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int year, int month, int timeOut )
Loads a top 500 of a month for a given game from the compo4all server. The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
scoreList | a pointer to spNetC4AProfilePointer, which is in fact a pointer to spNetC4AScore. The scores are saved here. |
profile | an optional pointer to your profile. If given only your scores are added to the scores-list above |
game | name of the game on the server |
year | year to load (e.g. 2013) |
month | month to load (e.g. 3 for march) |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
See also: spNetC4AGetScore
PREFIX spNetC4ATaskPointer spNetC4AGetScoreParallel( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int timeOut )
Loads a top 500 for a given game from the compo4all server. The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
scoreList | a pointer to spNetC4AScorePointer, which is in fact a pointer to spNetC4AScore. The scores are saved here. |
profile | an optional pointer to your profile. If given only your scores are added to the scores-list above |
game | name of the game on the server |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
spNetC4ATaskPointer | Pointer to <spNetC4ATask> at success and NULL if an error occured. |
See also: <spNetC4AGetScoreOfMonthParallel>
PREFIX void spNetC4AFilterScore( spNetC4AScorePointer * scoreList )
Makes, that every name appears only once in the scoreList
scoreList | a pointer to spNetC4AScorePointer, which is in fact a pointer to spNetC4AScore. These scores are changed. |
PREFIX spNetC4ATaskPointer spNetC4AGetScoreOfMonthParallel( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int year, int month, int timeOut )
Loads a top 500 of a month for a given game from the compo4all server. The task runs in background! Use spNetC4AGetStatusParallel to get the status of the task. Don’t forget to delete the returned task struct with spNetC4ADeleteTask at the end.
scoreList | a pointer to spNetC4AProfilePointer, which is in fact a pointer to spNetC4AScore. The scores are saved here. |
profile | an optional pointer to your profile. If given only your scores are added to the scores-list above |
game | name of the game on the server |
year | year to load (e.g. 2013) |
month | month to load (e.g. 3 for march) |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
spNetC4ATaskPointer | Pointer to <spNetC4ATask> at success and NULL if an error occured. |
See also: <spNetC4AGetScoreParallel>
Makes an unique copy of the passed scorelist, e.g. if you want to remove double names with spNetC4AMakeScoresUnique afterwards. Don’t forget to free every copy with spNetC4ADeleteScores afterwards!
scoreList | a pointer to spNetC4AProfilePointer, which is in fact a pointer to spNetC4AScore, which shall be copied |
newList | a pointer to spNetC4AProfilePointer, which is in fact a pointer to spNetC4AScore, to which the copy shall be written |
PREFIX void spNetC4AMakeScoresUnique( spNetC4AScorePointer * scoreList )
Removes any double occurence of names in the score. Afterwars every name only occurs ones with the best score of this player. Be careful: Afterwards you can’t use this list for uploading scores if they don’t exist anymore. If you want both make a copy of the list with <spNetC4ACopyScoreList> before (instead of getting the scores twice).
scoreList | a pointer to spNetC4AProfilePointer, which is in fact a pointer to spNetC4AScore |
PREFIX void spNetC4ADeleteScores( spNetC4AScorePointer * scoreList )
Frees the linked list returned by spNetC4AGetScore.
firstScore | pointer to spNetC4AScore to free |
PREFIX int spNetC4ACommitScore( spNetC4AProfilePointer profile, char * game, int score, spNetC4AScorePointer * scoreList, int timeOut )
Commits a score to a specific game to compo4all server. The task runs in background! Use spNetC4AGetStatusParallel to get the status of the task. Don’t forget to delete the returned task struct with spNetC4ADeleteTask at the end.
profile | the profile you want to commit tthe score with |
game | name of the game on the server. If this is empty (“”), at least the c4a cache will be tried to commit. |
score | reached score |
scoreList | pass the struct returned by spNetC4AGetScore to compare your score to that list and avoid committing the same score twice. If it is not in the list, it will added afterwards for later comparements. |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut. If timeOut is 0, no thread is started, but the score is written to the cache if enabled! |
int | 1 if the function failed for some reason (e.g. the score is already in the scoreList), 0 at success starting the task. |
PREFIX spNetC4ATaskPointer spNetC4ACommitScoreParallel( spNetC4AProfilePointer profile, char * game, int score, spNetC4AScorePointer * scoreList, int timeOut )
Commits a score to a specific game to compo4all server. The task runs in background! Use spNetC4AGetStatusParallel to get the status of the task. Don’t forget to delete the returned task struct with spNetC4ADeleteTask at the end.
profile | the profile you want to commit tthe score with |
game | name of the game on the server |
score | reached score |
scoreList | pass the struct returned by spNetC4AGetScore to compare your score to that list and avoid committing the same score twice. If it is not in the list, it will added afterwards for later comparements. |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut If timeOut is 0, no thread is started, but the score is written to the cache if enabled! |
spNetC4ATaskPointer | Pointer to <spNetC4ATask> at success and NULL if an error occured. |
PREFIX int spNetC4ACreateProfile( spNetC4AProfilePointer * profile, char * longname, char * shortname, char * password, char * email, int timeOut )
Creates a new profile on skeezix’ server. Blocks your application! However, if network is avaible, should be quite fast. Furthermore it creates the c4a-prof file needed by all supported applications. The path of the file is platform depended. Overwrites an already existing file! The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time! Only for Pandora: If no c4a-prof is created until now and no c4a-mame appdata folder is available it will be created in the first folder in /media with pandora/appdata in it. It MAY be, that skeezix’s C4A Manager will not find this c4a-prof if it will be installed later on another SD card! However the spaghetti client, the fusilli client and the Sparrow C4A Manager will find this profile file in any case (if you don’t create a second c4a-prof with skeezix c4a manager. It that case it is random which c4a-prof is used in the end...)
profile | a pointer to a pointer to spNetC4AProfile, where the profile shall be saved to. |
longname | the long name of the player. Should only be alphanumeric. |
shortname | the short name of the player. Should exactly 3 alphanumeric, capital letters. |
password | alphanumeric password |
the mail address of the new account. Can be “”. | |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
PREFIX int spNetC4ADeleteAccount( spNetC4AProfilePointer * profile, int deleteFile, int timeOut )
Deletes the given profile on skeezix server and maybe the file on your system. The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
profile | profile to delete from the server. |
deleteFile | 1 if you want to delete the c4a-prof file at the end (at success), too. 0 leaves to file. |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
PREFIX int spNetC4AEditProfile( spNetC4AProfilePointer * profile, char * longname, char * shortname, char * password, char * email, int timeOut )
Edits an already existing profile on skeezix’ server. Blocks your application! However, if network is avaible, should be quite fast. Furthermore it rewrites the c4a-prof file needed by all supported applications. The path of the file is platform depended. If the account doesn’t exist now, it will created. The big difference to spNetC4ACreateProfile is, that the prid is read from the profile struct instead of being new created. The task runs in background! Use spNetC4AGetStatus to get the status of the task. Only one compo4all background task can run at one time!
profile | the profile to change. |
longname | the long name of the player. Should only be alphanumeric. |
shortname | the short name of the player. Should exactly 3 alphanumeric, capital letters. |
password | alphanumeric password |
the mail address of the new account. Can be “”. | |
timeOut | after this time in ms the thread is killed. Get it with spNetC4AGetTimeOut |
int | 1 if the function failed for some reason, 0 at success starting the task. |
PREFIX void spNetC4ACancelTaskParallel( spNetC4ATaskPointer task )
Cancels the given C4A task. Don’t forget to delete it afterwards with spNetC4ADeleteTask!
task | pointer to <spNetC4ATask> returned from the parallel functions. |
PREFIX int spNetC4AGetTaskResult( void )
Gets the result of the task when finished (check with spNetC4AGetStatus).
int | 0 if everything went fine, 1 at error |
PREFIX int spNetC4AGetTaskResultParallel( spNetC4ATaskPointer task )
Gets the result of the given task when finished (check with spNetC4AGetStatusParallel).
task | pointer to <spNetC4ATask> returned from the parallel functions. |
int | 0 if everything went fine, 1 at error |
PREFIX int spNetC4AGetStatus( void )
Gets the status of spNetC4AGetScore, spNetC4ACommitScore, spNetC4ACreateProfile, spNetC4AEditProfile & spNetC4ADeleteAccount.
int | Compo4all statuses |
PREFIX int spNetC4AGetStatusParallel( spNetC4ATaskPointer task )
Gets the status of <spNetC4AGetScoreParallel> & spNetC4ACommitScoreParallel.
task | pointer to <spNetC4ATask> returned from the parallel functions |
int | Compo4all statuses |
PREFIX void spNetC4ADeleteProfileFile( void )
Deletes the profile file on your system, NOT the online account at skeezix server. See also spNetC4ADeleteAccount.
PREFIX void spNetC4ASetCaching( int value )
(De)Activates caching for C4A scores. If caching is enabled every time spNetC4ACommitScore* fails, it is written to a cache file and the next time spNetC4ACommitScore* is called it will be tried to be committed again
value | 0: No caching 1: Everything is cached 2: Only the best score of a game is cached 3: Same like 2, but lower score is better |
Types and Functions for connecting to an IRC server, join channels and receive and send message.
Types | |
spNetIRCMessage | Type for a linked list of IRC messages managed from the IRC server. |
spNetIRCNick | Type for a linked list of IRC nicks managed from the IRC server. |
spNetIRCChannel | Type for a linked list of IRC channels managed from the IRC server. |
spNetIRCServer | Handle type for interaction with the irc server. |
Functions | |
spNetIRCConnectServer | Connects to an IRC server. |
spNetIRCServerReady | Returns, whether the server is ready to be used, e.g. |
spNetIRCJoinChannel | Joins an IRC channel. |
spNetIRCChannelReady | Returns, whether the channel is ready to be used, e.g. |
spNetIRCSendMessage | Sends a message (PRIVMSG) to a channel or another user. |
spNetIRCPartChannel | Leave a channel / conversation. |
spNetIRCCloseServer | Closes the connection to the server, finishs the thread and releases the pointer handle! |
Type for a linked list of IRC channels managed from the IRC server. With channel are meant channels from the type #meow and queries!
name | name of the channel |
status | internal status flag of the channel |
first_nick | pointer to spNetIRCNick, first nick in the channel |
last_nick | pointer to spNetIRCNick, last nick in the channel |
next | pointer to the next element in the list |
first_message | pointer to spNetIRCMessage, first message in the channel |
last_message | pointer to spNetIRCMessage, last message in the channel |
last_read_message | pointer to spNetIRCMessage, last read message. You have to update this yourself! |
close_query | internal message flag |
first_add_message | pointer to spNetIRCMessage, internal chain |
last_add_message | pointer to spNetIRCMessage, internal chain |
last_add_read_message | pointer to spNetIRCMessage, internal chain |
Handle type for interaction with the irc server. You should not use it direct but with the spNetIRC* functions.
name | name/url of the server |
port | port of the server (most of the time 6667) |
nickname | nickname of the chatter |
realname | the REAL name of the chatter! |
firstChannel | pointer the first element of a list of all channels |
ip | spNetIP struct. IP of the server. |
connection | spNetTCPConnection struct. connection handle to the server |
thread | SDL thread struct |
finish_flag | messages for the server to finish |
status | internal status flag |
counter | internal nickname counter |
original_nickname | internal nickname to copy from |
first_message | pointer to spNetIRCMessage, first message of the server |
last_message | pointer to spNetIRCMessage, last message of the server |
last_read_message | pointer to spNetIRCMessage, last read message. You have to update this yourself! |
first_add_message | pointer to spNetIRCMessage, internal chain |
last_add_message | pointer to spNetIRCMessage, internal chain |
last_add_read_message | pointer to spNetIRCMessage, internal chain |
PREFIX spNetIRCServerPointer spNetIRCConnectServer( char * name, Uint16 port, char * nickname, char * username, char * realname, char * password )
Connects to an IRC server. If the attempt was sucessful a new thread is created and a pointer to spNetIRCServer returned.
name | name/url of the server |
port | port of the server (e.g. 6667) |
nickname | nickname to use. If the nickname is already used, it will be used another one with numbers and stuff |
username | your user name |
realname | your real name |
password | password |
spNetIRCServerPointer | a pointer to spNetIRCServer to use in further spNetIRC* functions |
PREFIX int spNetIRCServerReady( spNetIRCServerPointer server )
Returns, whether the server is ready to be used, e.g. for joining channels
server | pointer to spNetIRCServer struct |
int | 1: the server is ready; 0: not ready. If you try to join a channel on a not ready server, it may not work! |
PREFIX spNetIRCChannelPointer spNetIRCJoinChannel( spNetIRCServerPointer server, char * name )
Joins an IRC channel. Call it only if <spNetIRCReady> returns 1!
server | pointer to spNetIRCServer struct |
name | name of the channel. Has to start with #! |
spNetIRCChannelPointer | Pointer to spNetIRCServerReady struct, handle for the channel |
PREFIX int spNetIRCChannelReady( spNetIRCChannelPointer channel )
Returns, whether the channel is ready to be used, e.g. for sending messages
channel | pointer to spNetIRCChannel struct |
int | 1: the channel is ready; 0: not ready. -1: an error occured, e.g. you are banned |
PREFIX void spNetIRCSendMessage( spNetIRCServerPointer server, spNetIRCChannelPointer channel, char * message )
Sends a message (PRIVMSG) to a channel or another user. If channel is NULL it will be send to the server instead (e.g. spNetIRCSendMessage(server,NULL,”quit”) for /quit).
server | pointer to spNetIRCServer struct |
channel | pointer to spNetIRCChannel struct, may be NULL |
message | message to send |
PREFIX void spNetIRCPartChannel( spNetIRCServerPointer server, spNetIRCChannelPointer channel )
Leave a channel / conversation. You should not use the channel pointer after this point. It may need some time for the PART command to get to the server but at one point the pointer will be invalid! It will removed from server then automaticly.
spNetIRCServerPointer | a pointer to spNetIRCServer |
channel | pointer to spNetIRCChannel struct |
PREFIX void spNetIRCCloseServer( spNetIRCServerPointer server )
Closes the connection to the server, finishs the thread and releases the pointer handle!
spNetIRCServerPointer | a pointer to spNetIRCServer, which describes which server shall be exited |
Initializes sparrowNet.
PREFIX void spInitNet( void )
Quits sparrowNet.
PREFIX void spQuitNet( void )
Resolves a ip to a hostname.
PREFIX spNetIP spNetResolve( char * host, Uint16 port )
Gives you the hostname to an ip.
PREFIX char* spNetResolveHost( spNetIP ip, char * host, int host_len )
Opens a connection to an ip
PREFIX spNetTCPConnection spNetOpenClientTCP( spNetIP ip )
Creates a server, which listens at a port
PREFIX spNetTCPServer spNetOpenServerTCP( Uint16 port )
If a client tries to connect to your server, this function returns an established tcp connection from your server to the client.
PREFIX spNetTCPConnection spNetAcceptTCP( spNetTCPServer server )
Gives you the ip of your connected client.
PREFIX spNetIP spNetGetConnectionIP( spNetTCPConnection connection )
Sends a tcp package to the ether.
PREFIX int spNetSendTCP( spNetTCPConnection connection, void * data, int length )
Sends text over TCP with spNetSendTCP.
PREFIX int spNetSendHTTP( spNetTCPConnection connection, char * data )
Receives data from the other side.
PREFIX int spNetReceiveTCP( spNetTCPConnection connection, void * data, int length )
Receives data from the other side until the other side disconnects.
PREFIX int spNetReceiveHTTP( spNetTCPConnection connection, char * data, int length )
Receives data from the other side.
PREFIX SDL_Thread* spNetReceiveTCPUnblocked( spNetTCPConnection connection, void * data, int length )
Receives data from the other side until the other side disconnects.
PREFIX SDL_Thread* spNetReceiveHTTPUnblocked( spNetTCPConnection connection, char * data, int length )
Says, whether a receive call (identified by the thread handle) still waits for an incoming signal.
PREFIX int spNetReceiveStillWaiting( SDL_Thread * thread )
Says, whether a receive call (identified by the thread handle) still waits for an incoming signal.
PREFIX int spNetReceiveFinished( SDL_Thread * thread )
Closes a tcp connection or a server session.
PREFIX void spNetCloseTCP( spNetTCPConnection connection )
Reads your profile out of your c4a-prof file.
PREFIX spNetC4AProfilePointer spNetC4AGetProfile( void )
Frees the profile you got from spNetC4AGetProfile.
PREFIX void spNetC4AFreeProfile( spNetC4AProfilePointer profile )
Loads all games listed on the C4A server.
PREFIX int spNetC4AGetGame( spNetC4AGamePointer * gameList, int timeOut )
Loads all games listed on the C4A server.
PREFIX spNetC4ATaskPointer spNetC4AGetGameParallel( spNetC4AGamePointer * gameList, int timeOut )
Frees the linked list returned by spNetC4AGetGame.
PREFIX void spNetC4ADeleteGames( spNetC4AGamePointer * gameList )
Loads a top 500 for a given game from the compo4all server.
PREFIX int spNetC4AGetScore( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int timeOut )
Loads a top 500 of a month for a given game from the compo4all server.
PREFIX int spNetC4AGetScoreOfMonth( spNetC4AScorePointer * scoreList, spNetC4AProfilePointer profile, char * game, int year, int month, int timeOut )
Makes, that every name appears only once in the scoreList
PREFIX void spNetC4AFilterScore( spNetC4AScorePointer * scoreList )
Removes any double occurence of names in the score.
PREFIX void spNetC4AMakeScoresUnique( spNetC4AScorePointer * scoreList )
Frees the linked list returned by spNetC4AGetScore.
PREFIX void spNetC4ADeleteScores( spNetC4AScorePointer * scoreList )
Commits a score to a specific game to compo4all server.
PREFIX int spNetC4ACommitScore( spNetC4AProfilePointer profile, char * game, int score, spNetC4AScorePointer * scoreList, int timeOut )
Commits a score to a specific game to compo4all server.
PREFIX spNetC4ATaskPointer spNetC4ACommitScoreParallel( spNetC4AProfilePointer profile, char * game, int score, spNetC4AScorePointer * scoreList, int timeOut )
Creates a new profile on skeezix’ server.
PREFIX int spNetC4ACreateProfile( spNetC4AProfilePointer * profile, char * longname, char * shortname, char * password, char * email, int timeOut )
Deletes the given profile on skeezix server and maybe the file on your system.
PREFIX int spNetC4ADeleteAccount( spNetC4AProfilePointer * profile, int deleteFile, int timeOut )
Edits an already existing profile on skeezix’ server.
PREFIX int spNetC4AEditProfile( spNetC4AProfilePointer * profile, char * longname, char * shortname, char * password, char * email, int timeOut )
Cancels the C4A task running right now (if one is started).
PREFIX void spNetC4ACancelTask( void )
Cancels the given C4A task.
PREFIX void spNetC4ACancelTaskParallel( spNetC4ATaskPointer task )
Gets the result of the task when finished (check with spNetC4AGetStatus).
PREFIX int spNetC4AGetTaskResult( void )
Gets the status of spNetC4AGetScore, spNetC4ACommitScore, spNetC4ACreateProfile, spNetC4AEditProfile & spNetC4ADeleteAccount.
PREFIX int spNetC4AGetStatus( void )
Gets the result of the given task when finished (check with spNetC4AGetStatusParallel).
PREFIX int spNetC4AGetTaskResultParallel( spNetC4ATaskPointer task )
Gets the status of spNetC4AGetScoreParallel & spNetC4ACommitScoreParallel.
PREFIX int spNetC4AGetStatusParallel( spNetC4ATaskPointer task )
Gives you the time out of the C4A tasks.
PREFIX int spNetC4AGetTimeOut( void )
Gives you the time out of the given C4A task.
PREFIX int spNetC4AGetTimeOutParallel( spNetC4ATaskPointer task )
Deletes the profile file on your system, NOT the online account at skeezix server.
PREFIX void spNetC4ADeleteProfileFile( void )
Deletes the task struct returned by the parallel working task functions.
PREFIX void spNetC4ADeleteTask( spNetC4ATaskPointer task )
(De)Activates caching for C4A scores.
PREFIX void spNetC4ASetCaching( int value )
Returns how many scores are cached
PREFIX int spNetC4AHowManyCached( void )
Connects to an IRC server.
PREFIX spNetIRCServerPointer spNetIRCConnectServer( char * name, Uint16 port, char * nickname, char * username, char * realname, char * password )
Returns, whether the server is ready to be used, e.g.
PREFIX int spNetIRCServerReady( spNetIRCServerPointer server )
Joins an IRC channel.
PREFIX spNetIRCChannelPointer spNetIRCJoinChannel( spNetIRCServerPointer server, char * name )
Returns, whether the channel is ready to be used, e.g.
PREFIX int spNetIRCChannelReady( spNetIRCChannelPointer channel )
Sends a message (PRIVMSG) to a channel or another user.
PREFIX void spNetIRCSendMessage( spNetIRCServerPointer server, spNetIRCChannelPointer channel, char * message )
Leave a channel / conversation.
PREFIX void spNetIRCPartChannel( spNetIRCServerPointer server, spNetIRCChannelPointer channel )
Closes the connection to the server, finishs the thread and releases the pointer handle!
PREFIX void spNetIRCCloseServer( spNetIRCServerPointer server )