2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
20 static char UNUSED id[] = "$Id: client.c,v 1.81 2005/05/17 23:18:54 alex Exp $";
43 #include "irc-write.h"
50 #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
53 LOCAL CLIENT *This_Server, *My_Clients;
54 LOCAL char GetID_Buffer[GETID_LEN];
56 LOCAL WHOWAS My_Whowas[MAX_WHOWAS];
57 LOCAL int Last_Whowas = -1;
60 LOCAL long Count PARAMS(( CLIENT_TYPE Type ));
61 LOCAL long MyCount PARAMS(( CLIENT_TYPE Type ));
63 LOCAL CLIENT *New_Client_Struct PARAMS(( void ));
64 LOCAL void Generate_MyToken PARAMS(( CLIENT *Client ));
65 LOCAL void Adjust_Counters PARAMS(( CLIENT *Client ));
67 #ifndef Client_DestroyNow
68 GLOBAL void Client_DestroyNow PARAMS((CLIENT *Client ));
72 long Max_Users = 0, My_Max_Users = 0;
80 This_Server = New_Client_Struct( );
83 Log( LOG_EMERG, "Can't allocate client structure for server! Going down." );
84 Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
88 /* Client-Struktur dieses Servers */
89 This_Server->next = NULL;
90 This_Server->type = CLIENT_SERVER;
91 This_Server->conn_id = NONE;
92 This_Server->introducer = This_Server;
93 This_Server->mytoken = 1;
94 This_Server->hops = 0;
96 gethostname( This_Server->host, CLIENT_HOST_LEN );
97 h = gethostbyname( This_Server->host );
98 if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host ));
100 Client_SetID( This_Server, Conf_ServerName );
101 Client_SetInfo( This_Server, Conf_ServerInfo );
103 My_Clients = This_Server;
105 memset( &My_Whowas, 0, sizeof( My_Whowas ));
115 if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false );
116 else Client_Destroy( This_Server, "Server going down.", NULL, false );
123 next = (CLIENT *)c->next;
127 if( cnt ) Log( LOG_INFO, "Freed %d client structure%s.", cnt, cnt == 1 ? "" : "s" );
132 Client_ThisServer( void )
135 } /* Client_ThisServer */
139 Client_NewLocal( CONN_ID Idx, char *Hostname, int Type, bool Idented )
141 /* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */
142 return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
143 } /* Client_NewLocal */
147 Client_NewRemoteServer( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented )
149 /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
150 return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
151 } /* Client_NewRemoteServer */
155 Client_NewRemoteUser( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented )
157 /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
158 return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
159 } /* Client_NewRemoteUser */
163 Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented )
167 assert( Idx >= NONE );
168 assert( Introducer != NULL );
169 assert( Hostname != NULL );
171 client = New_Client_Struct( );
172 if( ! client ) return NULL;
175 client->conn_id = Idx;
176 client->introducer = Introducer;
177 client->topserver = TopServer;
179 if( ID ) Client_SetID( client, ID );
180 if( User ) Client_SetUser( client, User, Idented );
181 if( Hostname ) Client_SetHostname( client, Hostname );
182 if( Info ) Client_SetInfo( client, Info );
184 client->token = Token;
185 if( Modes ) Client_SetModes( client, Modes );
186 if( Type == CLIENT_SERVER ) Generate_MyToken( client );
188 /* ist der User away? */
189 if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away ));
192 client->next = (POINTER *)My_Clients;
195 /* Adjust counters */
196 Adjust_Counters( client );
203 Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
205 /* Client entfernen. */
208 char msg[LINE_LEN], *txt;
210 assert( Client != NULL );
212 if( LogMsg ) txt = LogMsg;
214 if( ! txt ) txt = "Reason unknown.";
216 /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */
217 if( Client->type == CLIENT_SERVER ) snprintf( msg, sizeof( msg ), "%s: lost server %s", This_Server->id, Client->id );
223 if(( Client->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c != Client ))
225 /* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade
226 * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */
227 Client_Destroy( c, NULL, msg, false );
234 /* Wir haben den Client gefunden: entfernen */
235 if( last ) last->next = c->next;
236 else My_Clients = (CLIENT *)c->next;
238 if( c->type == CLIENT_USER )
240 if( c->conn_id != NONE )
242 /* Ein lokaler User */
243 Log( LOG_NOTICE, "User \"%s\" unregistered (connection %d): %s", Client_Mask( c ), c->conn_id, txt );
247 /* Alle andere Server informieren! */
248 if( FwdMsg ) IRC_WriteStrServersPrefix( NULL, c, "QUIT :%s", FwdMsg );
249 else IRC_WriteStrServersPrefix( NULL, c, "QUIT :" );
255 Log( LOG_DEBUG, "User \"%s\" unregistered: %s", Client_Mask( c ), txt );
259 /* Andere Server informieren, ausser denen, die "in
260 * Richtung dem liegen", auf dem der User registriert
261 * ist. Von denen haben wir das QUIT ja wohl bekommen. */
262 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :%s", FwdMsg );
263 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "QUIT :" );
267 /* Unregister client from channels */
268 Channel_Quit( c, FwdMsg ? FwdMsg : c->id );
270 /* Register client in My_Whowas structure */
271 Client_RegisterWhowas( c );
273 else if( c->type == CLIENT_SERVER )
275 if( c != This_Server )
277 if( c->conn_id != NONE ) Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
278 else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
281 /* andere Server informieren */
282 if( ! NGIRCd_SignalQuit )
284 if( FwdMsg ) IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :%s", c->id, FwdMsg );
285 else IRC_WriteStrServersPrefix( Client_NextHop( c ), c, "SQUIT %s :", c->id );
290 if( c->conn_id != NONE )
292 if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
293 else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
297 if( c->id[0] ) Log( LOG_WARNING, "Unregistered unknown client \"%s\": %s", c->id, txt );
298 else Log( LOG_WARNING, "Unregistered unknown client: %s", c->id, txt );
306 c = (CLIENT *)c->next;
308 } /* Client_Destroy */
312 Client_DestroyNow( CLIENT *Client )
314 /* Destroy client structure immediately. This function is only
315 * intended for the connection layer to remove client structures
316 * of connections that can't be established! */
320 assert( Client != NULL );
328 /* Wir haben den Client gefunden: entfernen */
329 if( last ) last->next = c->next;
330 else My_Clients = (CLIENT *)c->next;
335 c = (CLIENT *)c->next;
337 } /* Client_DestroyNow */
341 Client_SetHostname( CLIENT *Client, char *Hostname )
343 /* Hostname eines Clients setzen */
345 assert( Client != NULL );
346 assert( Hostname != NULL );
348 strlcpy( Client->host, Hostname, sizeof( Client->host ));
349 } /* Client_SetHostname */
353 Client_SetID( CLIENT *Client, char *ID )
355 /* Hostname eines Clients setzen, Hash-Wert berechnen */
357 assert( Client != NULL );
358 assert( ID != NULL );
360 strlcpy( Client->id, ID, sizeof( Client->id ));
363 Client->hash = Hash( Client->id );
368 Client_SetUser( CLIENT *Client, char *User, bool Idented )
370 /* Username eines Clients setzen */
372 assert( Client != NULL );
373 assert( User != NULL );
375 if( Idented ) strlcpy( Client->user, User, sizeof( Client->user ));
378 Client->user[0] = '~';
379 strlcpy( Client->user + 1, User, sizeof( Client->user ) - 1 );
381 } /* Client_SetUser */
385 Client_SetInfo( CLIENT *Client, char *Info )
387 /* Hostname eines Clients setzen */
389 assert( Client != NULL );
390 assert( Info != NULL );
392 strlcpy( Client->info, Info, sizeof( Client->info ));
393 } /* Client_SetInfo */
397 Client_SetModes( CLIENT *Client, char *Modes )
399 /* Modes eines Clients setzen */
401 assert( Client != NULL );
402 assert( Modes != NULL );
404 strlcpy( Client->modes, Modes, sizeof( Client->modes ));
405 } /* Client_SetModes */
409 Client_SetFlags( CLIENT *Client, char *Flags )
411 /* Flags eines Clients setzen */
413 assert( Client != NULL );
414 assert( Flags != NULL );
416 strlcpy( Client->flags, Flags, sizeof( Client->flags ));
417 } /* Client_SetFlags */
421 Client_SetPassword( CLIENT *Client, char *Pwd )
423 /* Von einem Client geliefertes Passwort */
425 assert( Client != NULL );
426 assert( Pwd != NULL );
428 strlcpy( Client->pwd, Pwd, sizeof( Client->pwd ));
429 } /* Client_SetPassword */
433 Client_SetAway( CLIENT *Client, char *Txt )
435 /* Set AWAY reason of client */
437 assert( Client != NULL );
438 assert( Txt != NULL );
440 strlcpy( Client->away, Txt, sizeof( Client->away ));
441 Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
442 } /* Client_SetAway */
446 Client_SetType( CLIENT *Client, int Type )
448 assert( Client != NULL );
450 if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
451 Adjust_Counters( Client );
452 } /* Client_SetType */
456 Client_SetHops( CLIENT *Client, int Hops )
458 assert( Client != NULL );
460 } /* Client_SetHops */
464 Client_SetToken( CLIENT *Client, int Token )
466 assert( Client != NULL );
467 Client->token = Token;
468 } /* Client_SetToken */
472 Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
474 assert( Client != NULL );
475 assert( Introducer != NULL );
476 Client->introducer = Introducer;
477 } /* Client_SetIntroducer */
481 Client_SetOperByMe( CLIENT *Client, bool OperByMe )
483 assert( Client != NULL );
484 Client->oper_by_me = OperByMe;
485 } /* Client_SetOperByMe */
489 Client_ModeAdd( CLIENT *Client, char Mode )
492 * If Client already alread had Mode, return false.
493 * If the Mode was newly set, return true.
498 assert( Client != NULL );
500 x[0] = Mode; x[1] = '\0';
501 if( ! strchr( Client->modes, x[0] ))
503 /* Client hat den Mode noch nicht -> setzen */
504 strlcat( Client->modes, x, sizeof( Client->modes ));
508 } /* Client_ModeAdd */
512 Client_ModeDel( CLIENT *Client, char Mode )
515 * If Mode was removed, return true.
516 * If Client did not have Mode, return false.
521 assert( Client != NULL );
523 x[0] = Mode; x[1] = '\0';
525 p = strchr( Client->modes, x[0] );
526 if( ! p ) return false;
528 /* Client has Mode -> delete */
535 } /* Client_ModeDel */
539 Client_GetFromConn( CONN_ID Idx )
541 /* return Client-Structure that belongs to the local Connection Idx gehoert.
542 * If none is found, return NULL.
552 if( c->conn_id == Idx ) return c;
553 c = (CLIENT *)c->next;
556 } /* Client_GetFromConn */
560 Client_Search( char *Nick )
562 /* return Client-Structure that has the corresponding Nick.
563 * If none is found, return NULL.
566 char search_id[CLIENT_ID_LEN], *ptr;
570 assert( Nick != NULL );
572 /* copy Nick and truncate hostmask if necessary */
573 strlcpy( search_id, Nick, sizeof( search_id ));
574 ptr = strchr( search_id, '!' );
575 if( ptr ) *ptr = '\0';
577 search_hash = Hash( search_id );
582 if( c->hash == search_hash )
584 /* lt. Hash-Wert: Treffer! */
585 if( strcasecmp( c->id, search_id ) == 0 ) return c;
587 c = (CLIENT *)c->next;
590 } /* Client_Search */
594 Client_GetFromToken( CLIENT *Client, int Token )
596 /* Client-Struktur, die den entsprechenden Introducer (=Client)
597 * und das gegebene Token hat, liefern. Wird keine gefunden,
598 * so wird NULL geliefert. */
602 assert( Client != NULL );
608 if(( c->type == CLIENT_SERVER ) && ( c->introducer == Client ) && ( c->token == Token )) return c;
609 c = (CLIENT *)c->next;
612 } /* Client_GetFromToken */
616 Client_Type( CLIENT *Client )
618 assert( Client != NULL );
624 Client_Conn( CLIENT *Client )
626 assert( Client != NULL );
627 return Client->conn_id;
632 Client_ID( CLIENT *Client )
634 assert( Client != NULL );
637 if( Client->type == CLIENT_USER ) assert( strlen( Client->id ) < CLIENT_NICK_LEN );
640 if( Client->id[0] ) return Client->id;
646 Client_Info( CLIENT *Client )
648 assert( Client != NULL );
654 Client_User( CLIENT *Client )
656 assert( Client != NULL );
657 if( Client->user[0] ) return Client->user;
663 Client_Hostname( CLIENT *Client )
665 assert( Client != NULL );
667 } /* Client_Hostname */
671 Client_Password( CLIENT *Client )
673 assert( Client != NULL );
675 } /* Client_Password */
679 Client_Modes( CLIENT *Client )
681 assert( Client != NULL );
682 return Client->modes;
687 Client_Flags( CLIENT *Client )
689 assert( Client != NULL );
690 return Client->flags;
695 Client_OperByMe( CLIENT *Client )
697 assert( Client != NULL );
698 return Client->oper_by_me;
699 } /* Client_OperByMe */
703 Client_Hops( CLIENT *Client )
705 assert( Client != NULL );
711 Client_Token( CLIENT *Client )
713 assert( Client != NULL );
714 return Client->token;
719 Client_MyToken( CLIENT *Client )
721 assert( Client != NULL );
722 return Client->mytoken;
723 } /* Client_MyToken */
727 Client_NextHop( CLIENT *Client )
731 assert( Client != NULL );
734 while( c->introducer && ( c->introducer != c ) && ( c->introducer != This_Server )) c = c->introducer;
736 } /* Client_NextHop */
740 Client_Mask( CLIENT *Client )
742 /* Client-"ID" liefern, wie sie z.B. fuer
743 * Prefixe benoetigt wird. */
745 assert( Client != NULL );
747 if( Client->type == CLIENT_SERVER ) return Client->id;
749 snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
755 Client_Introducer( CLIENT *Client )
757 assert( Client != NULL );
758 return Client->introducer;
759 } /* Client_Introducer */
763 Client_TopServer( CLIENT *Client )
765 assert( Client != NULL );
766 return Client->topserver;
767 } /* Client_TopServer */
771 Client_HasMode( CLIENT *Client, char Mode )
773 assert( Client != NULL );
774 return strchr( Client->modes, Mode ) != NULL;
775 } /* Client_HasMode */
779 Client_Away( CLIENT *Client )
781 /* AWAY-Text liefern */
783 assert( Client != NULL );
789 Client_CheckNick( CLIENT *Client, char *Nick )
791 /* Nick ueberpruefen */
793 assert( Client != NULL );
794 assert( Nick != NULL );
796 /* Nick ungueltig? */
797 if( ! Client_IsValidNick( Nick ))
799 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick );
803 /* Nick bereits vergeben? */
804 if( Client_Search( Nick ))
806 /* den Nick gibt es bereits */
807 IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick );
812 } /* Client_CheckNick */
816 Client_CheckID( CLIENT *Client, char *ID )
818 /* Nick ueberpruefen */
820 char str[COMMAND_LEN];
823 assert( Client != NULL );
824 assert( Client->conn_id > NONE );
825 assert( ID != NULL );
828 if( strlen( ID ) > CLIENT_ID_LEN )
830 IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID );
834 /* ID bereits vergeben? */
838 if( strcasecmp( c->id, ID ) == 0 )
840 /* die Server-ID gibt es bereits */
841 snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID );
842 if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
843 else Log( LOG_ERR, "%s (via network)!", str );
844 Conn_Close( Client->conn_id, str, str, true);
847 c = (CLIENT *)c->next;
851 } /* Client_CheckID */
857 /* Ersten Client liefern. */
864 Client_Next( CLIENT *c )
866 /* Naechsten Client liefern. Existiert keiner,
867 * so wird NULL geliefert. */
870 return (CLIENT *)c->next;
875 Client_UserCount( void )
877 return Count( CLIENT_USER );
878 } /* Client_UserCount */
882 Client_ServiceCount( void )
884 return Count( CLIENT_SERVICE );;
885 } /* Client_ServiceCount */
889 Client_ServerCount( void )
891 return Count( CLIENT_SERVER );
892 } /* Client_ServerCount */
896 Client_MyUserCount( void )
898 return MyCount( CLIENT_USER );
899 } /* Client_MyUserCount */
903 Client_MyServiceCount( void )
905 return MyCount( CLIENT_SERVICE );
906 } /* Client_MyServiceCount */
910 Client_MyServerCount( void )
919 if(( c->type == CLIENT_SERVER ) && ( c->hops == 1 )) cnt++;
920 c = (CLIENT *)c->next;
923 } /* Client_MyServerCount */
927 Client_OperCount( void )
936 if( c && ( c->type == CLIENT_USER ) && ( strchr( c->modes, 'o' ))) cnt++;
937 c = (CLIENT *)c->next;
940 } /* Client_OperCount */
944 Client_UnknownCount( void )
953 if( c && ( c->type != CLIENT_USER ) && ( c->type != CLIENT_SERVICE ) && ( c->type != CLIENT_SERVER )) cnt++;
954 c = (CLIENT *)c->next;
957 } /* Client_UnknownCount */
961 Client_MaxUserCount( void )
964 } /* Client_MaxUserCount */
968 Client_MyMaxUserCount( void )
971 } /* Client_MyMaxUserCount */
975 Client_IsValidNick( char *Nick )
977 /* Ist der Nick gueltig? */
979 char *ptr, goodchars[20];
981 assert( Nick != NULL );
983 strcpy( goodchars, ";0123456789-" );
985 if( Nick[0] == '#' ) return false;
986 if( strchr( goodchars, Nick[0] )) return false;
987 if( strlen( Nick ) >= CLIENT_NICK_LEN ) return false;
992 if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false;
993 if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return false;
998 } /* Client_IsValidNick */
1002 * Return pointer to "My_Whowas" structure.
1005 Client_GetWhowas( void )
1008 } /* Client_GetWhowas */
1011 * Return the index of the last used WHOWAS entry.
1014 Client_GetLastWhowasIndex( void )
1017 } /* Client_GetLastWhowasIndex */
1021 Count( CLIENT_TYPE Type )
1030 if( c->type == Type ) cnt++;
1031 c = (CLIENT *)c->next;
1038 MyCount( CLIENT_TYPE Type )
1047 if(( c->introducer == This_Server ) && ( c->type == Type )) cnt++;
1048 c = (CLIENT *)c->next;
1055 New_Client_Struct( void )
1057 /* Neue CLIENT-Struktur pre-initialisieren */
1061 c = (CLIENT *)malloc( sizeof( CLIENT ));
1064 Log( LOG_EMERG, "Can't allocate memory! [New_Client_Struct]" );
1068 memset( c, 0, sizeof ( CLIENT ));
1070 c->type = CLIENT_UNKNOWN;
1072 c->oper_by_me = false;
1082 Generate_MyToken( CLIENT *Client )
1091 if( c->mytoken == token )
1093 /* Das Token wurde bereits vergeben */
1098 else c = (CLIENT *)c->next;
1100 Client->mytoken = token;
1101 Log( LOG_DEBUG, "Assigned token %d to server \"%s\".", token, Client->id );
1102 } /* Generate_MyToken */
1106 Adjust_Counters( CLIENT *Client )
1110 assert( Client != NULL );
1112 if( Client->type != CLIENT_USER ) return;
1114 if( Client->conn_id != NONE )
1116 /* Local connection */
1117 count = Client_MyUserCount( );
1118 if( count > My_Max_Users ) My_Max_Users = count;
1120 count = Client_UserCount( );
1121 if( count > Max_Users ) Max_Users = count;
1122 } /* Adjust_Counters */
1126 * Register client in My_Whowas structure for further recall by WHOWAS.
1129 Client_RegisterWhowas( CLIENT *Client )
1133 assert( Client != NULL );
1135 slot = Last_Whowas + 1;
1136 if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
1139 Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
1142 My_Whowas[slot].time = time( NULL );
1143 strlcpy( My_Whowas[slot].id, Client_ID( Client ),
1144 sizeof( My_Whowas[slot].id ));
1145 strlcpy( My_Whowas[slot].user, Client_User( Client ),
1146 sizeof( My_Whowas[slot].user ));
1147 strlcpy( My_Whowas[slot].host, Client_Hostname( Client ),
1148 sizeof( My_Whowas[slot].host ));
1149 strlcpy( My_Whowas[slot].info, Client_Info( Client ),
1150 sizeof( My_Whowas[slot].info ));
1151 strlcpy( My_Whowas[slot].server, Client_ID( Client_Introducer( Client )),
1152 sizeof( My_Whowas[slot].server ));
1155 } /* Client_RegisterWhowas */