Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
February 2000: [Freeciv-Dev] [DIFS] mac update |
![]() |
[Freeciv-Dev] [DIFS] mac update[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi Attached is a colection of diff I have made to get the mac port working. The server near completion. The bigest hold up is rewriting the code for open transport. I tried to document all changes, if you have a question about one, just e-mail me. Andy Black Index: config.mac.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/config.mac.h,v retrieving revision 1.7 diff -u -2 -r1.7 config.mac.h --- config.mac.h 1999/10/03 09:41:57 1.7 +++ config.mac.h 2000/02/19 01:34:57 @@ -100,8 +100,10 @@ #undef STRICT_CONTROLS/* copland Compatability (os x?), _MAC ONLY_ (pointless on other systems)*/ #define STRICT_CONTROLS 1 /* seq used to enable strict controls */ +#undef STRICT_MENUS/* copland Compatability? (os x?), _MAC ONLY_ (pointless on other systems)*/ +#define STRICT_MENUS 1 /* seq used to enable strict menus */ #define GENERATING_MAC /*use for mac native code*/ #define HAVE_OPENTRANSPORT /*used for OpenTransport Networking*/ #undef PATH_SEPARATOR -#undef SOCKET_ZERO_ISNT_STDIN +#define SOCKET_ZERO_ISNT_STDIN 1 /* Define if you have the __argz_count function. */ @@ -173,4 +175,7 @@ /* Define if you have the usleep function. */ #undef HAVE_USLEEP + +/* Define if you have the vsnprintf function. */ +#undef HAVE_VSNPRINTF /* Define if you have the <argz.h> header file. */ Index: aitech.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitech.c,v retrieving revision 1.21 diff -u -2 -r1.21 aitech.c --- aitech.c 1999/10/03 07:15:26 1.21 +++ aitech.c 2000/02/19 02:04:45 @@ -194,8 +194,12 @@ { int i, j, k; - int values[A_LAST]; + /*int values[A_LAST]; int goal_values[A_LAST]; int prereq[A_LAST]; - unsigned char cache[A_LAST][A_LAST]; + unsigned char cache[A_LAST][A_LAST];*/ + int * values=(int *)fc_malloc(sizeof(char)*game.num_tech_types); + int *goal_values=(int *)fc_malloc(sizeof(char)*game.num_tech_types); + int *prereq=(int *)fc_malloc(sizeof(char)*game.num_tech_types); + unsigned char **cache=(unsigned char **)fc_malloc(sizeof(char)*game.num_tech_types*game.num_tech_types); int c = MAX(1, city_list_size(&pplayer->cities)); @@ -262,4 +266,8 @@ advances[gol->choice].name, gol->want, goal_values[k], c); } + free(values); /*always cleanup your allocated memory :)-AWB*/ + free(goal_values); /*I had almost forgoten --AWB*/ + free(prereq); + free(cache); return; } @@ -336,3 +344,3 @@ choose_tech_goal(pplayer, gol.choice); } -} +} \ No newline at end of file Index: aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.102 diff -u -2 -r1.102 aiunit.c --- aiunit.c 2000/02/14 13:01:04 1.102 +++ aiunit.c 2000/02/19 01:39:46 @@ -651,8 +651,8 @@ int xx, yy, best_xx = punit->x, best_yy = punit->y; int dist = 100; - int far = real_map_distance( pc->x, pc->y, punit->x, punit->y ); + int leng = real_map_distance( pc->x, pc->y, punit->x, punit->y ); - for( i = 1-far; i < far; i++ ) - for( j = 1-far; j < far; j++ ) { + for( i = 1-leng; i < leng; i++ ) + for( j = 1-leng; j < leng; j++ ) { xx = map_adjust_x(punit->x + i); yy = map_adjust_y(punit->y + j); Index: clinet.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v retrieving revision 1.23 diff -u -2 -r1.23 clinet.c --- clinet.c 2000/01/02 11:55:22 1.23 +++ clinet.c 2000/02/19 01:42:22 @@ -58,4 +58,8 @@ #include <arpa/inet.h> #endif +#ifdef HAVE_OPENTRANSPORT +#include <OpenTransport.h> +#include <OpenTptInternet.h> +#endif #include "capstr.h" @@ -87,7 +91,18 @@ { /* use name to find TCPIP address of server */ +#ifdef HAVE_OPENTRANSPORT + OSStatus err1; + OSErr err2; + InetSvcRef ref=OTOpenInternetServices(kDefaultInternetServicesPath, 0, &err1); + InetHostInfo hinfo; + TEndpointInfo src_info; + EndpointRef src_ep; + InetAddress src_addr; + char *temperr=""; +#else struct sockaddr_in src; struct hostent *ph; long address; +#endif struct packet_req_join_game req; @@ -98,4 +113,29 @@ hostname="localhost"; +#ifdef HAVE_OPENTRANSPORT + if (err1!=0) + { + sprintf(temperr, _("Error opening OpenTransport (type: %n)"),err1); + mystrlcpy(errbuf, temperr, n_errbuf); + return -1; + } + err1=OTInetStringToAddress(ref, hostname, &hinfo); + src_addr.fHost=hinfo.addrs[0]; + if((src_addr.fHost == 0) || (err1 != 0)) + { + sprintf(temperr, _("Error (type: %n) Failed looking up host %s"), + err1, hostname); + mystrlcpy(errbuf, temperr, n_errbuf); + return -1; + } + src_ep=OTOpenEndpoint(OTCreateConfiguration(kUDPName), 0, &src_info, &err1); + if(err1 != 0){ + sprintf(temperr, _("Error (type: %n) opening socket to %s"), + err1, hostname); + mystrlcpy(errbuf, temperr, n_errbuf); + return -1; + } + +#else if(isdigit((size_t)*hostname)) { if((address = inet_addr(hostname)) == -1) { @@ -117,4 +157,5 @@ src.sin_port = htons(port); + #ifdef HAVE_SIGPIPE /* ignore broken pipes */ @@ -132,4 +173,5 @@ return -1; } +#endif aconnection.buffer.ndata=0; @@ -160,5 +202,9 @@ { append_output_window(_("Disconnecting from server.")); +#ifdef HAVE_OPENTRANSPORT + OTUnbind(aconnection.sock); +#else close(aconnection.sock); +#endif remove_net_input(); set_client_state(CLIENT_PRE_GAME_STATE); @@ -202,7 +248,21 @@ { struct server_list *server_list; +#ifdef HAVE_OPENTRANSPORT + OSStatus err1; + OSErr err2; + OTResult err3; + InetSvcRef ref=OTOpenInternetServices(kDefaultInternetServicesPath, 0, &err1); + InetHostInfo hinfo; + TEndpointInfo info; + EndpointRef ep; + InetAddress addr; + TBind req; + OTFlags* flags=0; + char *temperr=""; +#else struct sockaddr_in addr; struct hostent *ph; int s; +#endif FILE *f; char *proxy_url; @@ -261,4 +321,39 @@ } + +#ifdef HAVE_OPENTRANSPORT + if (err1!=0) + { + sprintf(temperr, _("Error opening OpenTransport (type: %n)"),err1); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } + err1=OTInetStringToAddress(ref, server, &hinfo); + addr.fHost=hinfo.addrs[0]; + if((addr.fHost == 0) || (err1 != 0)) + { + sprintf(temperr, _("Error (type: %n) Failed looking up host %s"), + err1, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } + ep=OTOpenEndpoint(OTCreateConfiguration(kUDPName), 0, &info, &err1); + if(err1 != 0){ + sprintf(temperr, _("Error (type: %n) opening socket to %s"), + err1, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } + req.addr.buf=(unsigned char *)server; + req.addr.len=strlen(server); + req.qlen=256;/*just a guess*/ + err1=OTBind(ep, &req, NULL); + if(err1 != 0){ + sprintf(temperr, _("Error (type: %n) opening socket to %s"), + err1, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else if ((ph = gethostbyname(server)) == NULL) { mystrlcpy(errbuf, _("Failed looking up host"), n_errbuf); @@ -281,5 +376,5 @@ return NULL; } - +#endif #ifdef HAVE_FDOPEN f=fdopen(s,"r+"); @@ -291,18 +386,87 @@ #else { - int i; + int i=0; f=tmpfile(); +#ifdef HAVE_OPENTRANSPORT + err3=OTSnd(ep, "GET ", 4,T_MORE); +/*T_MORE is used to (probably) send the whole request in one batch*/ + if (err3<0) + { + sprintf(temperr, _("Error (type: %n) sending data to %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else send(s,"GET ",4,0); - if(!proxy_url) send(s,"/",1,0); +#endif + if(!proxy_url){ +#ifdef HAVE_OPENTRANSPORT + err3=OTSnd(ep,"/",1,T_MORE); + if (err3<0) + { + sprintf(temperr, _("Error (type: %n) sending data to %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else + send(s,"/",1,0); +#endif + } +#ifdef HAVE_OPENTRANSPORT + err3=OTSnd(ep,urlpath,strlen(urlpath),T_MORE); + if (err3<0) + { + sprintf(temperr, _("Error (type: %n) sending data to %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else send(s,urlpath,strlen(urlpath),0); - if(proxy_url) send(s,metaserver,strlen(metaserver),0); +#endif + if(!proxy_url){ +#ifdef HAVE_OPENTRANSPORT + err3=OTSnd(ep,metaserver,strlen(metaserver),T_MORE); + if (err3<0) + { + sprintf(temperr, _("Error (type: %n) sending data to %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else + send(s,metaserver,strlen(metaserver),0); +#endif + } +#ifdef HAVE_OPENTRANSPORT + err3=OTSnd(ep," HTTP/1.0\r\n\r\n", sizeof(" HTTP/1.0\r\n\r\n"),0); + if (err3<0) + { + sprintf(temperr, _("Error (type: %n) sending data to %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else send(s," HTTP/1.0\r\n\r\n", sizeof(" HTTP/1.0\r\n\r\n"),0); - +#endif +#ifdef HAVE_OPENTRANSPORT + while ((err3 = OTRcv(ep, str, sizeof(str), flags)) > 0) + fwrite(str,1,i,f); + if (i<0) + { + sprintf(temperr, _("Error (type: %n) recieving data from %s"),err3, server); + mystrlcpy(errbuf, temperr, n_errbuf); + return NULL; + } +#else while ((i = recv(s, str, sizeof(str), 0)) > 0) fwrite(str,1,i,f); +#endif fflush(f); - +#ifdef HAVE_OPENTRANSPORT + OTUnbind(ep); + OTCloseEndpoint(ep); +#else close(s); +#endif fseek(f,0,SEEK_SET); Index: gui_main_g.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/include/gui_main_g.h,v retrieving revision 1.2 diff -u -2 -r1.2 gui_main_g.h --- gui_main_g.h 1999/08/14 02:57:22 1.2 +++ gui_main_g.h 2000/02/19 01:43:43 @@ -14,7 +14,15 @@ #define FC__GUI_MAIN_G_H + +/*for the purpose of this see coment/comentary in packets.h*/ +#ifdef HAVE_OPENTRANSPORT +typedef EndpointRef NET_SOCK; +#else +typedef int NET_SOCK; +#endif + void ui_main(int argc, char *argv[]); void enable_turn_done_button(void); -void add_net_input(int); +void add_net_input(NET_SOCK); void remove_net_input(void); Index: mem.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/mem.c,v retrieving revision 1.2 diff -u -2 -r1.2 mem.c --- mem.c 1999/10/04 13:36:18 1.2 +++ mem.c 2000/02/19 01:47:57 @@ -30,7 +30,19 @@ /********************************************************************** + A subroutine for any cleanup work. Curently does nothing +**********************************************************************/ + +void failure_cleanup(void) +{ + /*place all cleanup/safe-save code here*/ +} + + +/********************************************************************** Do whatever we should do when malloc fails. At the moment this just prints a log message and calls exit(1) -**********************************************************************/ +**********************************************************************/ +/* or an out of memory error code (in the mac port) */ + static void handle_alloc_failure(size_t size, const char *called_as, int line, const char *file) @@ -41,5 +53,11 @@ * Do anything else here (cleanups? safe-save??) */ + failure_cleanup(); /* a subroutine for cleanup purposes*/ + +#ifdef GENERATING_MAC + exit(dsMemFullErr); +#else exit(1); +#endif } @@ -122,4 +140,3 @@ strcpy(dest, str); return dest; -} - +} \ No newline at end of file Index: mem.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/mem.h,v retrieving revision 1.2 diff -u -2 -r1.2 mem.h --- mem.h 1999/05/01 03:57:23 1.2 +++ mem.h 2000/02/19 01:49:17 @@ -23,4 +23,5 @@ * a log message, possibly cleanup, and ending with exit(1) */ +/* or exit(error) for mac port--awb*/ #define fc_malloc(sz) fc_real_malloc((sz), "malloc", \ @@ -33,5 +34,13 @@ #define mystrdup(str) real_mystrdup((str), "strdup", \ __LINE__, __FILE__) - + +/* failure_cleanup: + * used to do any cleanup functions for when things are spining out of control. + * curently does nothing, but is referenced from the mac memeoy file in the mac port. + * this function _does_not_ and _should_not_ call exit() or assert(). + */ + +void failure_cleanup(void); + /***********************************************************************/ Index: packets.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v retrieving revision 1.87 diff -u -2 -r1.87 packets.c --- packets.c 2000/01/19 16:33:21 1.87 +++ packets.c 2000/02/19 01:50:33 @@ -3130,6 +3130,14 @@ if(pc) { if(pc->send_buffer.ndata) { + int error; +#ifdef HAVE_OPENTRANSPORT + if(OTStreamWrite(pc->sock, (char *)pc->send_buffer.data, pc->send_buffer.ndata)!=0) + error =1; +#else if(write(pc->sock, (const char *)pc->send_buffer.data, pc->send_buffer.ndata)!= pc->send_buffer.ndata) { + error =1;} +#endif + if (error) { freelog(LOG_NORMAL, "failed writing data to socket"); } @@ -3158,5 +3166,13 @@ } else { + int error; +#ifdef HAVE_OPENTRANSPORT + if(OTStreamWrite(pc->sock, (char *)data, len)!=0) + error =1; +#else if(write(pc->sock, (const char *)data, len)!=len) { + error =1;} +#endif + if(error){ freelog(LOG_NORMAL, "failed writing data to socket"); return -1; Index: packets.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v retrieving revision 1.60 diff -u -2 -r1.60 packets.h --- packets.h 2000/01/19 16:33:21 1.60 +++ packets.h 2000/02/19 01:52:00 @@ -14,4 +14,9 @@ #define FC__PACKETS_H +#ifdef HAVE_OPENTRANSPORT /* mac networking */ +#include <OpenTptInternet.h> +#include <OpenTransport.h> +#endif + #include "map.h" #include "player.h" @@ -753,8 +758,25 @@ }; +/*the ifedf-else-endif manuver could be avoided with the typedef pair in gui_main_g.h +The typedef pair should go somewhere else, but where? The best place would +be a new common code/header pair caled net.c/h. It's purpose would be for all networking +comon code, ex: opening sockets, closing sockets, init/destruct network conection, +read a socket, write a socket, scan opened sockets, et cetra. + +Alternativly, you could have each implmentation create a file called something like +*_net_com.c. (ex posix_net_com.c or ot_net_com.c) that implments the function definitions +described in net_com.h. This file would include the interface code that the client uses +In either case, you would probably need something the the typedef pair I refered to. +Andy Black, Mac port manager*/ struct connection { - int sock, used; +#ifdef HAVE_OPENTRANSPORT /* network protocol selector */ + TEndpointInfo info; + EndpointRef sock; +#else + int sock; +#endif + int used; int first_packet; /* check byte order on first packet */ int byte_swap; /* connection uses non-network byte order */ Index: timing.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/timing.c,v retrieving revision 1.2 diff -u -2 -r1.2 timing.c --- timing.c 2000/01/22 17:00:28 1.2 +++ timing.c 2000/02/19 01:53:14 @@ -45,4 +45,7 @@ #endif +#ifdef GENERATING_MAC +#include <ansi_prefix.mac.h> /*needed in time.h*/ +#endif #include <time.h> #include <assert.h> Index: civserver.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v retrieving revision 1.143 diff -u -2 -r1.143 civserver.c --- civserver.c 2000/02/02 17:06:19 1.143 +++ civserver.c 2000/02/19 01:54:28 @@ -20,4 +20,7 @@ #include <string.h> #include <assert.h> +#ifdef GENERATING_MAC +#include <ansi_prefix.mac.h> /*needed in time.h*/ +#endif #include <time.h> Index: mapgen.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v retrieving revision 1.51 diff -u -2 -r1.51 mapgen.c --- mapgen.c 2000/01/31 17:04:36 1.51 +++ mapgen.c 2000/02/19 01:55:07 @@ -19,4 +19,7 @@ #include <string.h> #include <assert.h> +#ifdef GENERATING_MAC +#include <ansi_prefix.mac.h> /*needed in time.h*/ +#endif #include <time.h> Index: meta.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/meta.c,v retrieving revision 1.27 diff -u -2 -r1.27 meta.c --- meta.c 2000/01/05 18:02:30 1.27 +++ meta.c 2000/02/19 02:08:16 @@ -184,6 +184,9 @@ serv_addr.fHost=hinfo.addrs[0]; bad = ((serv_addr.fHost == 0) || (err1 != 0)); - } else + } else { + freelog(LOG_NORMAL, _("Error opening OpenTransport (Id: %n)"), + err1); bad=true; + } #else in_size = sizeof(inet_addr(servername)); Index: sernet.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v retrieving revision 1.31 diff -u -2 -r1.31 sernet.c --- sernet.c 2000/01/02 11:32:16 1.31 +++ sernet.c 2000/02/19 02:08:48 @@ -18,4 +18,7 @@ #include <stdlib.h> #include <string.h> +#ifdef GENERATING_MAC +#include <ansi_prefix.mac.h> /*needed in time.h*/ +#endif #include <time.h> #include <errno.h> @@ -57,4 +60,8 @@ #include <arpa/inet.h> #endif +#ifdef HAVE_OPENTRANSPORT +#include <OpenTransport.h> +#include <OpenTptInternet.h> +#endif #include "log.h" @@ -73,7 +80,8 @@ struct connection connections[MAX_NUM_CONNECTIONS]; -#ifdef GENERATING_MAC /* mac network globals */ +#ifdef HAVE_OPENTRANSPORT /* mac network globals */ TEndpointInfo serv_info; EndpointRef serv_ep; +EndpointRef sock; #else static int sock; @@ -82,9 +90,18 @@ extern int force_end_of_sniff; +#ifdef HAVE_OPENTRANSPORT /* mac async notifier */ +pascal void NotifierRoutine(void* contextPtr, OTEventCode code, + OTResult result, void* cookie); +#endif /*****************************************************************************/ void close_connection(struct connection *pconn) { +#ifdef HAVE_OPENTRANSPORT + OTUnbind(pconn->sock); + OTCloseProvider(pconn->sock); +#else close(pconn->sock); +#endif pconn->used=0; pconn->access_level=ALLOW_NONE; @@ -101,5 +118,10 @@ } } +#ifdef HAVE_OPENTRANSPORT + OTUnbind(sock); + OTCloseProvider(sock); +#else close(sock); +#endif } @@ -116,22 +138,28 @@ functions. That is, other functions should not need to do so. --dwp *****************************************************************************/ +/* It looks like this only needs to do is handle stdin, force sniff, +end of turn timeout on the mac. The reason is I'm fiddleing with Async +conections. The bigest problem appears to be an operating system restriction +on not allocating (fc_maloc?) memory during interupt time. Does any one know +if the action handlers have this problem--AWB?*/ int sniff_packets(void) { int i; + static int year; + static time_t time_at_turn_end; +#ifndef HAVE_OPENTRANSPORT int max_desc; fd_set readfs; struct timeval tv; - static time_t time_at_turn_end; - static int year; +#endif #ifdef SOCKET_ZERO_ISNT_STDIN char buf[BUF_SIZE+1]; char *bufptr = buf; #endif - if(year!=game.year) { time_at_turn_end = time(NULL) + game.timeout; if (server_state == RUN_GAME_STATE) year=game.year; } - + while(1) { con_prompt_on(); /* accepting new input */ @@ -143,6 +171,6 @@ } +#ifndef HAVE_OPENTRANSPORT tv.tv_sec=1; tv.tv_usec=0; - MY_FD_ZERO(&readfs); FD_SET(0, &readfs); @@ -166,4 +194,5 @@ return 0; } +#endif #ifdef SOCKET_ZERO_ISNT_STDIN if (feof(stdin)) @@ -172,11 +201,13 @@ } +#ifndef HAVE_OPENTRANSPORT if(FD_ISSET(sock, &readfs)) { /* new players connects */ freelog(LOG_VERBOSE, "got new connection"); if(server_accept_connection(sock)==-1) freelog(LOG_NORMAL, "failed accepting connection"); - } + } else +#endif #ifndef SOCKET_ZERO_ISNT_STDIN - else if(FD_ISSET(0, &readfs)) { /* input from server operator */ + if(FD_ISSET(0, &readfs)) { /* input from server operator */ int didget; char buf[BUF_SIZE+1]; @@ -191,5 +222,5 @@ } #else - else if(!feof(stdin)) { /* input from server operator */ + if(!feof(stdin)) { /* input from server operator */ /* fetch chars until \n or run out of space in buffer */ while ((*bufptr=fgetc(stdin)) != EOF) { @@ -205,4 +236,5 @@ } #endif +#ifndef HAVE_OPENTRANSPORT else { /* input from a player */ for(i=0; i<MAX_NUM_CONNECTIONS; i++) @@ -222,5 +254,13 @@ } break; + for(i=0; i<MAX_NUM_CONNECTIONS; i++) { + if(connections[i].used) { /* if the conection is in use look at it*/ + FD_SET(connections[i].sock, &readfs); + } + max_desc=MAX(connections[i].sock, max_desc); + } + con_prompt_off(); /* output doesn't generate a new prompt */ } +#endif con_prompt_off(); @@ -326,8 +366,38 @@ void init_connections(void) { +#ifdef HAVE_OPENTRANSPORT + OSStatus err; +#endif int i; for(i=0; i<MAX_NUM_CONNECTIONS; i++) { connections[i].used=0; connections[i].buffer.ndata=0; +#ifdef HAVE_OPENTRANSPORT + OTAsyncOpenEndpoint(OTCreateConfiguration(kUDPName), 0, &connections[i].info, NotifierRoutine, &connections[i]); +#endif } } + +/* +OSStatus OTAsyncOpenEndpoint(OTCreateConfiguration(kUDPName), 0, TEndpointInfo* info, NotifierRoutine, void* contextPtr) +*/ + +pascal void NotifierRoutine(void* contextPtr, OTEventCode code, + OTResult result, void* cookie) +{ + struct connection *conn=contextPtr;/*contextPtr=&connections[i]*/ + switch(code) + { + case T_CONNECT: + OTRcvConnect(conn->sock, NULL); + break; + case T_DISCONNECT: + case T_DATA: + case T_REPLY: + case T_REQUEST: + case T_LISTEN: + break; + default: + break; + } +} \ No newline at end of file
|