Tabnine Logo
SessionId.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
net.i2p.data.i2cp.SessionId
constructor

Best Java code snippets using net.i2p.data.i2cp.SessionId.<init> (Showing top 20 results out of 315)

origin: i2p/i2p.i2p

/**
 * Return the SessionId for this message.
 *
 * @since 0.9.21
 */
@Override
public SessionId sessionId() {
  return _sessionId >= 0 ? new SessionId(_sessionId) : null;
}
origin: i2p/i2p.i2p

/**
 * Return the SessionId for this message.
 *
 * @since 0.9.21
 */
@Override
public SessionId sessionId() {
  return _sessionId >= 0 ? new SessionId(_sessionId) : null;
}
origin: i2p/i2p.i2p

/**
 * Return the SessionId for this message.
 *
 * @since 0.9.21
 */
@Override
public SessionId sessionId() {
  return _sessionId >= 0 ? new SessionId(_sessionId) : null;
}
origin: i2p/i2p.i2p

/**
 * Return the SessionId for this message.
 *
 * @since 0.9.21
 */
@Override
public SessionId sessionId() {
  return _sessionId >= 0 ? new SessionId(_sessionId) : null;
}
origin: i2p/i2p.i2p

  public DataStructure createStructureToRead() { return new SessionId(); }
}
origin: i2p/i2p.i2p

public DataStructure createDataStructure() throws DataFormatException {
  SessionId id = new SessionId();
  id.setSessionId(7);
  return id;
}
public DataStructure createStructureToRead() { return new SessionId(); }
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _status = (int) DataHelper.readLong(in, 1);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  SessionId id = new SessionId();
  try {
    id.readBytes(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
  setSessionId(id);
}
origin: i2p/i2p.i2p

/**
 *  Generate a new random, unused sessionId. Caller must synch on _runners.
 *  @return null on failure
 *  @since 0.9.12
 */
private SessionId locked_getNextSessionId() { 
  int max = Math.max(1, Math.min(2048, _ctx.getProperty(PROP_MAX_SESSIONS, DEFAULT_MAX_SESSIONS)));
  if (_runnerSessionIds.size() >= max) {
    _log.logAlways(Log.WARN, "Session refused, max is " + max + ", increase " + PROP_MAX_SESSIONS);
    return null;
  }
  for (int i = 0; i < 100; i++) {
    SessionId id = new SessionId(_ctx.random().nextInt(MAX_SESSION_ID + 1));
    if (_runnerSessionIds.add(id))
      return id; 
  }
  _log.logAlways(Log.WARN, "Session refused, can't find id slot");
  return null;
}
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    if (_sessionId != null)
      throw new IllegalStateException();
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    int numTunnels = (int) DataHelper.readLong(in, 1);
    for (int i = 0; i < numTunnels; i++) {
      Lease lease = new Lease();
      lease.readBytes(in);
      _endpoints.add(lease);
    }
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _sessionConfig = new SessionConfig();
    _sessionConfig.readBytes(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _reqID = DataHelper.readLong(in, 4);
    _code = (int) DataHelper.readLong(in, 1);
    if (_code == RESULT_SUCCESS)
      _dest = Destination.create(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("bad data", dfe);
  }
}
origin: i2p/i2p.i2p

/**
 * Read the body into the data structures
 *
 * @throws IOException 
 */
@Override
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
  if (type != getType())
    throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
                    + " class: " + getClass().getName() + ")");
  if (length < 0) throw new IOException("Negative payload size");
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _destination = Destination.create(in);
    _payload = new Payload();
    _payload.readBytes(in);
    _nonce = DataHelper.readLong(in, 4);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    int numTunnels = (int) DataHelper.readLong(in, 1);
    _endpoints.clear();
    for (int i = 0; i < numTunnels; i++) {
      //Hash router = new Hash();
      //router.readBytes(in);
      Hash router = Hash.create(in);
      TunnelId tunnel = new TunnelId();
      tunnel.readBytes(in);
      _endpoints.add(new TunnelEndpoint(router, tunnel));
    }
    _end = DataHelper.readDate(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

SessionId id = _sessionId;
if (id == null)
  id = new SessionId(65535);
sendMessage_unchecked(new HostLookupMessage(id, name, nonce, maxWait));
try {
origin: i2p/i2p.i2p

protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _reqID = DataHelper.readLong(in, 4);
    _timeout = DataHelper.readLong(in, 4);
    _lookupType = (int) DataHelper.readLong(in, 1);
    if (_lookupType == LOOKUP_HASH) {
      _hash = Hash.create(in);
    } else if (_lookupType == LOOKUP_HOST) {
      _host = DataHelper.readString(in);
      if (_host.length() == 0)
        throw new I2CPMessageException("bad host");
    } else {
      throw new I2CPMessageException("bad type");
    }
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("bad data", dfe);
  }
}
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    _severity = new AbuseSeverity();
    _severity.readBytes(in);
    _reason = new AbuseReason();
    _reason.readBytes(in);
    _messageId = new MessageId();
    _messageId.readBytes(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Unable to load the message data", dfe);
  }
}
origin: i2p/i2p.i2p

  SessionId id = _sessionId;
  if (id == null)
    id = new SessionId(65535);
  sendMessage_unchecked(new HostLookupMessage(id, h, nonce, maxWait));
} else {
origin: i2p/i2p.i2p

@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
  try {
    _sessionId = new SessionId();
    _sessionId.readBytes(in);
    // Revocation is unimplemented.
    // As the SPK comes before the LeaseSet, we don't know the key type.
    // We could have some sort of callback or state setting so we get the
    // expected type from the session. But for now, we just assume it's 20 bytes.
    // Clients outside router context should throw in a dummy 20 bytes.
    _signingPrivateKey = new SigningPrivateKey();
    _signingPrivateKey.readBytes(in);
    _privateKey = new PrivateKey();
    _privateKey.readBytes(in);
    _leaseSet = new LeaseSet();
    _leaseSet.readBytes(in);
  } catch (DataFormatException dfe) {
    throw new I2CPMessageException("Error reading the CreateLeaseSetMessage", dfe);
  }
}
origin: i2p/i2p.i2p

/**
 * override for testing
 * @since 0.9.11
 */
protected void handleHostLookup(HostLookupMessage message) {
  SessionId sid = message.getSessionId();
  Hash h;
  if (sid != null) {
    h = _runner.getDestHash(sid);
  } else {
    // fixup if necessary
    if (message.getReqID() >= 0)
      sid = new SessionId(65535);
    h = null;
  }
  if (h == null) {
    h = _runner.getDestHash();
    // h may still be null, an LS lookup for b32 will go out expl. tunnels
  }
  _context.jobQueue().addJob(new LookupDestJob(_context, _runner, message.getReqID(),
                         message.getTimeout(), sid,
                         message.getHash(), message.getHostname(), h));
}
net.i2p.data.i2cpSessionId<init>

Popular methods of SessionId

  • getSessionId
  • equals
  • readBytes
  • setSessionId
  • writeBytes

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ImageIO (javax.imageio)
  • JLabel (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now