• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2009, 2022 IBM Corp.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v2.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  *    https://www.eclipse.org/legal/epl-2.0/
10  * and the Eclipse Distribution License is available at
11  *   http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  *    Ian Craggs - initial API and implementation and/or initial documentation
15  *    Ian Craggs - add SSL support
16  *******************************************************************************/
17 
18 /**
19  * @file
20  * \brief functions which apply to client structures
21  * */
22 
23 
24 #include "Clients.h"
25 
26 #include <string.h>
27 #include <stdio.h>
28 
29 
30 /**
31  * List callback function for comparing clients by clientid
32  * @param a first integer value
33  * @param b second integer value
34  * @return boolean indicating whether a and b are equal
35  */
clientIDCompare(void * a,void * b)36 int clientIDCompare(void* a, void* b)
37 {
38 	Clients* client = (Clients*)a;
39 	/*printf("comparing clientdIDs %s with %s\n", client->clientID, (char*)b);*/
40 	return strcmp(client->clientID, (char*)b) == 0;
41 }
42 
43 
44 /**
45  * List callback function for comparing clients by socket
46  * @param a first integer value
47  * @param b second integer value
48  * @return boolean indicating whether a and b are equal
49  */
clientSocketCompare(void * a,void * b)50 int clientSocketCompare(void* a, void* b)
51 {
52 	Clients* client = (Clients*)a;
53 	/*printf("comparing %d with %d\n", (char*)a, (char*)b); */
54 	return client->net.socket == *(SOCKET*)b;
55 }
56