Skip to content

Commit da06b22

Browse files
author
kasemir
committed
PVA Server: Provide ClientInfo
1 parent 7176afa commit da06b22

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

core/pva/src/main/java/org/epics/pva/server/PVAServer.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static org.epics.pva.PVASettings.logger;
1111

1212
import java.net.InetSocketAddress;
13+
import java.util.Collection;
1314
import java.util.concurrent.ConcurrentHashMap;
1415
import java.util.concurrent.ConcurrentHashMap.KeySetView;
1516
import java.util.concurrent.ForkJoinPool;
@@ -161,6 +162,26 @@ ServerPV getPV(final int sid)
161162
return pv_by_sid.get(sid);
162163
}
163164

165+
166+
/** Info about a client to the PVA server:
167+
* Network address and authentication info
168+
*/
169+
public static record ClientInfo(InetSocketAddress address,
170+
ServerAuth authentication)
171+
{
172+
}
173+
174+
/** Get information about clients to this PVA server
175+
* @return {@link ClientInfo}s
176+
*/
177+
public Collection<ClientInfo> getClientInfos()
178+
{
179+
return tcp_handlers.stream()
180+
.map(tcp -> new ClientInfo(tcp.getRemoteAddress(),
181+
tcp.getAuth()))
182+
.toList();
183+
}
184+
164185
/** Special address used in TCP search reply to indicate "Use this TCP connection" */
165186
private static final InetSocketAddress USE_THIS_TCP_CONNECTION = new InetSocketAddress(0);
166187

core/pva/src/main/java/org/epics/pva/server/ServerAuth.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019-2023 Oak Ridge National Laboratory.
2+
* Copyright (c) 2019-2025 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -20,7 +20,7 @@
2020
* @author Kay Kasemir
2121
*/
2222
@SuppressWarnings("nls")
23-
abstract class ServerAuth
23+
public abstract class ServerAuth
2424
{
2525
/** @param channel Channel for which to check write access
2626
* @return Does client have write access?
@@ -62,7 +62,7 @@ public static ServerAuth decode(final ServerTCPHandler tcp, final ByteBuffer buf
6262

6363
if (PVAAuth.X509.equals(auth))
6464
return new X509ServerAuth(tls_info);
65-
65+
6666
return Anonymous;
6767
}
6868

0 commit comments

Comments
 (0)