本文整理汇总了Java中com.digitalpetri.opcua.stack.core.channel.ChannelConfig类的典型用法代码示例。如果您正苦于以下问题:Java ChannelConfig类的具体用法?Java ChannelConfig怎么用?Java ChannelConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChannelConfig类属于com.digitalpetri.opcua.stack.core.channel包,在下文中一共展示了ChannelConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAsymmetricSecurityParameters
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@DataProvider
public Object[][] getAsymmetricSecurityParameters() {
return new Object[][]{
{SecurityPolicy.None, MessageSecurityMode.None, 128},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.Basic256, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.None, MessageSecurityMode.None, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
};
}
示例2: UaTcpStackServerConfigImpl
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public UaTcpStackServerConfigImpl(String serverName,
LocalizedText applicationName,
String applicationUri,
String productUri,
ChannelConfig channelConfig,
boolean strictEndpointUrlsEnabled,
CertificateManager certificateManager,
CertificateValidator certificateValidator,
ExecutorService executor,
List<UserTokenPolicy> userTokenPolicies,
List<SignedSoftwareCertificate> softwareCertificates) {
this.serverName = serverName;
this.applicationName = applicationName;
this.applicationUri = applicationUri;
this.productUri = productUri;
this.channelConfig = channelConfig;
this.strictEndpointUrlsEnabled = strictEndpointUrlsEnabled;
this.certificateManager = certificateManager;
this.certificateValidator = certificateValidator;
this.executor = executor;
this.userTokenPolicies = userTokenPolicies;
this.softwareCertificates = softwareCertificates;
}
示例3: UaTcpStackClientConfigImpl
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public UaTcpStackClientConfigImpl(@Nullable String endpointUrl,
@Nullable EndpointDescription endpoint,
@Nullable KeyPair keyPair,
@Nullable X509Certificate certificate,
LocalizedText applicationName,
String applicationUri,
String productUri,
ChannelConfig channelConfig,
UInteger channelLifetime,
ExecutorService executor,
NioEventLoopGroup eventLoop,
HashedWheelTimer wheelTimer,
boolean secureChannelReauthenticationEnabled) {
this.endpointUrl = endpointUrl;
this.endpoint = endpoint;
this.keyPair = keyPair;
this.certificate = certificate;
this.applicationName = applicationName;
this.applicationUri = applicationUri;
this.productUri = productUri;
this.channelConfig = channelConfig;
this.channelLifetime = channelLifetime;
this.executor = executor;
this.eventLoop = eventLoop;
this.wheelTimer = wheelTimer;
this.secureChannelReauthenticationEnabled = secureChannelReauthenticationEnabled;
}
示例4: getSymmetricSecurityParameters
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@DataProvider
public Object[][] getSymmetricSecurityParameters() {
return new Object[][]{
{SecurityPolicy.None, MessageSecurityMode.None, 128},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.Basic256, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign, 128},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt, 128},
{SecurityPolicy.None, MessageSecurityMode.None, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_CHUNK_SIZE},
{SecurityPolicy.None, MessageSecurityMode.None, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic128Rsa15, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.Sign, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
{SecurityPolicy.Basic256Sha256, MessageSecurityMode.SignAndEncrypt, ChannelConfig.DEFAULT_MAX_MESSAGE_SIZE},
};
}
示例5: setChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@Override
public OpcUaServerConfigBuilder setChannelConfig(ChannelConfig channelConfig) {
super.setChannelConfig(channelConfig);
return this;
}
示例6: getChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@Override
public ChannelConfig getChannelConfig() {
return stackServerConfig.getChannelConfig();
}
示例7: getChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public ChannelConfig getChannelConfig() {
return stackServer.getChannelConfig();
}
示例8: BinaryDecoder
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public BinaryDecoder() {
this(ChannelConfig.DEFAULT_MAX_ARRAY_LENGTH, ChannelConfig.DEFAULT_MAX_STRING_LENGTH);
}
示例9: BinaryEncoder
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public BinaryEncoder() {
this(ChannelConfig.DEFAULT_MAX_ARRAY_LENGTH, ChannelConfig.DEFAULT_MAX_STRING_LENGTH);
}
示例10: onAcknowledge
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
private void onAcknowledge(ChannelHandlerContext ctx, ByteBuf buffer) {
if (helloTimeout != null && !helloTimeout.cancel()) {
helloTimeout = null;
handshakeFuture.completeExceptionally(
new UaException(StatusCodes.Bad_Timeout,
"timed out waiting for acknowledge"));
ctx.close();
return;
}
logger.debug("Received Acknowledge message on channel={}.", ctx.channel());
buffer.skipBytes(3 + 1 + 4); // Skip messageType, chunkType, and messageSize
AcknowledgeMessage acknowledge = AcknowledgeMessage.decode(buffer);
long remoteProtocolVersion = acknowledge.getProtocolVersion();
long remoteReceiveBufferSize = acknowledge.getReceiveBufferSize();
long remoteSendBufferSize = acknowledge.getSendBufferSize();
long remoteMaxMessageSize = acknowledge.getMaxMessageSize();
long remoteMaxChunkCount = acknowledge.getMaxChunkCount();
if (PROTOCOL_VERSION > remoteProtocolVersion) {
logger.warn("Client protocol version ({}) does not match server protocol version ({}).",
PROTOCOL_VERSION, remoteProtocolVersion);
}
ChannelConfig config = client.getChannelConfig();
/* Our receive buffer size is determined by the remote send buffer size. */
long localReceiveBufferSize = Math.min(remoteSendBufferSize, config.getMaxChunkSize());
/* Our send buffer size is determined by the remote receive buffer size. */
long localSendBufferSize = Math.min(remoteReceiveBufferSize, config.getMaxChunkSize());
/* Max message size the remote can send us; not influenced by remote configuration. */
long localMaxMessageSize = config.getMaxMessageSize();
/* Max chunk count the remote can send us; not influenced by remote configuration. */
long localMaxChunkCount = config.getMaxChunkCount();
ChannelParameters parameters = new ChannelParameters(
Ints.saturatedCast(localMaxMessageSize),
Ints.saturatedCast(localReceiveBufferSize),
Ints.saturatedCast(localSendBufferSize),
Ints.saturatedCast(localMaxChunkCount),
Ints.saturatedCast(remoteMaxMessageSize),
Ints.saturatedCast(remoteReceiveBufferSize),
Ints.saturatedCast(remoteSendBufferSize),
Ints.saturatedCast(remoteMaxChunkCount)
);
ctx.channel().attr(KEY_AWAITING_HANDSHAKE).set(awaitingHandshake);
ctx.executor().execute(() -> {
int maxArrayLength = client.getChannelConfig().getMaxArrayLength();
int maxStringLength = client.getChannelConfig().getMaxStringLength();
SerializationQueue serializationQueue = new SerializationQueue(
client.getConfig().getExecutor(),
parameters,
maxArrayLength,
maxStringLength
);
UaTcpClientMessageHandler handler = new UaTcpClientMessageHandler(
client,
secureChannel,
serializationQueue,
handshakeFuture
);
ctx.pipeline().addLast(handler);
});
}
示例11: setChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public UaTcpStackClientConfigBuilder setChannelConfig(ChannelConfig channelConfig) {
this.channelConfig = channelConfig;
return this;
}
示例12: getChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@Override
public ChannelConfig getChannelConfig() {
return channelConfig;
}
示例13: getChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
@Override
public ChannelConfig getChannelConfig() {
return config.getChannelConfig();
}
示例14: onHello
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
private void onHello(ChannelHandlerContext ctx, ByteBuf buffer) throws UaException {
logger.debug("[remote={}] Received Hello message.", ctx.channel().remoteAddress());
HelloMessage hello = TcpMessageDecoder.decodeHello(buffer);
UaTcpStackServer server = socketServer.getServer(hello.getEndpointUrl());
if (server == null) {
throw new UaException(StatusCodes.Bad_TcpEndpointUrlInvalid,
"unrecognized endpoint url: " + hello.getEndpointUrl());
}
ctx.channel().attr(ENDPOINT_URL_KEY).set(hello.getEndpointUrl());
long remoteProtocolVersion = hello.getProtocolVersion();
long remoteReceiveBufferSize = hello.getReceiveBufferSize();
long remoteSendBufferSize = hello.getSendBufferSize();
long remoteMaxMessageSize = hello.getMaxMessageSize();
long remoteMaxChunkCount = hello.getMaxChunkCount();
if (remoteProtocolVersion < PROTOCOL_VERSION) {
throw new UaException(StatusCodes.Bad_ProtocolVersionUnsupported,
"unsupported protocol version: " + remoteProtocolVersion);
}
ChannelConfig config = server.getChannelConfig();
/* Our receive buffer size is determined by the remote send buffer size. */
long localReceiveBufferSize = Math.min(remoteSendBufferSize, config.getMaxChunkSize());
/* Our send buffer size is determined by the remote receive buffer size. */
long localSendBufferSize = Math.min(remoteReceiveBufferSize, config.getMaxChunkSize());
/* Max chunk count the remote can send us; not influenced by remote configuration. */
long localMaxChunkCount = config.getMaxChunkCount();
/* Max message size the remote can send us. Determined by our max chunk count and receive buffer size. */
long localMaxMessageSize = Math.min(localReceiveBufferSize * localMaxChunkCount, config.getMaxMessageSize());
ChannelParameters parameters = new ChannelParameters(
Ints.saturatedCast(localMaxMessageSize),
Ints.saturatedCast(localReceiveBufferSize),
Ints.saturatedCast(localSendBufferSize),
Ints.saturatedCast(localMaxChunkCount),
Ints.saturatedCast(remoteMaxMessageSize),
Ints.saturatedCast(remoteReceiveBufferSize),
Ints.saturatedCast(remoteSendBufferSize),
Ints.saturatedCast(remoteMaxChunkCount)
);
int maxArrayLength = config.getMaxArrayLength();
int maxStringLength = config.getMaxStringLength();
SerializationQueue serializationQueue = new SerializationQueue(
server.getConfig().getExecutor(),
parameters,
maxArrayLength,
maxStringLength
);
ctx.pipeline().addLast(new UaTcpServerAsymmetricHandler(server, serializationQueue));
ctx.pipeline().remove(this);
logger.debug("[remote={}] Removed HelloHandler, added AsymmetricHandler.", ctx.channel().remoteAddress());
AcknowledgeMessage acknowledge = new AcknowledgeMessage(
PROTOCOL_VERSION,
localReceiveBufferSize,
localSendBufferSize,
localMaxMessageSize,
localMaxChunkCount
);
ByteBuf messageBuffer = TcpMessageEncoder.encode(acknowledge);
ctx.executor().execute(() -> ctx.writeAndFlush(messageBuffer));
logger.debug("[remote={}] Sent Acknowledge message.", ctx.channel().remoteAddress());
}
示例15: setChannelConfig
import com.digitalpetri.opcua.stack.core.channel.ChannelConfig; //导入依赖的package包/类
public UaTcpStackServerConfigBuilder setChannelConfig(ChannelConfig channelConfig) {
this.channelConfig = channelConfig;
return this;
}