Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/pva/serverdemo
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ JAR=`echo target/core-pva*.jar`
if [ -r "$JAR" ]
then
# Echo use jar file
java -cp $JAR org.epics.pva.server.ServerDemo
java -cp $JAR org.epics.pva.server.ServerDemo "$@"
else
# Use build output
java -cp target/classes org.epics.pva.server.ServerDemo
java -cp target/classes org.epics.pva.server.ServerDemo "$@"
fi
15 changes: 12 additions & 3 deletions core/pva/src/main/java/org/epics/pva/PVASettings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019-2023 Oak Ridge National Laboratory.
* Copyright (c) 2019-2025 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -18,10 +18,19 @@
*
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class PVASettings
{
/** Common logger */
/** Common logger
*
* Usage of levels:
* <ul>
* <li>INFO - Not used?
* <li>CONFIG - Log value of configuration settings
* <li>FINE - Log Search, reply, connection, auth, put/get/monitor
* <li>FINER - Log detail of sockets, messages
* <li>FINEST - Hexdump of each packet
* </ul>
*/
public static final Logger logger = Logger.getLogger(PVASettings.class.getPackage().getName());

/** Address list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.epics.pva.common.AddressInfo;
import org.epics.pva.common.RequestEncoder;
import org.epics.pva.common.SearchRequest;
import org.epics.pva.data.Hexdump;
import org.epics.pva.data.PVAString;

/** Handler for search requests
Expand Down Expand Up @@ -65,7 +64,6 @@
*
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
class ChannelSearch
{
/** Basic search period is one second */
Expand Down Expand Up @@ -518,7 +516,7 @@ private void sendSearch(final int seq, final Collection<SearchRequest.Channel> c
try
{
logger.log(Level.FINER, () -> "Sending search to UDP " + addr + " (unicast), " +
"response addr " + response + "\n" + Hexdump.toHexdump(send_buffer));
"response addr " + response);
udp.send(send_buffer, addr);
}
catch (Exception ex)
Expand All @@ -536,7 +534,7 @@ private void sendSearch(final int seq, final Collection<SearchRequest.Channel> c
try
{
logger.log(Level.FINER, () -> "Sending search to UDP " + addr + " (broadcast/multicast), " +
"response addr " + response + "\n" + Hexdump.toHexdump(send_buffer));
"response addr " + response);
udp.send(send_buffer, addr);
}
catch (Exception ex)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019-2023 Oak Ridge National Laboratory.
* Copyright (c) 2019-2025 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -23,7 +23,6 @@
/** PVA Client authentication modes
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
abstract class ClientAuthentication
{
/** @param buffer Buffer to which client's authentication info is added
Expand All @@ -41,15 +40,15 @@ abstract class ClientAuthentication
@Override
public void encode(final ByteBuffer buffer) throws Exception
{
PVAString.encodeString(PVAAuth.X509, buffer);
PVAString.encodeString(PVAAuth.x509.name(), buffer);
// No detail because server already has name
buffer.put(PVAFieldDesc.NULL_TYPE_CODE);
}

@Override
public String toString()
{
return PVAAuth.X509;
return PVAAuth.x509.name();
}
};

Expand All @@ -60,15 +59,15 @@ public String toString()
@Override
public void encode(final ByteBuffer buffer) throws Exception
{
PVAString.encodeString(PVAAuth.ANONYMOUS, buffer);
PVAString.encodeString(PVAAuth.anonymous.name(), buffer);
// No detail because we're anonymous
buffer.put(PVAFieldDesc.NULL_TYPE_CODE);
}

@Override
public String toString()
{
return PVAAuth.ANONYMOUS;
return PVAAuth.anonymous.name();
}
};

Expand Down Expand Up @@ -102,7 +101,7 @@ private static class CAAuthentication extends ClientAuthentication
@Override
public void encode(final ByteBuffer buffer) throws Exception
{
PVAString.encodeString(PVAAuth.CA, buffer);
PVAString.encodeString(PVAAuth.ca.name(), buffer);
// Send identity detail
identity.encodeType(buffer, new BitSet());
identity.encode(buffer);
Expand All @@ -111,7 +110,7 @@ public void encode(final ByteBuffer buffer) throws Exception
@Override
public String toString()
{
return "ca(" + user + "@" + host + ")";
return PVAAuth.ca.name() + "(" + user + "@" + host + ")";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
*
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
class ClientTCPHandler extends TCPHandler
{
private static final CommandHandlers<ClientTCPHandler> handlers =
Expand Down Expand Up @@ -112,7 +111,7 @@ class ClientTCPHandler extends TCPHandler
public ClientTCPHandler(final PVAClient client, final InetSocketAddress address, final Guid guid, final boolean tls) throws Exception
{
super(true);
logger.log(Level.FINE, () -> "TCPHandler " + (tls ? "(TLS) " : "") + guid + " for " + address + " created ============================");
logger.log(Level.FINER, () -> "TCPHandler " + (tls ? "(TLS) " : "") + guid + " for " + address + " created ============================");
this.server_address = address;
this.tls = tls;
this.client = client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
/** Sends and receives search replies, monitors beacons
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
class ClientUDPHandler extends UDPHandler
{
@FunctionalInterface
Expand Down Expand Up @@ -122,7 +121,7 @@ public ClientUDPHandler(final BeaconHandler beacon_handler,
ipV6Msg = "";
}
String logMsg = String.format("Awaiting search replies on UDP %s%s and beacons on %s", udp_localaddr4, ipV6Msg, Network.getLocalAddress(udp_beacon));
logger.log(Level.FINE, logMsg);
logger.log(Level.CONFIG, logMsg);
}

/** @param target Address to which message will be sent
Expand All @@ -135,6 +134,7 @@ InetSocketAddress getResponseAddress(final AddressInfo target)

public void send(final ByteBuffer buffer, final AddressInfo info) throws Exception
{
logger.log(Level.FINEST, () -> "Sending UDP to " + info.getAddress() + "\n" + Hexdump.toHexdump(buffer));
// synchronized (udp_search)?
// Not necessary based on Javadoc for send(),
// but in case we set the multicast IF & TTL
Expand Down
13 changes: 6 additions & 7 deletions core/pva/src/main/java/org/epics/pva/client/PVAClientMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class PVAClientMain
{
private static double seconds = 5.0;
Expand Down Expand Up @@ -100,8 +99,8 @@ private static void info(final List<String> names) throws Exception
final PVAChannel pv = iter.next();
if (pv.getState() == ClientChannelState.CONNECTED)
{
PVASettings.logger.log(Level.INFO, "Server X509 Name: " + pv.getTCP().getServerX509Name());
PVASettings.logger.log(Level.INFO, "Client X509 Name: " + pv.getTCP().getClientX509Name());
PVASettings.logger.log(Level.FINE, "Server X509 Name: " + pv.getTCP().getServerX509Name());
PVASettings.logger.log(Level.FINE, "Client X509 Name: " + pv.getTCP().getClientX509Name());

final PVAData data = pv.info(request).get(timeout_ms, TimeUnit.MILLISECONDS);
System.out.println(pv.getName() + " = " + data.formatType());
Expand Down Expand Up @@ -145,8 +144,8 @@ private static void get(final List<String> names) throws Exception
final PVAChannel pv = iter.next();
if (pv.getState() == ClientChannelState.CONNECTED)
{
PVASettings.logger.log(Level.INFO, "Server X509 Name: " + pv.getTCP().getServerX509Name());
PVASettings.logger.log(Level.INFO, "Client X509 Name: " + pv.getTCP().getClientX509Name());
PVASettings.logger.log(Level.FINE, "Server X509 Name: " + pv.getTCP().getServerX509Name());
PVASettings.logger.log(Level.FINE, "Client X509 Name: " + pv.getTCP().getClientX509Name());

final PVAData data = pv.read(request).get(timeout_ms, TimeUnit.MILLISECONDS);
System.out.println(pv.getName() + " = " + data);
Expand Down Expand Up @@ -191,8 +190,8 @@ private static void monitor(final List<String> names) throws Exception
{
try
{
PVASettings.logger.log(Level.INFO, "Server X509 Name: " + ch.getTCP().getServerX509Name());
PVASettings.logger.log(Level.INFO, "Client X509 Name: " + ch.getTCP().getClientX509Name());
PVASettings.logger.log(Level.FINE, "Server X509 Name: " + ch.getTCP().getServerX509Name());
PVASettings.logger.log(Level.FINE, "Client X509 Name: " + ch.getTCP().getClientX509Name());
ch.subscribe(request, listener);
}
catch (Exception ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
/** Handle a server's VALIDATION request
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
class ValidationHandler implements CommandHandler<ClientTCPHandler>
{
@Override
Expand Down Expand Up @@ -52,9 +51,9 @@ public void handleCommand(final ClientTCPHandler tcp, final ByteBuffer buffer) t
// Support "x509" or "ca" authorization, fall back to any-no-mouse
final ClientAuthentication authentication;
// Even if server suggests x509, check that we have a certificate with name
if (tcp.getClientX509Name() != null && auth.contains(PVAAuth.X509))
if (tcp.getClientX509Name() != null && auth.contains(PVAAuth.x509.name()))
authentication = ClientAuthentication.X509;
else if (auth.contains(PVAAuth.CA))
else if (auth.contains(PVAAuth.ca.name()))
authentication = ClientAuthentication.CA;
else
authentication = ClientAuthentication.Anonymous;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright (c) 2025 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/

package org.epics.pva.common;

/** Listener to certificate status updates
* @author Kay Kasemir
*/
public interface CertificateStatusListener
{
/** @param update Certificate status update */
public void handleCertificateStatusUpdate(CertificateStatusMonitor.CertificateStatus update);
}
Loading