/****************************************************************************** * Copyright © 2013-2016 The Nxt Core Developers. * * * * See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at * * the top-level directory of this distribution for the individual copyright * * holder information and the developer policies on copyright and licensing. * * * * Unless otherwise agreed in a custom licensing agreement, no part of the * * Nxt software, including this file, may be copied, modified, propagated, * * or distributed except according to the terms contained in the LICENSE.txt * * file. * * * * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ package nxt.peer; import org.json.simple.JSONObject; import org.json.simple.JSONStreamAware; public interface Peer extends Comparable<Peer> { enum State { NON_CONNECTED, CONNECTED, DISCONNECTED } enum Service { HALLMARK(1), // Hallmarked node PRUNABLE(2), // Stores expired prunable messages API(4), // Provides open API access over http API_SSL(8); // Provides open API access over https private final long code; // Service code - must be a power of 2 Service(int code) { this.code = code; } public long getCode() { return code; } } boolean providesService(Service service); boolean providesServices(long services); String getHost(); int getPort(); String getAnnouncedAddress(); State getState(); String getVersion(); String getApplication(); String getPlatform(); String getSoftware(); int getApiPort(); int getApiSSLPort(); Hallmark getHallmark(); int getWeight(); boolean shareAddress(); boolean isBlacklisted(); void blacklist(Exception cause); void blacklist(String cause); void unBlacklist(); void deactivate(); void remove(); long getDownloadedVolume(); long getUploadedVolume(); int getLastUpdated(); int getLastConnectAttempt(); boolean isInbound(); boolean isInboundWebSocket(); boolean isOutboundWebSocket(); String getBlacklistingCause(); JSONObject send(JSONStreamAware request); JSONObject send(JSONStreamAware request, int maxResponseSize); }