This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-libzt/src/bindings/java/ZeroTierFileDescriptorSet.java

56 lines
1.0 KiB
Java
Raw Normal View History

2021-04-29 19:51:07 -07:00
/*
* Copyright (c)2013-2021 ZeroTier, Inc.
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file in the project's root directory.
*
* Change Date: 2026-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2.0 of the Apache License.
*/
/****/
package com.zerotier.sdk;
/**
* This class provides an fdset-like behavior to ZeroTierSocket
*/
class ZeroTierFileDescriptorSet {
byte[] fds_bits = new byte[1024];
/**
* Clear bit
*/
public void CLR(int fd)
{
fds_bits[fd] = 0x00;
}
/**
* Check if bit is set
*/
public boolean ISSET(int fd)
{
return fds_bits[fd] == 0x01;
}
/**
* Set bit
*/
public void SET(int fd)
{
fds_bits[fd] = 0x01;
}
/**
* Zero-out all bits
*/
public void ZERO()
{
for (int i = 0; i < 1024; i++) {
fds_bits[i] = 0x00;
}
}
}