You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2014/04/13 03:08:07 UTC
[25/53] [abbrv] [partial] CB-6440 create - use shelljs rather than
custom copy function
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/README.md
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/README.md b/blackberry10/node_modules/net-ping/README.md
deleted file mode 100644
index 7f2d197..0000000
--- a/blackberry10/node_modules/net-ping/README.md
+++ /dev/null
@@ -1,473 +0,0 @@
-
-# net-ping - [homepage][homepage]
-
-This module implements ICMP Echo (ping) support for [Node.js][nodejs].
-
-This module is installed using [node package manager (npm)][npm]:
-
- npm install net-ping
-
-It is loaded using the `require()` function:
-
- var ping = require ("net-ping");
-
-A ping session can then be created to ping or trace route to many hosts:
-
- var session = ping.createSession ();
-
- session.pingHost (target, function (error, target) {
- if (error)
- console.log (target + ": " + error.toString ());
- else
- console.log (target + ": Alive");
- });
-
-[homepage]: http://re-tool.org "Homepage"
-[nodejs]: http://nodejs.org "Node.js"
-[npm]: https://npmjs.org/ "npm"
-
-# Network Protocol Support
-
-This module supports IPv4 using the ICMP, and IPv6 using the ICMPv6.
-
-# Error Handling
-
-Each request exposed by this module requires one or more mandatory callback
-functions. Callback functions are typically provided an `error` argument.
-
-All errors are sub-classes of the `Error` class. For timed out errors the
-error passed to the callback function will be an instance of the
-`ping.RequestTimedOutError` class, with the exposed `message` attribute set
-to `Request timed out`.
-
-This makes it easy to determine if a host responded, a time out occurred, or
-whether an error response was received:
-
- session.pingHost ("1.2.3.4", function (error, target) {
- if (error)
- if (error instanceof ping.RequestTimedOutError)
- console.log (target + ": Not alive");
- else
- console.log (target + ": " + error.toString ());
- else
- console.log (target + ": Alive");
- });
-
-In addition to the the `ping.RequestTimedOutError` class, the following errors
-are also exported by this module to wrap ICMP error responses:
-
- * `DestinationUnreachableError`
- * `PacketTooBigError`
- * `ParameterProblemError`
- * `RedirectReceivedError`
- * `SourceQuenchError`
- * `TimeExceededError`
-
-These errors are typically reported by hosts other than the intended target.
-In all cases each class exposes a `source` attribute which will specify the
-host who reported the error (which could be the intended target). This will
-also be included in the errors `message` attribute, i.e.:
-
- $ sudo node example/ping-ttl.js 1 192.168.2.10 192.168.2.20 192.168.2.30
- 192.168.2.10: Alive
- 192.168.2.20: TimeExceededError: Time exceeded (source=192.168.1.1)
- 192.168.2.30: Not alive
-
-The `Session` class will emit an `error` event for any other error not
-directly associated with a request. This is typically an instance of the
-`Error` class with the errors `message` attribute specifying the reason.
-
-# Packet Size
-
-By default ICMP echo request packets sent by this module are 16 bytes in size.
-Some implementations cannot cope with such small ICMP echo requests. For
-example, some implementations will return an ICMP echo reply, but will include
-an incorrect ICMP checksum.
-
-This module exposes a `packetSize` option to the `createSession()` method which
-specifies how big ICMP echo request packets should be:
-
- var session = ping.createSession ({packetSize: 64});
-
-# Round Trip Times
-
-Some callbacks used by methods exposed by this module provide two instances of
-the JavaScript `Date` class specifying when the first ping was sent for a
-request, and when a request completed.
-
-These parameters are typically named `sent` and `rcvd`, and are provided to
-help round trip time calculation.
-
-A request can complete in one of two ways. In the first, a ping response is
-received and `rcvd - sent` will yield the round trip time for the request in
-milliseconds.
-
-In the second, no ping response is received resulting in a request time out.
-In this case `rcvd - sent` will yield the total time spent waiting for each
-retry to timeout if any. For example, if the `retries` option to the
-`createSession()` method was specified as `2` and `timeout` as `2000` then
-`rcvd - sent` will yield more than `6000` milliseconds.
-
-Although this module provides instances of the `Date` class to help round trip
-time calculation the dates and times represented in each instance should not be
-considered 100% accurate.
-
-Environmental conditions can affect when a date and time is actually
-calculated, e.g. garbage collection introducing a delay or the receipt of many
-packets at once. There are also a number of functions through which received
-packets must pass, which can also introduce a slight variable delay.
-
-Throughout development experience has shown that, in general the smaller the
-round trip time the less accurate it will be - but the information is still
-useful nonetheless.
-
-# Constants
-
-The following sections describe constants exported and used by this module.
-
-## ping.NetworkProtocol
-
-This object contains constants which can be used for the `networkProtocol`
-option to the `createSession()` function exposed by this module. This option
-specifies the IP protocol version to use when creating the raw socket.
-
-The following constants are defined in this object:
-
- * `IPv4` - IPv4 protocol
- * `IPv6` - IPv6 protocol
-
-# Using This Module
-
-The `Session` class is used to issue ping and trace route requests to many
-hosts. This module exports the `createSession()` function which is used to
-create instances of the `Session` class.
-
-## ping.createSession ([options])
-
-The `createSession()` function instantiates and returns an instance of the
-`Session` class:
-
- // Default options
- var options = {
- networkProtocol: ping.NetworkProtocol.IPv4,
- packetSize: 16,
- retries: 1,
- sessionId: (process.pid % 65535),
- timeout: 2000,
- ttl: 128
- };
-
- var session = ping.createSession (options);
-
-The optional `options` parameter is an object, and can contain the following
-items:
-
- * `networkProtocol` - Either the constant `ping.NetworkProtocol.IPv4` or the
- constant `ping.NetworkProtocol.IPv6`, defaults to the constant
- `ping.NetworkProtocol.IPv4`
- * `packetSize` - How many bytes each ICMP echo request packet should be,
- defaults to `16`, if the value specified is less that `12` then the value
- `12` will be used (8 bytes are required for the ICMP packet itself, then 4
- bytes are required to encode a unique session ID in the request and response
- packets)
- * `retries` - Number of times to re-send a ping requests, defaults to `1`
- * `sessionId` - A unique ID used to identify request and response packets sent
- by this instance of the `Session` class, valid numbers are in the range of
- `1` to `65535`, defaults to the value of `process.pid % 65535`
- * `timeout` - Number of milliseconds to wait for a response before re-trying
- or failing, defaults to `2000`
- * `ttl` - Value to use for the IP header time to live field, defaults to `128`
-
-After creating the ping `Session` object an underlying raw socket will be
-created. If the underlying raw socket cannot be opened an exception with be
-thrown. The error will be an instance of the `Error` class.
-
-Seperate instances of the `Session` class must be created for IPv4 and IPv6.
-
-## session.on ("close", callback)
-
-The `close` event is emitted by the session when the underlying raw socket
-is closed.
-
-No arguments are passed to the callback.
-
-The following example prints a message to the console when the underlying raw
-socket is closed:
-
- session.on ("close", function () {
- console.log ("socket closed");
- });
-
-## session.on ("error", callback)
-
-The `error` event is emitted by the session when the underlying raw socket
-emits an error.
-
-The following arguments will be passed to the `callback` function:
-
- * `error` - An instance of the `Error` class, the exposed `message` attribute
- will contain a detailed error message.
-
-The following example prints a message to the console when an error occurs
-with the underlying raw socket, the session is then closed:
-
- session.on ("error", function (error) {
- console.log (error.toString ());
- session.close ();
- });
-
-## session.close ()
-
-The `close()` method closes the underlying raw socket, and cancels all
-outstanding requsts.
-
-The calback function for each outstanding ping requests will be called. The
-error parameter will be an instance of the `Error` class, and the `message`
-attribute set to `Socket forcibly closed`.
-
-The sessoin can be re-used simply by submitting more ping requests, a new raw
-socket will be created to serve the new ping requests. This is a way in which
-to clear outstanding requests.
-
-The following example submits a ping request and prints the target which
-successfully responded first, and then closes the session which will clear the
-other outstanding ping requests.
-
- var targets = ["1.1.1.1", "2.2.2.2", "3.3.3.3"];
-
- for (var i = 0; i < targets.length; i++) {
- session.pingHost (targets[i], function (error, target) {
- if (! error) {
- console.log (target);
- session.close ();
- }
- });
- }
-
-## session.pingHost (target, callback)
-
-The `pingHost()` method sends a ping request to a remote host.
-
-The `target` parameter is the dotted quad formatted IP address of the target
-host for IPv4 sessions, or the compressed formatted IP address of the target
-host for IPv6 sessions.
-
-The `callback` function is called once the ping requests is complete. The
-following arguments will be passed to the `callback` function:
-
- * `error` - Instance of the `Error` class or a sub-class, or `null` if no
- error occurred
- * `target` - The target parameter as specified in the request
- still be the target host and NOT the responding gateway
- * `sent` - An instance of the `Date` class specifying when the first ping
- was sent for this request (refer to the Round Trip Time section for more
- information)
- * `rcvd` - An instance of the `Date` class specifying when the request
- completed (refer to the Round Trip Time section for more information)
-
-The following example sends a ping request to a remote host:
-
- var target = "fe80::a00:27ff:fe2a:3427";
-
- session.pingHost (target, function (error, target, sent, rcvd) {
- var ms = rcvd - sent;
- if (error)
- console.log (target + ": " + error.toString ());
- else
- console.log (target + ": Alive (ms=" + ms + ")");
- });
-
-## session.traceRoute (target, ttl, feedCallback, doneCallback)
-
-The `traceRoute()` method provides similar functionality to the trace route
-utility typically provided with most networked operating systems.
-
-The `target` parameter is the dotted quad formatted IP address of the target
-host for IPv4 sessions, or the compressed formatted IP address of the target
-host for IPv6 sessions. The optional `ttl` parameter specifies the maximum
-number of hops used by the trace route and defaults to the `ttl` options
-parameter as defined by the `createSession()` method.
-
-Some hosts do not respond to ping requests when the time to live is `0`, that
-is they will not send back an time exceeded error response. Instead of
-stopping the trace route at the first time out this method will move on to the
-next hop, by increasing the time to live by 1. It will do this 2 times,
-meaning that a trace route will continue until the target host responds or at
-most 3 request time outs are experienced.
-
-Each requst is subject to the `retries` and `timeout` option parameters to the
-`createSession()` method. That is, requests will be retried per hop as per
-these parameters.
-
-This method will not call a single callback once the trace route is complete.
-Instead the `feedCallback` function will be called each time a ping response is
-received or a time out occurs. The following arguments will be passed to the
-`feedCallback` function:
-
- * `error` - Instance of the `Error` class or a sub-class, or `null` if no
- error occurred
- * `target` - The target parameter as specified in the request
- * `ttl` - The time to live used in the request which triggered this respinse
- * `sent` - An instance of the `Date` class specifying when the first ping
- was sent for this request (refer to the Round Trip Time section for more
- information)
- * `rcvd` - An instance of the `Date` class specifying when the request
- completed (refer to the Round Trip Time section for more information)
-
-Once a ping response has been received from the target, or more than three
-request timed out errors are experienced, the `doneCallback` function will be
-called. The following arguments will be passed to the `doneCallback` function:
-
- * `error` - Instance of the `Error` class or a sub-class, or `null` if no
- error occurred
- * `target` - The target parameter as specified in the request
-
-Once the `doneCallback` function has been called the request is complete and
-the `requestCallback` function will no longer be called.
-
-If the `feedCallback` function returns a true value when called the trace route
-will stop and the `doneCallback` will be called.
-
-The following example initiates a trace route to a remote host:
-
- function doneCb (error, target) {
- if (error)
- console.log (target + ": " + error.toString ());
- else
- console.log (target + ": Done");
- }
-
- function feedCb (error, target, ttl, sent, rcvd) {
- var ms = rcvd - sent;
- if (error) {
- if (error instanceof ping.TimeExceededError) {
- console.log (target + ": " + error.source + " (ttl="
- + ttl + " ms=" + ms +")");
- } else {
- console.log (target + ": " + error.toString ()
- + " (ttl=" + ttl + " ms=" + ms +")");
- }
- } else {
- console.log (target + ": " + target + " (ttl=" + ttl
- + " ms=" + ms +")");
- }
- }
-
- session.traceRoute ("192.168.10.10", 10, feedCb, doneCb);
-
-# Example Programs
-
-Example programs are included under the modules `example` directory.
-
-# Bugs & Known Issues
-
-None, yet!
-
-Bug reports should be sent to <st...@gmail.com>.
-
-# Changes
-
-## Version 1.0.0 - 03/02/2013
-
- * Initial release
-
-## Version 1.0.1 - 04/02/2013
-
- * Minor corrections to the README.md
- * Add note to README.md about error handling
- * Timed out errors are now instances of the `ping.RequestTimedOutError`
- object
-
-## Version 1.0.2 - 11/02/2013
-
- * The RequestTimedOutError class is not being exported
-
-## Version 1.1.0 - 13/02/2013
-
- * Support IPv6
-
-## Version 1.1.1 - 15/02/2013
-
- * The `ping.Session.close()` method was not undefining the sessions raw
- socket after closing
- * Return self from the `pingHost()` method to chain method calls
-
-## Version 1.1.2 - 04/03/2013
-
- * Use the `raw.Socket.pauseRecv()` and `raw.Socket.resumeRecv()` methods
- instead of closing a socket when there are no more outstanding requests
-
-## Version 1.1.3 - 07/03/2013
-
- * Sessions were limited to sending 65535 ping requests
-
-## Version 1.1.4 - 09/04/2013
-
- * Add the `packetSize` option to the `createSession()` method to specify how
- many bytes each ICMP echo request packet should be
-
-## Version 1.1.5 - 17/05/2013
-
- * Incorrectly parsing ICMP error responses resulting in responses matching
- the wrong request
- * Use a unique session ID per instance of the `Session` class to identify
- requests and responses sent by a session
- * Added the (internal) `_debugRequest()` and `_debugResponse()` methods, and
- the `_debug` option to the `createSession()` method
- * Added example programs `ping-ttl.js` and `ping6-ttl.js`
- * Use MIT license instead of GPL
-
-## Version 1.1.6 - 17/05/2013
-
- * Session IDs are now 2 bytes (previously 1 byte), and request IDs are also
- now 2 bytes (previously 3 bytes)
- * Each ICMP error response now has an associated error class (e.g. the
- `Time exceeded` response maps onto the `ping.TimeExceededError` class)
- * Call request callbacks with an error when there are no free request IDs
- because of too many outstanding requests
-
-## Version 1.1.7 - 19/05/2013
-
- * Added the `traceRoute()` method
- * Added the `ttl` option parameter to the `createSession()` method, and
- updated the example programs `ping-ttl.js` and `ping6-ttl.js` to use it
- * Response callback for `pingHost()` now includes two instances of the
- `Date` class to specify when a request was sent and a response received
-
-## Version 1.1.8 - 01/07/2013
-
- * Use `raw.Socket.createChecksum()` instead of automatic checksum generation
-
-## Version 1.1.9 - 01/07/2013
-
- * Use `raw.Socket.writeChecksum()` instead of manually rendering checksums
-
-# Roadmap
-
-Suggestions and requirements should be sent to <st...@gmail.com>.
-
-# License
-
-Copyright (c) 2013 Stephen Vickers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-# Author
-
-Stephen Vickers <st...@gmail.com>
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/index.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/index.js b/blackberry10/node_modules/net-ping/index.js
deleted file mode 100644
index 16d6ebc..0000000
--- a/blackberry10/node_modules/net-ping/index.js
+++ /dev/null
@@ -1,526 +0,0 @@
-
-var events = require ("events");
-var net = require ("net");
-var raw = require ("raw-socket");
-var util = require ("util");
-
-function _expandConstantObject (object) {
- var keys = [];
- for (key in object)
- keys.push (key);
- for (var i = 0; i < keys.length; i++)
- object[object[keys[i]]] = parseInt (keys[i]);
-}
-
-var NetworkProtocol = {
- 1: "IPv4",
- 2: "IPv6"
-};
-
-_expandConstantObject (NetworkProtocol);
-
-function DestinationUnreachableError (source) {
- this.name = "DestinationUnreachableError";
- this.message = "Destination unreachable (source=" + source + ")";
- this.source = source;
-}
-util.inherits (DestinationUnreachableError, Error);
-
-function PacketTooBigError (source) {
- this.name = "PacketTooBigError";
- this.message = "Packet too big (source=" + source + ")";
- this.source = source;
-}
-util.inherits (PacketTooBigError, Error);
-
-function ParameterProblemError (source) {
- this.name = "ParameterProblemError";
- this.message = "Parameter problem (source=" + source + ")";
- this.source = source;
-}
-util.inherits (ParameterProblemError, Error);
-
-function RedirectReceivedError (source) {
- this.name = "RedirectReceivedError";
- this.message = "Redireect received (source=" + source + ")";
- this.source = source;
-}
-util.inherits (RedirectReceivedError, Error);
-
-function RequestTimedOutError () {
- this.name = "RequestTimedOutError";
- this.message = "Request timed out";
-}
-util.inherits (RequestTimedOutError, Error);
-
-function SourceQuenchError (source) {
- this.name = "SourceQuenchError";
- this.message = "Source quench (source=" + source + ")";
- this.source = source;
-}
-util.inherits (SourceQuenchError, Error);
-
-function TimeExceededError (source) {
- this.name = "TimeExceededError";
- this.message = "Time exceeded (source=" + source + ")";
- this.source = source;
-}
-util.inherits (TimeExceededError, Error);
-
-function Session (options) {
- this.retries = (options && options.retries) ? options.retries : 1;
- this.timeout = (options && options.timeout) ? options.timeout : 2000;
-
- this.packetSize = (options && options.packetSize) ? options.packetSize : 16;
-
- if (this.packetSize < 12)
- this.packetSize = 12;
-
- this.addressFamily = (options && options.networkProtocol
- && options.networkProtocol == NetworkProtocol.IPv6)
- ? raw.AddressFamily.IPv6
- : raw.AddressFamily.IPv4;
-
- this._debug = (options && options._debug) ? true : false;
-
- this.defaultTTL = (options && options.ttl) ? options.ttl : 128;
-
- this.sessionId = (options && options.sessionId)
- ? options.sessionId
- : process.pid;
-
- this.sessionId = this.sessionId % 65535;
-
- this.nextId = 1;
-
- this.socket = null;
-
- this.reqs = {};
- this.reqsPending = 0;
-
- this.getSocket ();
-};
-
-util.inherits (Session, events.EventEmitter);
-
-Session.prototype.close = function () {
- if (this.socket)
- this.socket.close ();
- this.flush (new Error ("Socket forcibly closed"));
- delete this.socket;
- return this;
-};
-
-Session.prototype._debugRequest = function (target, req) {
- console.log ("request: addressFamily=" + this.addressFamily + " target="
- + req.target + " id=" + req.id + " buffer="
- + req.buffer.toString ("hex"));
-}
-
-Session.prototype._debugResponse = function (source, buffer) {
- console.log ("response: addressFamily=" + this.addressFamily + " source="
- + source + " buffer=" + buffer.toString ("hex"));
-}
-
-Session.prototype.flush = function (error) {
- for (id in this.reqs) {
- var req = this.reqRemove (id);
- var sent = req.sent ? req.sent : new Date ();
- req.callback (error, req.target, sent, new Date ());
- }
-};
-
-Session.prototype.getSocket = function () {
- if (this.socket)
- return this.socket;
-
- var protocol = this.addressFamily == raw.AddressFamily.IPv6
- ? raw.Protocol.ICMPv6
- : raw.Protocol.ICMP;
-
- var me = this;
- var options = {
- addressFamily: this.addressFamily,
- protocol: protocol
- };
-
- this.socket = raw.createSocket (options);
- this.socket.on ("error", this.onSocketError.bind (me));
- this.socket.on ("close", this.onSocketClose.bind (me));
- this.socket.on ("message", this.onSocketMessage.bind (me));
-
- this.ttl = null;
- this.setTTL (this.defaultTTL);
-
- return this.socket;
-};
-
-Session.prototype.fromBuffer = function (buffer) {
- var offset, type, code;
-
- if (this.addressFamily == raw.AddressFamily.IPv6) {
- // IPv6 raw sockets don't pass the IPv6 header back to us
- offset = 0;
-
- if (buffer.length - offset < 8)
- return;
-
- // We don't believe any IPv6 options will be passed back to us so we
- // don't attempt to pass them here.
-
- type = buffer.readUInt8 (offset);
- code = buffer.readUInt8 (offset + 1);
- } else {
- // Need at least 20 bytes for an IP header, and it should be IPv4
- if (buffer.length < 20 || (buffer[0] & 0xf0) != 0x40)
- return;
-
- // The length of the IPv4 header is in mulitples of double words
- var ip_length = (buffer[0] & 0x0f) * 4;
-
- // ICMP header is 8 bytes, we don't care about the data for now
- if (buffer.length - ip_length < 8)
- return;
-
- var ip_icmp_offset = ip_length;
-
- // ICMP message too short
- if (buffer.length - ip_icmp_offset < 8)
- return;
-
- type = buffer.readUInt8 (ip_icmp_offset);
- code = buffer.readUInt8 (ip_icmp_offset + 1);
-
- // For error type responses the sequence and identifier cannot be
- // extracted in the same way as echo responses, the data part contains
- // the IP header from our request, followed with at least 8 bytes from
- // the echo request that generated the error, so we first go to the IP
- // header, then skip that to get to the ICMP packet which contains the
- // sequence and identifier.
- if (type == 3 || type == 4 || type == 5 || type == 11) {
- var ip_icmp_ip_offset = ip_icmp_offset + 8;
-
- // Need at least 20 bytes for an IP header, and it should be IPv4
- if (buffer.length - ip_icmp_ip_offset < 20
- || (buffer[ip_icmp_ip_offset] & 0xf0) != 0x40)
- return;
-
- // The length of the IPv4 header is in mulitples of double words
- var ip_icmp_ip_length = (buffer[ip_icmp_ip_offset] & 0x0f) * 4;
-
- // ICMP message too short
- if (buffer.length - ip_icmp_ip_offset - ip_icmp_ip_length < 8)
- return;
-
- offset = ip_icmp_ip_offset + ip_icmp_ip_length;
- } else {
- offset = ip_icmp_offset
- }
- }
-
- // Response is not for a request we generated
- if (buffer.readUInt16BE (offset + 4) != this.sessionId)
- return;
-
- buffer[offset + 4] = 0;
-
- var id = buffer.readUInt16BE (offset + 6);
- var req = this.reqs[id];
-
- if (req) {
- req.type = type;
- req.code = code;
- return req;
- } else {
- return null;
- }
-};
-
-Session.prototype.onBeforeSocketSend = function (req) {
- this.setTTL (req.ttl ? req.ttl : this.defaultTTL);
-}
-
-Session.prototype.onSocketClose = function () {
- this.emit ("close");
- this.flush (new Error ("Socket closed"));
-};
-
-Session.prototype.onSocketError = function (error) {
- this.emit ("error", error);
-};
-
-Session.prototype.onSocketMessage = function (buffer, source) {
- if (this._debug)
- this._debugResponse (source, buffer);
-
- var req = this.fromBuffer (buffer);
- if (req) {
- this.reqRemove (req.id);
-
- if (this.addressFamily == raw.AddressFamily.IPv6) {
- if (req.type == 1) {
- req.callback (new DestinationUnreachableError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 2) {
- req.callback (new PacketTooBigError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 3) {
- req.callback (new TimeExceededError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 4) {
- req.callback (new ParameterProblemError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 129) {
- req.callback (null, req.target,
- req.sent, new Date ());
- } else {
- req.callback (new Error ("Unknown response type '" + req.type
- + "' (source=" + source + ")"), req.target,
- req.sent, new Date ());
- }
- } else {
- if (req.type == 0) {
- req.callback (null, req.target,
- req.sent, new Date ());
- } else if (req.type == 3) {
- req.callback (new DestinationUnreachableError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 4) {
- req.callback (new SourceQuenchError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 5) {
- req.callback (new RedirectReceivedError (source), req.target,
- req.sent, new Date ());
- } else if (req.type == 11) {
- req.callback (new TimeExceededError (source), req.target,
- req.sent, new Date ());
- } else {
- req.callback (new Error ("Unknown response type '" + req.type
- + "' (source=" + source + ")"), req.target,
- req.sent, new Date ());
- }
- }
- }
-};
-
-Session.prototype.onSocketSend = function (req, error, bytes) {
- if (! req.sent)
- req.sent = new Date ();
- if (error) {
- this.reqRemove (req.id);
- req.callback (error, req.target, req.sent, req.sent);
- } else {
- var me = this;
- req.timer = setTimeout (this.onTimeout.bind (me, req), req.timeout);
- }
-};
-
-Session.prototype.onTimeout = function (req) {
- if (req.retries > 0) {
- req.retries--;
- this.send (req);
- } else {
- this.reqRemove (req.id);
- req.callback (new RequestTimedOutError ("Request timed out"),
- req.target, req.sent, new Date ());
- }
-};
-
-// Keep searching for an ID which is not in use
-Session.prototype._generateId = function () {
- var startId = this.nextId++;
- while (1) {
- if (this.nextId > 65535)
- this.nextId = 1;
- if (this.reqs[this.nextId]) {
- this.nextId++;
- } else {
- return this.nextId;
- }
- // No free request IDs
- if (this.nextId == startId)
- return;
- }
-}
-
-Session.prototype.pingHost = function (target, callback) {
- var id = this._generateId ();
- if (! id) {
- callback (new Error ("Too many requests outstanding"), target);
- return this;
- }
-
- var req = {
- id: id,
- retries: this.retries,
- timeout: this.timeout,
- callback: callback,
- target: target
- };
-
- this.reqQueue (req);
-
- return this;
-};
-
-Session.prototype.reqQueue = function (req) {
- req.buffer = this.toBuffer (req);
-
- if (this._debug)
- this._debugRequest (req.target, req);
-
- this.reqs[req.id] = req;
- this.reqsPending++;
- this.send (req);
-
- return this;
-}
-
-Session.prototype.reqRemove = function (id) {
- var req = this.reqs[id];
- if (req) {
- clearTimeout (req.timer);
- delete req.timer;
- delete this.reqs[req.id];
- this.reqsPending--;
- }
- // If we have no more outstanding requests pause readable events
- if (this.reqsPending <= 0)
- if (! this.getSocket ().recvPaused)
- this.getSocket ().pauseRecv ();
- return req;
-};
-
-Session.prototype.send = function (req) {
- var buffer = req.buffer;
- var me = this;
- // Resume readable events if the raw socket is paused
- if (this.getSocket ().recvPaused)
- this.getSocket ().resumeRecv ();
- this.getSocket ().send (buffer, 0, buffer.length, req.target,
- this.onBeforeSocketSend.bind (me, req),
- this.onSocketSend.bind (me, req));
-};
-
-Session.prototype.setTTL = function (ttl) {
- if (this.ttl && this.ttl == ttl)
- return;
-
- var level = this.addressFamily == raw.AddressFamily.IPv6
- ? raw.SocketLevel.IPPROTO_IPV6
- : raw.SocketLevel.IPPROTO_IP;
- this.getSocket ().setOption (level, raw.SocketOption.IP_TTL, ttl);
- this.ttl = ttl;
-}
-
-Session.prototype.toBuffer = function (req) {
- var buffer = new Buffer (this.packetSize);
-
- // Since our buffer represents real memory we should initialise it to
- // prevent its previous contents from leaking to the network.
- for (var i = 8; i < this.packetSize; i++)
- buffer[i] = 0;
-
- var type = this.addressFamily == raw.AddressFamily.IPv6 ? 128 : 8;
-
- buffer.writeUInt8 (type, 0);
- buffer.writeUInt8 (0, 1);
- buffer.writeUInt16BE (0, 2);
- buffer.writeUInt16BE (this.sessionId, 4);
- buffer.writeUInt16BE (req.id, 6);
-
- raw.writeChecksum (buffer, 2, raw.createChecksum (buffer));
-
- return buffer;
-};
-
-Session.prototype.traceRouteCallback = function (trace, req, error, target,
- sent, rcvd) {
- if (trace.feedCallback (error, target, req.ttl, sent, rcvd)) {
- trace.doneCallback (new Error ("Trace forcibly stopped"), target);
- return;
- }
-
- if (error) {
- if (req.ttl >= trace.ttl) {
- trace.doneCallback (error, target);
- return;
- }
-
- if ((error instanceof RequestTimedOutError) && ++trace.timeouts >= 3) {
- trace.doneCallback (new Error ("Too many timeouts"), target);
- return;
- }
-
- var id = this._generateId ();
- if (! id) {
- trace.doneCallback (new Error ("Too many requests outstanding"),
- target);
- return;
- }
-
- req.ttl++;
- req.id = id;
- var me = this;
- req.retries = this.retries;
- req.sent = null;
- this.reqQueue (req);
- } else {
- trace.doneCallback (null, target);
- }
-}
-
-Session.prototype.traceRoute = function (target, ttl, feedCallback,
- doneCallback) {
- if (! doneCallback) {
- doneCallback = feedCallback;
- feedCallback = ttl;
- ttl = this.ttl;
- }
-
- var id = this._generateId ();
- if (! id) {
- var sent = new Date ();
- callback (new Error ("Too many requests outstanding"), target,
- sent, sent);
- return this;
- }
-
- var trace = {
- feedCallback: feedCallback,
- doneCallback: doneCallback,
- ttl: ttl,
- timeouts: 0
- };
-
- var me = this;
-
- var req = {
- id: id,
- retries: this.retries,
- timeout: this.timeout,
- ttl: 1,
- target: target
- };
- req.callback = me.traceRouteCallback.bind (me, trace, req);
-
- this.reqQueue (req);
-
- return this;
-};
-
-exports.createSession = function (options) {
- return new Session (options || {});
-};
-
-exports.NetworkProtocol = NetworkProtocol;
-
-exports.Session = Session;
-
-exports.DestinationUnreachableError = DestinationUnreachableError;
-exports.PacketTooBigError = PacketTooBigError;
-exports.ParameterProblemError = ParameterProblemError;
-exports.RedirectReceivedError = RedirectReceivedError;
-exports.RequestTimedOutError = RequestTimedOutError;
-exports.SourceQuenchError = SourceQuenchError;
-exports.TimeExceededError = TimeExceededError;
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/node_modules/raw-socket/.npmignore
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/node_modules/raw-socket/.npmignore b/blackberry10/node_modules/net-ping/node_modules/raw-socket/.npmignore
deleted file mode 100644
index 4331a44..0000000
--- a/blackberry10/node_modules/net-ping/node_modules/raw-socket/.npmignore
+++ /dev/null
@@ -1,5 +0,0 @@
-TODO
-build
-.hgignore
-.hgtags
-node_modules
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/node_modules/raw-socket/README.md
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/node_modules/raw-socket/README.md b/blackberry10/node_modules/net-ping/node_modules/raw-socket/README.md
deleted file mode 100644
index c9ec276..0000000
--- a/blackberry10/node_modules/net-ping/node_modules/raw-socket/README.md
+++ /dev/null
@@ -1,651 +0,0 @@
-
-# raw-socket - [homepage][homepage]
-
-This module implements raw sockets for [Node.js][nodejs].
-
-*This module has been created primarily to facilitate implementation of the
-[net-ping][net-ping] module.*
-
-This module is installed using [node package manager (npm)][npm]:
-
- # This module contains C++ source code which will be compiled
- # during installation using node-gyp. A suitable build chain
- # must be configured before installation.
-
- npm install raw-socket
-
-It is loaded using the `require()` function:
-
- var raw = require ("raw-socket");
-
-Raw sockets can then be created, and data sent using [Node.js][nodejs]
-`Buffer` objects:
-
- var socket = raw.createSocket ({protocol: raw.Protocol.None});
-
- socket.on ("message", function (buffer, source) {
- console.log ("received " + buffer.length + " bytes from " + source);
- });
-
- socket.send (buffer, 0, buffer.length, "1.1.1.1", function (error, bytes) {
- if (error)
- console.log (error.toString ());
- });
-
-[homepage]: http://re-tool.org "Homepage"
-[nodejs]: http://nodejs.org "Node.js"
-[net-ping]: https://npmjs.org/package/net-ping "net-ping"
-[npm]: https://npmjs.org/ "npm"
-
-# Network Protocol Support
-
-The raw sockets exposed by this module support IPv4 and IPv6.
-
-Raw sockets are created using the operating systems `socket()` function, and
-the socket type `SOCK_RAW` specified.
-
-# Raw Socket Behaviour
-
-Raw sockets behave in different ways depending on operating system and
-version, and may support different socket options.
-
-Some operating system versions may restrict the use of raw sockets to
-privileged users. If this is the case an exception will be thrown on socket
-creation using a message similar to `Operation not permitted` (this message
-is likely to be different depending on operating system version).
-
-The appropriate operating system documentation should be consulted to
-understand how raw sockets will behave before attempting to use this module.
-
-# Keeping The [Node.js][nodejs] Event Loop Alive
-
-This module uses the `libuv` library to integrate into the [Node.js][nodejs]
-event loop - this library is also used by [Node.js][nodejs]. An underlying
- `libuv` library `poll_handle_t` event watcher is used to monitor the
-underlying operating system raw socket used by a socket object.
-
-All the while a socket object exists, and the sockets `close()` method has not
-been called, the raw socket will keep the [Node.js][nodejs] event loop alive
-which will prevent a program from exiting.
-
-This module exports four methods which a program can use to control this
-behaviour.
-
-The `pauseRecv()` and `pauseSend()` methods stop the underlying `poll_handle_t`
-event watcher used by a socket from monitoring for readable and writeable
-events. While the `resumeRecv()` and `resumeSend()` methods start the
-underlying `poll_handle_t` event watcher used by a socket allowing it to
-monitor for readable and writeable events.
-
-Each socket object also exports the `recvPaused` and `sendPaused` boolean
-attributes to determine the state of the underlying `poll_handle_t` event
-watcher used by a socket.
-
-Socket creation can be expensive on some platforms, and the above methods offer
-an alternative to closing and deleting a socket to prevent it from keeping the
-[Node.js][nodejs] event loop alive.
-
-The [Node.js][nodejs] [net-ping][net-ping] module offers a concrete example
-of using these methods. Since [Node.js][nodejs] offers no raw socket support
-this module is used to implement ICMP echo (ping) support. Once all ping
-requests have been processed by the [net-ping][net-ping] module the
-`pauseRecv()` and `pauseSend()` methods are used to allow a program to exit if
-required.
-
-The following example stops the underlying `poll_handle_t` event watcher used
-by a socket from generating writeable events, however since readable events
-will still be watched for the program will not exit immediately:
-
- if (! socket.recvPaused)
- socket.pauseRecv ();
-
-The following can the be used to resume readable events:
-
- if (socket.recvPaused)
- socket.resumeRecv ();
-
-The following example stops the underlying `poll_handle_t` event watcher used
-by a socket from generating both readable and writeable events, if no other
-event watchers have been setup (e.g. `setTimeout()`) the program will exit.
-
- if (! socket.recvPaused)
- socket.pauseRecv ();
- if (! socket.sendPaused)
- socket.pauseSend ();
-
-The following can the be used to resume both readable and writeable events:
-
- if (socket.recvPaused)
- socket.resumeRecv ();
- if (socket.sendPaused)
- socket.resumeSend ();
-
-When data is sent using a sockets `send()` method the `resumeSend()` method
-will be called if the sockets `sendPaused` attribute is `true`, however the
-`resumeRecv()` method will not be called regardless of whether the sockets
-`recvPaused` attribute is `true` or `false`.
-
-[nodejs]: http://nodejs.org "Node.js"
-[net-ping]: http://npmjs.org/package/net-ping "net-ping"
-
-# Constants
-
-The following sections describe constants exported and used by this module.
-
-## raw.AddressFamily
-
-This object contains constants which can be used for the `addressFamily`
-option to the `createSocket()` function exposed by this module. This option
-specifies the IP protocol version to use when creating the raw socket.
-
-The following constants are defined in this object:
-
- * `IPv4` - IPv4 protocol
- * `IPv6` - IPv6 protocol
-
-## raw.Protocol
-
-This object contains constants which can be used for the `protocol` option to
-the `createSocket()` function exposed by this module. This option specifies
-the protocol number to place in the protocol field of IP headers generated by
-the operating system.
-
-The following constants are defined in this object:
-
- * `None` - protocol number 0
- * `ICMP` - protocol number 1
- * `TCP` - protocol number 6
- * `UDP` - protocol number 17
- * `ICMPv6` - protocol number 58
-
-## raw.SocketLevel
-
-This object contains constants which can be used for the `level` parameter to
-the `getOption()` and `setOption()` methods exposed by this module.
-
-The following constants are defined in this object:
-
- * `SOL_SOCKET`
- * `IPPROTO_IP`
- * `IPPROTO_IPV6`
-
-## raw.SocketOption
-
-This object contains constants which can be used for the `option` parameter to
-the `getOption()` and `setOption()` methods exposed by this module.
-
-The following constants are defined in this object:
-
- * `SO_RCVBUF`
- * `SO_RCVTIMEO`
- * `SO_SNDBUF`
- * `SO_SNDTIMEO`
- * `IP_HDRINCL`
- * `IP_OPTIONS`
- * `IP_TOS`
- * `IP_TTL`
- * `IPV6_TTL`
- * `IPV6_UNICAST_HOPS`
- * `IPV6_V6ONLY`
-
-*The `IPV6_TTL` socket option is not known to be defined by any operating
-system, it is provided in convenience to be synonymous with IPv4*
-
-For Windows platforms the following constant is also defined:
-
- * `IPV6_HDRINCL`
-
-# Using This Module
-
-Raw sockets are represented by an instance of the `Socket` class. This
-module exports the `createSocket()` function which is used to create
-instances of the `Socket` class.
-
-The module also exports a number of stubs which call through to a number of
-functions provided by the operating system, i.e. `htonl()`.
-
-This module also exports a function to generate protocol checksums.
-
-## raw.createChecksum (bufferOrObject, [bufferOrObject, ...])
-
-The `createChecksum()` function creates and returns a 16 bit one's complement
-of the one's complement sum for all the data specified in one or more
-[Node.js][nodejs] `Buffer` objects. This is useful for creating checksums for
-protocols such as IP, TCP, UDP and ICMP.
-
-The `bufferOrObject` parameter can be one of two types. The first is a
-[Node.js][nodejs] `Buffer` object. In this case a checksum is calculated from
-all the data it contains. The `bufferOrObject` parameter can also be an
-object which must contain the following attributes:
-
- * `buffer` - A [Node.js][nodejs] `Buffer` object which contains data which
- to generate a checksum for
- * `offset` - Skip this number of bytes from the beginning of `buffer`
- * `length` - Only generate a checksum for this number of bytes in `buffer`
- from `offset`
-
-The second parameter type provides control over how much of the data in a
-[Node.js][nodejs] `Buffer` object a checksum should be generated for.
-
-When more than one parameter is passed a single checksum is calculated as if
-the data in in all parameters were in a single buffer. This is useful for
-when calulating checksums for TCP and UDP for example - where a psuedo header
-must be created and used for checksum calculation.
-
-In this case two buffers can be passed, the first containing the psuedo header
-and the second containing the real TCP packet, and the offset and length
-parameters used to specify the bounds of the TCP packet payload.
-
-The following example generates a checksum for a TCP packet and its psuedo
-header:
-
- var sum = raw.createChecksum (pseudo_header, {buffer: tcp_packet,
- offset: 20, length: tcp_packet.length - 20});
-
-Both buffers will be treated as one, i.e. as if the data at offset `20` in
-`tcp_packet` had followed all data in `pseudo_header` - as if they were one
-buffer.
-
-## raw.writeChecksum (buffer, offset, checksum)
-
-The `writeChecksum()` function writes a checksum created by the
-`raw.createChecksum()` function to the [Node.js][nodejs] `Buffer` object
-`buffer` at offsets `offset` and `offset` + 1.
-
-The following example generates and writes a checksum at offset `2` in a
-[Node.js][nodejs] `Buffer` object:
-
- raw.writeChecksum (buffer, 2, raw.createChecksum (buffer));
-
-## raw.htonl (uint32)
-
-The `htonl()` function converts a 32 bit unsigned integer from host byte
-order to network byte order and returns the result. This function is simply
-a stub through to the operating systems `htonl()` function.
-
-## raw.htons (uint16)
-
-The `htons()` function converts a 16 bit unsigned integer from host byte
-order to network byte order and returns the result. This function is simply
-a stub through to the operating systems `htons()` function.
-
-## raw.ntohl (uint32)
-
-The `ntohl()` function converts a 32 bit unsigned integer from network byte
-order to host byte order and returns the result. This function is simply
-a stub through to the operating systems `ntohl()` function.
-
-## raw.ntohs (uint16)
-
-The `ntohs()` function converts a 16 bit unsigned integer from network byte
-order to host byte order and returns the result. This function is simply
-a stub through to the operating systems `ntohs()` function.
-
-## raw.createSocket ([options])
-
-The `createSocket()` function instantiates and returns an instance of the
-`Socket` class:
-
- // Default options
- var options = {
- addressFamily: raw.AddressFamily.IPv4,
- protocol: raw.Protocol.None,
- bufferSize: 4096,
- generateChecksums: false,
- checksumOffset: 0
- };
-
- var socket = raw.createSocket (options);
-
-The optional `options` parameter is an object, and can contain the following
-items:
-
- * `addressFamily` - Either the constant `raw.AddressFamily.IPv4` or the
- constant `raw.AddressFamily.IPv6`, defaults to the constant
- `raw.AddressFamily.IPv4`
- * `protocol` - Either one of the constants defined in the `raw.Protocol`
- object or the protocol number to use for the socket, defaults to the
- consant `raw.Protocol.None`
- * `bufferSize` - Size, in bytes, of the sockets internal receive buffer,
- defaults to 4096
- * `generateChecksums` - Either `true` or `false` to enable or disable the
- automatic checksum generation feature, defaults to `false`
- * `checksumOffset` - When `generateChecksums` is `true` specifies how many
- bytes to index into the send buffer to write automatically generated
- checksums, defaults to `0`
-
-An exception will be thrown if the underlying raw socket could not be created.
-The error will be an instance of the `Error` class.
-
-The `protocol` parameter, or its default value of the constant
-`raw.Protocol.None`, will be specified in the protocol field of each IP
-header.
-
-## socket.on ("close", callback)
-
-The `close` event is emitted by the socket when the underlying raw socket
-is closed.
-
-No arguments are passed to the callback.
-
-The following example prints a message to the console when the socket is
-closed:
-
- socket.on ("close", function () {
- console.log ("socket closed");
- });
-
-## socket.on ("error", callback)
-
-The `error` event is emitted by the socket when an error occurs sending or
-receiving data.
-
-The following arguments will be passed to the `callback` function:
-
- * `error` - An instance of the `Error` class, the exposed `message` attribute
- will contain a detailed error message.
-
-The following example prints a message to the console when an error occurs,
-after which the socket is closed:
-
- socket.on ("error", function (error) {
- console.log (error.toString ());
- socket.close ();
- });
-
-## socket.on ("message", callback)
-
-The `message` event is emitted by the socket when data has been received.
-
-The following arguments will be passed to the `callback` function:
-
- * `buffer` - A [Node.js][nodejs] `Buffer` object containing the data
- received, the buffer will be sized to fit the data received, that is the
- `length` attribute of buffer will specify how many bytes were received
- * `address` - For IPv4 raw sockets the dotted quad formatted source IP
- address of the message, e.g `192.168.1.254`, for IPv6 raw sockets the
- compressed formatted source IP address of the message, e.g.
- `fe80::a00:27ff:fe2a:3427`
-
-The following example prints received messages in hexadecimal to the console:
-
- socket.on ("message", function (buffer, address) {
- console.log ("received " + buffer.length + " bytes from " + address
- + ": " + buffer.toString ("hex"));
- });
-
-## socket.generateChecksums (generate, offset)
-
-The `generateChecksums()` method is used to specify whether automatic checksum
-generation should be performed by the socket.
-
-The `generate` parameter is either `true` or `false` to enable or disable the
-feature. The optional `offset` parameter specifies how many bytes to index
-into the send buffer when writing the generated checksum to the send buffer.
-
-The following example enables automatic checksum generation at offset 2
-resulting in checksums being written to byte 3 and 4 of the send buffer
-(offsets start from 0, meaning byte 1):
-
- socket.generateChecksums (true, 2);
-
-## socket.getOption (level, option, buffer, length)
-
-The `getOption()` method gets a socket option using the operating systems
-`getsockopt()` function.
-
-The `level` parameter is one of the constants defined in the `raw.SocketLevel`
-object. The `option` parameter is one of the constants defined in the
-`raw.SocketOption` object. The `buffer` parameter is a [Node.js][nodejs]
-`Buffer` object where the socket option value will be written. The `length`
-parameter specifies the size of the `buffer` parameter.
-
-If an error occurs an exception will be thrown, the exception will be an
-instance of the `Error` class.
-
-The number of bytes written into the `buffer` parameter is returned, and can
-differ from the amount of space available.
-
-The following example retrieves the current value of `IP_TTL` socket option:
-
- var level = raw.SocketLevel.IPPROTO_IP;
- var option = raw.SocketOption.IP_TTL;
-
- # IP_TTL is a signed integer on some platforms so a 4 byte buffer is used
- var buffer = new Buffer (4);
-
- var written = socket.getOption (level, option, buffer, buffer.length);
-
- console.log (buffer.toString ("hex"), 0, written);
-
-## socket.send (buffer, offset, length, address, beforeCallback, afterCallback)
-
-The `send()` method sends data to a remote host.
-
-The `buffer` parameter is a [Node.js][nodejs] `Buffer` object containing the
-data to be sent. The `length` parameter specifies how many bytes from
-`buffer`, beginning at offset `offset`, to send. For IPv4 raw sockets the
-`address` parameter contains the dotted quad formatted IP address of the
-remote host to send the data to, e.g `192.168.1.254`, for IPv6 raw sockets the
-`address` parameter contains the compressed formatted IP address of the remote
-host to send the data to, e.g. `fe80::a00:27ff:fe2a:3427`. If provided the
-optional `beforeCallback` function is called right before the data is actually
-sent using the underlying raw socket, giving users the opportunity to perform
-pre-send actions such as setting a socket option, e.g. the IP header TTL. No
-arguments are passed to the `beforeCallback` function. The `afterCallback`
-function is called once the data has been sent. The following arguments will
-be passed to the `afterCallback` function:
-
- * `error` - Instance of the `Error` class, or `null` if no error occurred
- * `bytes` - Number of bytes sent
-
-The following example sends a ICMP ping message to a remote host, before the
-request is actually sent the IP header TTL is modified, and modified again
-after the data has been sent:
-
- // ICMP echo (ping) request, checksum should be ok
- var buffer = new Buffer ([
- 0x08, 0x00, 0x43, 0x52, 0x00, 0x01, 0x0a, 0x09,
- 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69]);
-
- var socketLevel = raw.SocketLevel.IPPROTO_IP
- var socketOption = raw.SocketOption.IP_TTL;
-
- function beforeSend () {
- socket.setOption (socketLevel, socketOption, 1);
- }
-
- function afterSend (error, bytes) {
- if (error)
- console.log (error.toString ());
- else
- console.log ("sent " + bytes + " bytes");
-
- socket.setOption (socketLevel, socketOption, 1);
- }
-
- socket.send (buffer, 0, buffer.length, target, beforeSend, afterSend);
-
-## socket.setOption (level, option, buffer, length)
-
-The `setOption()` method sets a socket option using the operating systems
-`setsockopt()` function.
-
-The `level` parameter is one of the constants defined in the `raw.SocketLevel`
-object. The `option` parameter is one of the constants defined in the
-`raw.SocketOption` object. The `buffer` parameter is a [Node.js][nodejs]
-`Buffer` object where the socket option value is specified. The `length`
-parameter specifies how much space the option value occupies in the `buffer`
-parameter.
-
-If an error occurs an exception will be thrown, the exception will be an
-instance of the `Error` class.
-
-The following example sets the value of `IP_TTL` socket option to `1`:
-
- var level = raw.SocketLevel.IPPROTO_IP;
- var option = raw.SocketOption.IP_TTL;
-
- # IP_TTL is a signed integer on some platforms so a 4 byte buffer is used,
- # x86 computers use little-endian format so specify bytes reverse order
- var buffer = new Buffer ([0x01, 0x00, 0x00, 0x00]);
-
- socket.setOption (level, option, buffer, buffer.length);
-
-To avoid dealing with endianess the `setOption()` method supports a three
-argument form which can be used for socket options requiring a 32bit unsigned
-integer value (for example the `IP_TTL` socket option used in the previous
-example). Its signature is as follows:
-
- socket.setOption (level, option, value)
-
-The previous example can be re-written to use this form:
-
- var level = raw.SocketLevel.IPPROTO_IP;
- var option = raw.SocketOption.IP_TTL;
-
- socket.setOption (level, option, 1);
-
-# Example Programs
-
-Example programs are included under the modules `example` directory.
-
-# Bugs & Known Issues
-
-None, yet!
-
-Bug reports should be sent to <st...@gmail.com>.
-
-# Changes
-
-## Version 1.0.0 - 29/01/2013
-
- * Initial release
-
-## Version 1.0.1 - 01/02/2013
-
- * Move `SOCKET_ERRNO` define from `raw.cc` to `raw.h`
- * Error in exception thrown by `SocketWrap::New` in `raw.cc` stated that two
- arguments were required, this should be one
- * Corrections to the README.md
- * Missing includes causes compilation error on some systems (maybe Node
- version dependant)
-
-## Version 1.0.2 - 02/02/2013
-
- * Support automatic checksum generation
-
-## Version 1.1.0 - 13/02/2013
-
- * The [net-ping][net-ping] module is now implemented so update the note about
- it in the first section of the README.md
- * Support IPv6
- * Support the `IP_HDRINCL` socket option via the `noIpHeader` option to the
- `createSocket()` function and the `noIpHeader()` method exposed by the
- `Socket` class
-
-## Version 1.1.1 - 14/02/2013
-
- * IP addresses not being validated
-
-## Version 1.1.2 - 15/02/2013
-
- * Default protocol option to `createSession()` was incorrect in the README.md
- * The `session.on("message")` example used `message` instead of `buffer` in
- the README.md
-
-## Version 1.1.3 - 04/03/2013
-
- * `raw.Socket.onSendReady()` emit's an error when `raw.SocketWrap.send()`
- throws an exception when it should call the `req.callback` callback
- * Added the `pauseRecv()`, `resumeRecv()`, `pauseSend()` and `resumeSend()`
- methods
-
-[net-ping]: https://npmjs.org/package/net-ping "net-ping"
-
-## Version 1.1.4 - 05/03/2013
-
- * Cleanup documentation for the `pauseSend()`, `pauseRecv()`, `resumeSend()`
- and `resumeRecv()` methods in the README.md
-
-## Version 1.1.5 - 09/05/2013
-
- * Reformated lines in the README.md file inline with the rest of the file
- * Removed the `noIpHeader()` method (the `setOption()` method should be
- used to configure the `IP_HDRINCL` socket option - and possibly
- `IPV6_HDRINCL` on Windows platforms), and removed the `Automatic IP Header
- Generation` section from the README.md file
- * Added the `setOption()` and `getOption()` methods, and added the
- `SocketLevel` and `SocketOption` constants
- * Tidied up the example program `ping-no-ip-header.js` (now uses the
- `setOption()` method to configure the `IP_HDRINCL` socket option)
- * Tidied up the example program `ping6-no-ip-header.js` (now uses the
- `setOption()` method to configure the `IPV6_HDRINCL` socket option)
- * Added the example program `get-option.js`
- * Added the example program `ping-set-option-ip-ttl.js`
- * Use MIT license instead of GPL
-
-## Version 1.1.6 - 18/05/2013
-
- * Added the `beforeCallback` parameter to the `send()` method, and renamed the
- `callback` parameter to `afterCallback`
- * Fixed a few typos in the README.md file
- * Modified the example program `ping-set-option-ip-ttl.js` to use the
- `beforeCallback` parameter to the `send()` method
- * The example program `ping6-no-ip-header.js` was not passing the correct
- arguments to the `setOption()` method
-
-## Version 1.1.7 - 23/06/2013
-
- * Added the `htonl()`, `htons()`, `ntohl()`, and `ntohs()` functions, and
- associated example programs
- * Added the `createChecksum()` function, and associated example program
-
-## Version 1.1.8 - 01/07/2013
-
- * Added the `writeChecksum()` function
- * Removed the "Automated Checksum Generation" feature - this has been
- replaced with the `createChecksum()` and `writeChecksum()` functions
-
-## Version 1.2.0 - 02/07/2013
-
- * Up version number to 1.2.0 (we should have done this for 1.1.8 because it
- introduced some API breaking changes)
-
-# Roadmap
-
-In no particular order:
-
- * Enhance performance by moving the send queue into the C++ raw::SocketWrap
- class
-
-Suggestions and requirements should be sent to <st...@gmail.com>.
-
-# License
-
-Copyright (c) 2013 Stephen Vickers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-# Author
-
-Stephen Vickers <st...@gmail.com>
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/node_modules/raw-socket/binding.gyp
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/node_modules/raw-socket/binding.gyp b/blackberry10/node_modules/net-ping/node_modules/raw-socket/binding.gyp
deleted file mode 100644
index 53b5e06..0000000
--- a/blackberry10/node_modules/net-ping/node_modules/raw-socket/binding.gyp
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- 'targets': [
- {
- 'target_name': 'raw',
- 'sources': [
- 'src/raw.cc'
- ],
- 'conditions' : [
- ['OS=="win"', {
- 'libraries' : ['ws2_32.lib']
- }]
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3016473f/blackberry10/node_modules/net-ping/node_modules/raw-socket/index.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/net-ping/node_modules/raw-socket/index.js b/blackberry10/node_modules/net-ping/node_modules/raw-socket/index.js
deleted file mode 100644
index 211523e..0000000
--- a/blackberry10/node_modules/net-ping/node_modules/raw-socket/index.js
+++ /dev/null
@@ -1,216 +0,0 @@
-
-var events = require ("events");
-var net = require ("net");
-var raw = require ("./build/Release/raw");
-var util = require ("util");
-
-function _expandConstantObject (object) {
- var keys = [];
- for (key in object)
- keys.push (key);
- for (var i = 0; i < keys.length; i++)
- object[object[keys[i]]] = parseInt (keys[i]);
-}
-
-var AddressFamily = {
- 1: "IPv4",
- 2: "IPv6"
-};
-
-_expandConstantObject (AddressFamily);
-
-var Protocol = {
- 0: "None",
- 1: "ICMP",
- 6: "TCP",
- 17: "UDP",
- 58: "ICMPv6"
-};
-
-_expandConstantObject (Protocol);
-
-for (var key in events.EventEmitter.prototype) {
- raw.SocketWrap.prototype[key] = events.EventEmitter.prototype[key];
-}
-
-function Socket (options) {
- Socket.super_.call (this);
-
- this.requests = [];
- this.buffer = new Buffer ((options && options.bufferSize)
- ? options.bufferSize
- : 4096);
-
- this.recvPaused = false;
- this.sendPaused = true;
-
- this.wrap = new raw.SocketWrap (
- ((options && options.protocol)
- ? options.protocol
- : 0),
- ((options && options.addressFamily)
- ? options.addressFamily
- : AddressFamily.IPv4)
- );
-
- var me = this;
- this.wrap.on ("sendReady", this.onSendReady.bind (me));
- this.wrap.on ("recvReady", this.onRecvReady.bind (me));
- this.wrap.on ("error", this.onError.bind (me));
- this.wrap.on ("close", this.onClose.bind (me));
-};
-
-util.inherits (Socket, events.EventEmitter);
-
-Socket.prototype.close = function () {
- this.wrap.close ();
- return this;
-}
-
-Socket.prototype.getOption = function (level, option, value, length) {
- return this.wrap.getOption (level, option, value, length);
-}
-
-Socket.prototype.onClose = function () {
- this.emit ("close");
-}
-
-Socket.prototype.onError = function (error) {
- this.emit ("error", error);
- this.close ();
-}
-
-Socket.prototype.onRecvReady = function () {
- var me = this;
- try {
- this.wrap.recv (this.buffer, function (buffer, bytes, source) {
- var newBuffer = buffer.slice (0, bytes);
- me.emit ("message", newBuffer, source);
- });
- } catch (error) {
- me.emit ("error", error);
- }
-}
-
-Socket.prototype.onSendReady = function () {
- if (this.requests.length > 0) {
- var me = this;
- var req = this.requests.shift ();
- try {
- if (req.beforeCallback)
- req.beforeCallback ();
- this.wrap.send (req.buffer, req.offset, req.length,
- req.address, function (bytes) {
- req.afterCallback.call (me, null, bytes);
- });
- } catch (error) {
- req.afterCallback.call (me, error, 0);
- }
- } else {
- if (! this.sendPaused)
- this.pauseSend ();
- }
-}
-
-Socket.prototype.pauseRecv = function () {
- this.recvPaused = true;
- this.wrap.pause (this.recvPaused, this.sendPaused);
- return this;
-}
-
-Socket.prototype.pauseSend = function () {
- this.sendPaused = true;
- this.wrap.pause (this.recvPaused, this.sendPaused);
- return this;
-}
-
-Socket.prototype.resumeRecv = function () {
- this.recvPaused = false;
- this.wrap.pause (this.recvPaused, this.sendPaused);
- return this;
-}
-
-Socket.prototype.resumeSend = function () {
- this.sendPaused = false;
- this.wrap.pause (this.recvPaused, this.sendPaused);
- return this;
-}
-
-Socket.prototype.send = function (buffer, offset, length, address,
- beforeCallback, afterCallback) {
- if (! afterCallback) {
- afterCallback = beforeCallback;
- beforeCallback = null;
- }
-
- if (length + offset > buffer.length) {
- afterCallback.call (this, new Error ("Buffer length '" + buffer.length
- + "' is not large enough for the specified offset '" + offset
- + "' plus length '" + length + "'"));
- return this;
- }
-
- if (! net.isIP (address)) {
- afterCallback.call (this, new Error ("Invalid IP address '" + address + "'"));
- return this;
- }
-
- var req = {
- buffer: buffer,
- offset: offset,
- length: length,
- address: address,
- afterCallback: afterCallback,
- beforeCallback: beforeCallback
- };
- this.requests.push (req);
-
- if (this.sendPaused)
- this.resumeSend ();
-
- return this;
-}
-
-Socket.prototype.setOption = function (level, option, value, length) {
- if (arguments.length > 3)
- this.wrap.setOption (level, option, value, length);
- else
- this.wrap.setOption (level, option, value);
-}
-
-exports.createChecksum = function () {
- var sum = 0;
- for (var i = 0; i < arguments.length; i++) {
- var object = arguments[i];
- if (object instanceof Buffer) {
- sum = raw.createChecksum (sum, object, 0, object.length);
- } else {
- sum = raw.createChecksum (sum, object.buffer, object.offset,
- object.length);
- }
- }
- return sum;
-}
-
-exports.writeChecksum = function (buffer, offset, checksum) {
- buffer.writeUInt8 ((checksum & 0xff00) >> 8, offset);
- buffer.writeUInt8 (checksum & 0xff, offset + 1);
- return buffer;
-}
-
-exports.createSocket = function (options) {
- return new Socket (options || {});
-};
-
-exports.AddressFamily = AddressFamily;
-exports.Protocol = Protocol;
-
-exports.Socket = Socket;
-
-exports.SocketLevel = raw.SocketLevel;
-exports.SocketOption = raw.SocketOption;
-
-exports.htonl = raw.htonl;
-exports.htons = raw.htons;
-exports.ntohl = raw.ntohl;
-exports.ntohs = raw.ntohs;