sl@0: /* apps/s_socket.c - socket-related functions used by s_client and s_server */ sl@0: /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) sl@0: * All rights reserved. sl@0: * sl@0: * This package is an SSL implementation written sl@0: * by Eric Young (eay@cryptsoft.com). sl@0: * The implementation was written so as to conform with Netscapes SSL. sl@0: * sl@0: * This library is free for commercial and non-commercial use as long as sl@0: * the following conditions are aheared to. The following conditions sl@0: * apply to all code found in this distribution, be it the RC4, RSA, sl@0: * lhash, DES, etc., code; not just the SSL code. The SSL documentation sl@0: * included with this distribution is covered by the same copyright terms sl@0: * except that the holder is Tim Hudson (tjh@cryptsoft.com). sl@0: * sl@0: * Copyright remains Eric Young's, and as such any Copyright notices in sl@0: * the code are not to be removed. sl@0: * If this package is used in a product, Eric Young should be given attribution sl@0: * as the author of the parts of the library used. sl@0: * This can be in the form of a textual message at program startup or sl@0: * in documentation (online or textual) provided with the package. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * "This product includes cryptographic software written by sl@0: * Eric Young (eay@cryptsoft.com)" sl@0: * The word 'cryptographic' can be left out if the rouines from the library sl@0: * being used are not cryptographic related :-). sl@0: * 4. If you include any Windows specific code (or a derivative thereof) from sl@0: * the apps directory (application code) you must include an acknowledgement: sl@0: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * The licence and distribution terms for any publically available version or sl@0: * derivative of this code cannot be changed. i.e. this code cannot simply be sl@0: * copied and put under another distribution licence sl@0: * [including the GNU Public Licence.] sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: /* With IPv6, it looks like Digital has mixed up the proper order of sl@0: recursive header file inclusion, resulting in the compiler complaining sl@0: that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which sl@0: is needed to have fileno() declared correctly... So let's define u_int */ sl@0: #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT) sl@0: #define __U_INT sl@0: typedef unsigned int u_int; sl@0: #endif sl@0: sl@0: #define USE_SOCKETS sl@0: #define NON_MAIN sl@0: #include "apps.h" sl@0: #undef USE_SOCKETS sl@0: #undef NON_MAIN sl@0: #include "s_apps.h" sl@0: #include sl@0: sl@0: #ifdef FLAT_INC sl@0: #include "e_os.h" sl@0: #else sl@0: #ifndef SYMBIAN sl@0: #include "../e_os.h" sl@0: #else sl@0: #include "e_os.h" sl@0: #endif sl@0: #endif sl@0: sl@0: sl@0: #ifndef OPENSSL_NO_SOCK sl@0: sl@0: #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK) sl@0: #include "netdb.h" sl@0: #endif sl@0: sl@0: static struct hostent *GetHostByName(char *name); sl@0: #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) sl@0: static void ssl_sock_cleanup(void); sl@0: #endif sl@0: static int ssl_sock_init(void); sl@0: static int init_client_ip(int *sock,unsigned char ip[4], int port, int type); sl@0: static int init_server(int *sock, int port, int type); sl@0: static int init_server_long(int *sock, int port,char *ip, int type); sl@0: static int do_accept(int acc_sock, int *sock, char **host); sl@0: static int host_ip(char *str, unsigned char ip[4]); sl@0: sl@0: #ifdef OPENSSL_SYS_WIN16 sl@0: #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ sl@0: #else sl@0: #define SOCKET_PROTOCOL IPPROTO_TCP sl@0: #endif sl@0: sl@0: #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) sl@0: static int wsa_init_done=0; sl@0: #endif sl@0: sl@0: #ifdef OPENSSL_SYS_WINDOWS sl@0: static struct WSAData wsa_state; sl@0: static int wsa_init_done=0; sl@0: sl@0: #ifdef OPENSSL_SYS_WIN16 sl@0: static HWND topWnd=0; sl@0: static FARPROC lpTopWndProc=NULL; sl@0: static FARPROC lpTopHookProc=NULL; sl@0: extern HINSTANCE _hInstance; /* nice global CRT provides */ sl@0: sl@0: sl@0: static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam, sl@0: LPARAM lParam) sl@0: { sl@0: if (hwnd == topWnd) sl@0: { sl@0: switch(message) sl@0: { sl@0: case WM_DESTROY: sl@0: case WM_CLOSE: sl@0: SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc); sl@0: ssl_sock_cleanup(); sl@0: break; sl@0: } sl@0: } sl@0: return CallWindowProc(lpTopWndProc,hwnd,message,wParam,lParam); sl@0: } sl@0: sl@0: static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam) sl@0: { sl@0: topWnd=hwnd; sl@0: return(FALSE); sl@0: } sl@0: sl@0: #endif /* OPENSSL_SYS_WIN32 */ sl@0: #endif /* OPENSSL_SYS_WINDOWS */ sl@0: sl@0: #ifdef OPENSSL_SYS_WINDOWS sl@0: static void ssl_sock_cleanup(void) sl@0: { sl@0: if (wsa_init_done) sl@0: { sl@0: wsa_init_done=0; sl@0: #ifndef OPENSSL_SYS_WINCE sl@0: WSACancelBlockingCall(); sl@0: #endif sl@0: WSACleanup(); sl@0: } sl@0: } sl@0: #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) sl@0: static void sock_cleanup(void) sl@0: { sl@0: if (wsa_init_done) sl@0: { sl@0: wsa_init_done=0; sl@0: WSACleanup(); sl@0: } sl@0: } sl@0: #endif sl@0: sl@0: static int ssl_sock_init(void) sl@0: { sl@0: #ifdef WATT32 sl@0: extern int _watt_do_exit; sl@0: _watt_do_exit = 0; sl@0: if (sock_init()) sl@0: return (0); sl@0: #elif defined(OPENSSL_SYS_WINDOWS) sl@0: if (!wsa_init_done) sl@0: { sl@0: int err; sl@0: sl@0: #ifdef SIGINT sl@0: // signal(SIGINT,(void (*)(int))ssl_sock_cleanup); sl@0: #endif sl@0: wsa_init_done=1; sl@0: memset(&wsa_state,0,sizeof(wsa_state)); sl@0: if (WSAStartup(0x0101,&wsa_state)!=0) sl@0: { sl@0: err=WSAGetLastError(); sl@0: BIO_printf(bio_err,"unable to start WINSOCK, error code=%d\n",err); sl@0: return(0); sl@0: } sl@0: sl@0: #ifdef OPENSSL_SYS_WIN16 sl@0: EnumTaskWindows(GetCurrentTask(),enumproc,0L); sl@0: lpTopWndProc=(FARPROC)GetWindowLong(topWnd,GWL_WNDPROC); sl@0: lpTopHookProc=MakeProcInstance((FARPROC)topHookProc,_hInstance); sl@0: sl@0: SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc); sl@0: #endif /* OPENSSL_SYS_WIN16 */ sl@0: } sl@0: #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) sl@0: WORD wVerReq; sl@0: WSADATA wsaData; sl@0: int err; sl@0: sl@0: if (!wsa_init_done) sl@0: { sl@0: sl@0: # ifdef SIGINT sl@0: // signal(SIGINT,(void (*)(int))sock_cleanup); sl@0: # endif sl@0: sl@0: wsa_init_done=1; sl@0: wVerReq = MAKEWORD( 2, 0 ); sl@0: err = WSAStartup(wVerReq,&wsaData); sl@0: if (err != 0) sl@0: { sl@0: BIO_printf(bio_err,"unable to start WINSOCK2, error code=%d\n",err); sl@0: return(0); sl@0: } sl@0: } sl@0: #endif /* OPENSSL_SYS_WINDOWS */ sl@0: return(1); sl@0: } sl@0: sl@0: int init_client(int *sock, char *host, int port, int type) sl@0: { sl@0: unsigned char ip[4]; sl@0: short p=0; sl@0: sl@0: if (!host_ip(host,&(ip[0]))) sl@0: { sl@0: return(0); sl@0: } sl@0: if (p != 0) port=p; sl@0: return(init_client_ip(sock,ip,port,type)); sl@0: } sl@0: sl@0: static int init_client_ip(int *sock, unsigned char ip[4], int port, int type) sl@0: { sl@0: unsigned long addr; sl@0: struct sockaddr_in them; sl@0: int s,i; sl@0: sl@0: if (!ssl_sock_init()) return(0); sl@0: sl@0: memset((char *)&them,0,sizeof(them)); sl@0: them.sin_family=AF_INET; sl@0: them.sin_port=htons((unsigned short)port); sl@0: addr=(unsigned long) sl@0: ((unsigned long)ip[0]<<24L)| sl@0: ((unsigned long)ip[1]<<16L)| sl@0: ((unsigned long)ip[2]<< 8L)| sl@0: ((unsigned long)ip[3]); sl@0: them.sin_addr.s_addr=htonl(addr); sl@0: sl@0: if (type == SOCK_STREAM) sl@0: s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); sl@0: else /* ( type == SOCK_DGRAM) */ sl@0: s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); sl@0: sl@0: if (s == INVALID_SOCKET) { perror("socket"); return(0); } sl@0: sl@0: #ifndef OPENSSL_SYS_MPE sl@0: if (type == SOCK_STREAM) sl@0: { sl@0: i=0; sl@0: i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); sl@0: if (i < 0) { perror("keepalive"); return(0); } sl@0: } sl@0: #endif sl@0: sl@0: if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1) sl@0: { close(s); perror("connect"); return(0); } sl@0: *sock=s; sl@0: return(1); sl@0: } sl@0: sl@0: int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context) sl@0: { sl@0: int sock; sl@0: char *name = NULL; sl@0: int accept_socket; sl@0: int i; sl@0: sl@0: if (!init_server(&accept_socket,port,type)) return(0); sl@0: sl@0: if (ret != NULL) sl@0: { sl@0: *ret=accept_socket; sl@0: /* return(1);*/ sl@0: } sl@0: for (;;) sl@0: { sl@0: if (type==SOCK_STREAM) sl@0: { sl@0: if (do_accept(accept_socket,&sock,&name) == 0) sl@0: { sl@0: SHUTDOWN(accept_socket); sl@0: return(0); sl@0: } sl@0: } sl@0: else sl@0: sock = accept_socket; sl@0: i=(*cb)(name,sock, context); sl@0: if (name != NULL) OPENSSL_free(name); sl@0: if (type==SOCK_STREAM) sl@0: SHUTDOWN2(sock); sl@0: if (i < 0) sl@0: { sl@0: SHUTDOWN2(accept_socket); sl@0: return(i); sl@0: } sl@0: } sl@0: } sl@0: sl@0: static int init_server_long(int *sock, int port, char *ip, int type) sl@0: { sl@0: int ret=0; sl@0: struct sockaddr_in server; sl@0: int s= -1,i; sl@0: sl@0: if (!ssl_sock_init()) return(0); sl@0: sl@0: memset((char *)&server,0,sizeof(server)); sl@0: server.sin_family=AF_INET; sl@0: server.sin_port=htons((unsigned short)port); sl@0: if (ip == NULL) sl@0: server.sin_addr.s_addr=INADDR_ANY; sl@0: else sl@0: /* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */ sl@0: #ifndef BIT_FIELD_LIMITS sl@0: memcpy(&server.sin_addr.s_addr,ip,4); sl@0: #else sl@0: memcpy(&server.sin_addr,ip,4); sl@0: #endif sl@0: sl@0: if (type == SOCK_STREAM) sl@0: s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); sl@0: else /* type == SOCK_DGRAM */ sl@0: s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP); sl@0: sl@0: if (s == INVALID_SOCKET) goto err; sl@0: #if defined SOL_SOCKET && defined SO_REUSEADDR sl@0: { sl@0: int j = 1; sl@0: setsockopt(s, SOL_SOCKET, SO_REUSEADDR, sl@0: (void *) &j, sizeof j); sl@0: } sl@0: #endif sl@0: if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1) sl@0: { sl@0: #ifndef OPENSSL_SYS_WINDOWS sl@0: perror("bind"); sl@0: #endif sl@0: goto err; sl@0: } sl@0: /* Make it 128 for linux */ sl@0: if (type==SOCK_STREAM && listen(s,128) == -1) goto err; sl@0: i=0; sl@0: *sock=s; sl@0: ret=1; sl@0: err: sl@0: if ((ret == 0) && (s != -1)) sl@0: { sl@0: SHUTDOWN(s); sl@0: } sl@0: return(ret); sl@0: } sl@0: sl@0: static int init_server(int *sock, int port, int type) sl@0: { sl@0: return(init_server_long(sock, port, NULL, type)); sl@0: } sl@0: sl@0: static int do_accept(int acc_sock, int *sock, char **host) sl@0: { sl@0: int ret,i; sl@0: struct hostent *h1,*h2; sl@0: static struct sockaddr_in from; sl@0: int len; sl@0: /* struct linger ling; */ sl@0: sl@0: if (!ssl_sock_init()) return(0); sl@0: sl@0: #ifndef OPENSSL_SYS_WINDOWS sl@0: redoit: sl@0: #endif sl@0: sl@0: memset((char *)&from,0,sizeof(from)); sl@0: len=sizeof(from); sl@0: /* Note: under VMS with SOCKETSHR the fourth parameter is currently sl@0: * of type (int *) whereas under other systems it is (void *) if sl@0: * you don't have a cast it will choke the compiler: if you do sl@0: * have a cast then you can either go for (int *) or (void *). sl@0: */ sl@0: ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len); sl@0: if (ret == INVALID_SOCKET) sl@0: { sl@0: #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) sl@0: i=WSAGetLastError(); sl@0: BIO_printf(bio_err,"accept error %d\n",i); sl@0: #else sl@0: if (errno == EINTR) sl@0: { sl@0: /*check_timeout(); */ sl@0: goto redoit; sl@0: } sl@0: fprintf(stderr,"errno=%d ",errno); sl@0: // perror("accept"); sl@0: sl@0: #endif sl@0: return(0); sl@0: } sl@0: sl@0: /* sl@0: ling.l_onoff=1; sl@0: ling.l_linger=0; sl@0: i=setsockopt(ret,SOL_SOCKET,SO_LINGER,(char *)&ling,sizeof(ling)); sl@0: if (i < 0) { perror("linger"); return(0); } sl@0: i=0; sl@0: i=setsockopt(ret,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); sl@0: if (i < 0) { perror("keepalive"); return(0); } sl@0: */ sl@0: sl@0: if (host == NULL) goto end; sl@0: #ifndef BIT_FIELD_LIMITS sl@0: /* I should use WSAAsyncGetHostByName() under windows */ sl@0: h1=gethostbyaddr((char *)&from.sin_addr.s_addr, sl@0: sizeof(from.sin_addr.s_addr),AF_INET); sl@0: #else sl@0: h1=gethostbyaddr((char *)&from.sin_addr, sl@0: sizeof(struct in_addr),AF_INET); sl@0: #endif sl@0: if (h1 == NULL) sl@0: { sl@0: BIO_printf(bio_err,"bad gethostbyaddr\n"); sl@0: *host=NULL; sl@0: /* return(0); */ sl@0: } sl@0: else sl@0: { sl@0: if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL) sl@0: { sl@0: perror("OPENSSL_malloc"); sl@0: return(0); sl@0: } sl@0: BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1); sl@0: sl@0: h2=GetHostByName(*host); sl@0: if (h2 == NULL) sl@0: { sl@0: BIO_printf(bio_err,"gethostbyname failure\n"); sl@0: return(0); sl@0: } sl@0: i=0; sl@0: if (h2->h_addrtype != AF_INET) sl@0: { sl@0: BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); sl@0: return(0); sl@0: } sl@0: } sl@0: end: sl@0: *sock=ret; sl@0: return(1); sl@0: } sl@0: sl@0: int extract_host_port(char *str, char **host_ptr, unsigned char *ip, sl@0: short *port_ptr) sl@0: { sl@0: char *h,*p; sl@0: sl@0: h=str; sl@0: p=strchr(str,':'); sl@0: if (p == NULL) sl@0: { sl@0: BIO_printf(bio_err,"no port defined\n"); sl@0: return(0); sl@0: } sl@0: *(p++)='\0'; sl@0: sl@0: if ((ip != NULL) && !host_ip(str,ip)) sl@0: goto err; sl@0: if (host_ptr != NULL) *host_ptr=h; sl@0: sl@0: if (!extract_port(p,port_ptr)) sl@0: goto err; sl@0: return(1); sl@0: err: sl@0: return(0); sl@0: } sl@0: sl@0: static int host_ip(char *str, unsigned char ip[4]) sl@0: { sl@0: unsigned int in[4]; sl@0: int i; sl@0: sl@0: if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4) sl@0: { sl@0: for (i=0; i<4; i++) sl@0: if (in[i] > 255) sl@0: { sl@0: BIO_printf(bio_err,"invalid IP address\n"); sl@0: goto err; sl@0: } sl@0: ip[0]=in[0]; sl@0: ip[1]=in[1]; sl@0: ip[2]=in[2]; sl@0: ip[3]=in[3]; sl@0: } sl@0: else sl@0: { /* do a gethostbyname */ sl@0: struct hostent *he; sl@0: sl@0: if (!ssl_sock_init()) return(0); sl@0: sl@0: he=GetHostByName(str); sl@0: if (he == NULL) sl@0: { sl@0: BIO_printf(bio_err,"gethostbyname failure\n"); sl@0: goto err; sl@0: } sl@0: /* cast to short because of win16 winsock definition */ sl@0: if ((short)he->h_addrtype != AF_INET) sl@0: { sl@0: BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); sl@0: return(0); sl@0: } sl@0: ip[0]=he->h_addr_list[0][0]; sl@0: ip[1]=he->h_addr_list[0][1]; sl@0: ip[2]=he->h_addr_list[0][2]; sl@0: ip[3]=he->h_addr_list[0][3]; sl@0: } sl@0: return(1); sl@0: err: sl@0: return(0); sl@0: } sl@0: sl@0: int extract_port(char *str, short *port_ptr) sl@0: { sl@0: int i; sl@0: struct servent *s; sl@0: sl@0: i=atoi(str); sl@0: if (i != 0) sl@0: *port_ptr=(unsigned short)i; sl@0: else sl@0: { sl@0: s=getservbyname(str,"tcp"); sl@0: if (s == NULL) sl@0: { sl@0: BIO_printf(bio_err,"getservbyname failure for %s\n",str); sl@0: return(0); sl@0: } sl@0: *port_ptr=ntohs((unsigned short)s->s_port); sl@0: } sl@0: return(1); sl@0: } sl@0: sl@0: #define GHBN_NUM 4 sl@0: static struct ghbn_cache_st sl@0: { sl@0: char name[128]; sl@0: struct hostent ent; sl@0: unsigned long order; sl@0: } ghbn_cache[GHBN_NUM]; sl@0: sl@0: static unsigned long ghbn_hits=0L; sl@0: static unsigned long ghbn_miss=0L; sl@0: sl@0: static struct hostent *GetHostByName(char *name) sl@0: { sl@0: struct hostent *ret; sl@0: int i,lowi=0; sl@0: unsigned long low= (unsigned long)-1; sl@0: sl@0: for (i=0; i ghbn_cache[i].order) sl@0: { sl@0: low=ghbn_cache[i].order; sl@0: lowi=i; sl@0: } sl@0: if (ghbn_cache[i].order > 0) sl@0: { sl@0: if (strncmp(name,ghbn_cache[i].name,128) == 0) sl@0: break; sl@0: } sl@0: } sl@0: if (i == GHBN_NUM) /* no hit*/ sl@0: { sl@0: ghbn_miss++; sl@0: ret=gethostbyname(name); sl@0: if (ret == NULL) return(NULL); sl@0: /* else add to cache */ sl@0: if(strlen(name) < sizeof ghbn_cache[0].name) sl@0: { sl@0: strcpy(ghbn_cache[lowi].name,name); sl@0: memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent)); sl@0: ghbn_cache[lowi].order=ghbn_miss+ghbn_hits; sl@0: } sl@0: return(ret); sl@0: } sl@0: else sl@0: { sl@0: ghbn_hits++; sl@0: ret= &(ghbn_cache[i].ent); sl@0: ghbn_cache[i].order=ghbn_miss+ghbn_hits; sl@0: return(ret); sl@0: } sl@0: } sl@0: sl@0: #endif