Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ndn/fw

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndn/fw - npm Package Compare versions

Comparing version 0.0.20200606 to 0.0.20200909

lib/face_browser.js

69

lib/face.d.ts
import { Name } from "@ndn/packet";
import TypedEmitter from "typed-emitter";
import type { ForwarderImpl } from "./forwarder";
import { CancelInterest, L3Pkt, RejectInterest } from "./reqres";
import type { Forwarder, ForwarderImpl } from "./forwarder";
import type { FwPacket } from "./packet";
interface Events {

@@ -9,8 +9,6 @@ /** Emitted upon face closing. */

}
declare type TransformFunc = (iterable: AsyncIterable<Face.Txable>) => AsyncIterable<Face.Rxable>;
declare const FaceImpl_base: new () => TypedEmitter<Events>;
export declare class FaceImpl extends FaceImpl_base {
readonly fw: ForwarderImpl;
readonly inner: Face.Base;
readonly attributes: Face.Attributes;
readonly attributes: FwFace.Attributes;
private readonly routes;

@@ -22,3 +20,3 @@ private readonly announcements;

txQueueLength: number;
constructor(fw: ForwarderImpl, inner: Face.Base, attributes: Face.Attributes);
constructor(fw: ForwarderImpl, rxtx: FwFace.RxTx | FwFace.RxTxTransform, attributes: FwFace.Attributes);
/** Shutdown the face. */

@@ -28,5 +26,5 @@ close(): void;

/** Add a route toward the face. */
addRoute(name: Name, announcement?: Face.RouteAnnouncement): void;
addRoute(name: Name, announcement?: FwFace.RouteAnnouncement): void;
/** Remove a route toward the face. */
removeRoute(name: Name, announcement?: Face.RouteAnnouncement): void;
removeRoute(name: Name, announcement?: FwFace.RouteAnnouncement): void;
/** Add a prefix announcement associated with the face. */

@@ -37,5 +35,3 @@ addAnnouncement(name: Name): void;

/** Transmit a packet on the face. */
send(pkt: Face.Txable): void;
/** Convert base RX/TX to a TransformFunc. */
private getTransform;
send(pkt: FwPacket): void;
private rxLoop;

@@ -52,8 +48,11 @@ private txLoop;

/** A socket or network interface associated with forwarding plane. */
export interface Face extends Pick<FaceImpl, "fw" | "attributes" | "close" | "toString" | "addRoute" | "removeRoute" | "addAnnouncement" | "removeAnnouncement" | Exclude<keyof TypedEmitter<Events>, "emit">> {
export interface FwFace extends Pick<FaceImpl, "attributes" | "close" | "toString" | "addRoute" | "removeRoute" | "addAnnouncement" | "removeAnnouncement" | Exclude<keyof TypedEmitter<Events>, "emit">> {
readonly fw: Forwarder;
readonly running: boolean;
readonly txQueueLength: number;
}
export declare namespace Face {
interface Attributes extends Record<string, any> {
export declare namespace FwFace {
export interface Attributes extends Record<string, any> {
/** Short string to identify the face. */
describe?: string;
/** Whether face is local. Default is false. */

@@ -64,35 +63,19 @@ local?: boolean;

}
type RouteAnnouncement = boolean | number | Name;
/** Item that can be received on face. */
type Rxable = L3Pkt | CancelInterest;
/** Item that can be transmitted on face, when extendedTx is enabled. */
type Txable = L3Pkt | RejectInterest;
/** Underlying face RX/TX that can only transmit encodable packets. */
interface RxTxBasic {
/** Receive packets by forwarder. */
rx: AsyncIterable<Rxable>;
/** Transmit packets from forwarder. */
tx: (iterable: AsyncIterable<L3Pkt>) => void;
export type RouteAnnouncement = boolean | number | Name;
interface RxTxBase {
readonly attributes?: Attributes;
}
/** Underlying face RX/TX that can transmit all Txable items. */
interface RxTxExtended {
extendedTx: true;
/** Receive packets by forwarder. */
rx: AsyncIterable<Rxable>;
/** Transmit packets from forwarder. */
tx: (iterable: AsyncIterable<Txable>) => void;
export interface RxTx extends RxTxBase {
rx: AsyncIterable<FwPacket>;
tx: (iterable: AsyncIterable<FwPacket>) => void;
}
/** Underlying face RX/TX implemented as a transform function. */
interface RxTxTransform {
transform: TransformFunc;
export interface RxTxTransform extends RxTxBase {
/**
* The transform function takes an iterable of packets sent by the forwarder,
* and returns an iterable of packets received by the forwarder.
*/
transform: (iterable: AsyncIterable<FwPacket>) => AsyncIterable<FwPacket>;
}
/** Underlying face RX/TX module. */
type RxTx = RxTxBasic | RxTxExtended | RxTxTransform;
/** Underlying face. */
type Base = RxTx & {
readonly attributes?: Attributes;
/** Return short string to identify this face. */
toString?: () => string;
};
export {};
}
export {};
import { Data, Interest, Nack, Name } from "@ndn/packet";
import TypedEmitter from "typed-emitter";
import { Face, FaceImpl } from "./face";
import { FaceImpl, FwFace } from "./face";
import { Fib } from "./fib";
import type { FwPacket } from "./packet";
import { Pit } from "./pit";

@@ -9,9 +10,9 @@ import { Readvertise } from "./readvertise";

/** Emitted before adding face. */
faceadd: (face: Face) => void;
faceadd: (face: FwFace) => void;
/** Emitted after removing face. */
facerm: (face: Face) => void;
facerm: (face: FwFace) => void;
/** Emitted before adding prefix to face. */
prefixadd: (face: Face, prefix: Name) => void;
prefixadd: (face: FwFace, prefix: Name) => void;
/** Emitted after removing prefix from face. */
prefixrm: (face: Face, prefix: Name) => void;
prefixrm: (face: FwFace, prefix: Name) => void;
/** Emitted before advertising prefix. */

@@ -22,5 +23,5 @@ annadd: (announcement: Name) => void;

/** Emitted after packet arrival. */
pktrx: (face: Face, pkt: Face.Rxable) => void;
pktrx: (face: FwFace, pkt: FwPacket) => void;
/** Emitted before packet transmission. */
pkttx: (face: Face, pkt: Face.Txable) => void;
pkttx: (face: FwFace, pkt: FwPacket) => void;
}

@@ -36,15 +37,15 @@ declare const ForwarderImpl_base: new () => TypedEmitter<Events>;

/** Add a face to the forwarding plane. */
addFace(face: Face.Base, attributes?: Face.Attributes): Face;
addFace(face: FwFace.RxTx | FwFace.RxTxTransform, attributes?: FwFace.Attributes): FwFace;
/** Process incoming Interest. */
processInterest(face: FaceImpl, interest: Interest): void;
processInterest(face: FaceImpl, pkt: FwPacket<Interest>): void;
/** Process incoming cancel Interest request. */
cancelInterest(face: FaceImpl, interest: Interest): void;
cancelInterest(face: FaceImpl, pkt: FwPacket<Interest>): void;
/** Process incoming Data. */
processData(face: FaceImpl, data: Data): void;
processData(face: FaceImpl, pkt: FwPacket<Data>): void;
/** Process incoming Nack. */
processNack(face: FaceImpl, nack: Nack): void;
processNack(face: FaceImpl, nack: FwPacket<Nack>): void;
}
/** Forwarding plane. */
export interface Forwarder extends Pick<ForwarderImpl, "addFace" | Exclude<keyof TypedEmitter<Events>, "emit">> {
readonly faces: Set<Face>;
readonly faces: Set<FwFace>;
readonly pit: Pick<Pit, "dataNoTokenMatch">;

@@ -51,0 +52,0 @@ }

@@ -1,3 +0,3 @@

export * from "./reqres";
export type { Face as FwFace } from "./face";
export * from "./packet";
export { FwFace } from "./face";
export { Forwarder } from "./forwarder";

@@ -4,0 +4,0 @@ export { ReadvertiseDestination } from "./readvertise";

@@ -5,2 +5,3 @@ /// <reference types="node" />

import type { FaceImpl } from "./face";
import { FwPacket } from "./packet";
/** Downstream of pending Interest. */

@@ -27,3 +28,3 @@ interface PitDn {

dnRecords: DefaultMap<FaceImpl, PitDn>;
/** Last expiration time among downstreams. */
/** Last expiration time among downstream. */
lastExpire: number;

@@ -34,3 +35,3 @@ /** Entry expiration timer; should match this.lastExpire. */

/** Record Interest from downstream. */
receiveInterest(face: FaceImpl, interest: Interest): void;
receiveInterest(face: FaceImpl, { l3: interest, token }: FwPacket<Interest>): void;
/** Record Interest cancellation from downstream. */

@@ -65,5 +66,5 @@ cancelInterest(face: FaceImpl): void;

/** Find or insert entry. */
lookup(interest: Interest): PitEntry;
lookup(interest: FwPacket<Interest>): PitEntry;
/** Find entry, disallow insertion. */
lookup(interest: Interest, canInsert: false): PitEntry | undefined;
lookup(interest: FwPacket<Interest>, canInsert: false): PitEntry | undefined;
/**

@@ -73,5 +74,5 @@ * Satisfy pending Interests with incoming Data.

*/
satisfy(face: FaceImpl, data: Data): Promise<boolean>;
satisfy(face: FaceImpl, { l3: data, token }: FwPacket<Data>): Promise<boolean>;
private findPotentialMatches;
}
export {};

@@ -1,2 +0,3 @@

import { Face } from "./face";
import { FwFace } from "./face";
import type { FwPacket } from "./packet";
/**

@@ -10,15 +11,17 @@ * Create a secondary face by tapping on a primary face.

*/
export declare class TapFace {
readonly face: Face;
get attributes(): Face.Attributes;
readonly extendedTx = true;
readonly rx: import("it-pushable").Pushable<Face.Rxable>;
export declare class TapFace implements FwFace.RxTx {
readonly face: FwFace;
get attributes(): {
describe: string;
local?: boolean | undefined;
advertiseFrom?: boolean | undefined;
};
readonly rx: import("it-pushable").Pushable<FwPacket<import("@ndn/packet").Interest | import("@ndn/packet").Data | import("@ndn/packet").Nack>>;
private readonly ctrl;
constructor(face: Face);
tx(iterable: AsyncIterable<Face.Txable>): Promise<void>;
toString(): string;
constructor(face: FwFace);
tx: (iterable: AsyncIterable<FwPacket>) => Promise<void>;
}
export declare namespace TapFace {
/** Create a new Forwarder and add a TapFace. */
function create(face: Face): Face;
function create(face: FwFace): FwFace;
}

@@ -24,2 +24,3 @@ import log from "loglevel";

private pkttx;
private pkt;
}

@@ -26,0 +27,0 @@ export declare namespace Tracer {

{
"name": "@ndn/fw",
"version": "0.0.20200606",
"version": "0.0.20200909",
"description": "NDNts: Forwarding Plane",

@@ -15,3 +15,4 @@ "keywords": [

"type": "module",
"main": "lib/mod.js",
"main": "lib/mod_node.js",
"module": "lib/mod_browser.js",
"sideEffects": false,

@@ -26,16 +27,17 @@ "homepage": "https://yoursunny.com/p/NDNts/",

"@types/retry": "^0.12.0",
"@ndn/packet": "0.0.20200606",
"@ndn/tlv": "0.0.20200606",
"hirestime": "^6.0.1",
"@ndn/packet": "0.0.20200909",
"@ndn/tlv": "0.0.20200909",
"hirestime": "^6.1.0",
"it-pushable": "^1.4.0",
"loglevel": "^1.6.8",
"loglevel": "^1.7.0",
"minimalistic-assert": "^1.0.1",
"mnemonist": "^0.36.1",
"mnemonist": "^0.38.0",
"p-defer": "^3.0.0",
"p-fifo": "^1.0.0",
"retry": "^0.12.0",
"streaming-iterables": "^4.1.2",
"tslib": "*",
"typed-emitter": "^1.2.0"
}
"streaming-iterables": "^5.0.2",
"tslib": "^2.0.1",
"typed-emitter": "^1.3.0"
},
"types": "lib/mod.d.ts"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc