Skip to content
Lee Thompson edited this page Jun 23, 2015 · 7 revisions

API

Setting Options

Call Description
addUnit(IP Address) Scan this specific ReadyNAS unit.*1
setOptionRequireUniqueHosts(0..1) Require HOSTNAMEs to be unique (in addition to IP and MAC addresses)
setOptionVerbose(0..1) Show VERBOSE messages
setOptionDebug(0..1) Show DEBUG messages.
setOptionDebugFile("console" or pathname) Output to console or file. Default is console.
setOptionDumpBadPacketsOnly(0..1) Dump bad packets ONLY*2
setOptionDumpPackets(0..1) Dump network packets*2
setDumpPath(pathname) Set path for dump files. Defaults to current directory.*3
setBroadcastAddress(IP Address) Set broadcast address. Default is 255.255.255.255.*3
setDestinationAddress(IP Address) Depreciated. Replaced with addUnit
setSocketBufferSize(bytes) Set socket buffer size (bytes). Default is 16384*3
setInfrantCID(DWORD) Set client ID for request.*3
setInfrantSID(DWORD) Set server ID for request.*3 WARNING: Changing this will result in the ReadyNAS ignoring you!
setSrcPort(WORD) Set source port for request. 31000 is the default.*3
setDstPort(WORD) Set destination port for request. 22081 is the default for MULTICAST and UNICAST. 161 is the default for SNMP.
setDstSNMPPort(WORD) Set destination port for SNMP request. 161 is the default.
setSocketTimeout(Seconds) Set socket error timeout (seconds) (Multicast Only). Default is 2.*3
setCommunity(string) Set the SNMP Community (SNMP Only). Default is public.

Functions

Call Description
loadReadyNASLibrary(string) Loads the appropriate library based upon the contents of 'string'. Valid values are SNMP, MULTICAST and UNICAST. It is not case-sensitive.
loadReadyNASData(void) Uses UPNP to discover units and loads internal structures.
getBytesRead(void) Returns an integer with the byte count of data read over the network.
getUnitAddresses(void) Returns a sorted, `
getUnitMACs(void) Returns a sorted, `
getUnitHosts(void) Returns a sorted, `
getUnitCount(void) Returns a count of the number of ReadyNAS units that information is available on.
getUnitData(IP Address) Returns the raw data packet for the IP address given. (SMTP: Returns the IP address passed in.)
getLibraryVersion(void) Returns a string with the version number of the library.
getLibraryTitle(void) Returns a string with the title of the library.
parseReadyNASData(raw_packet) Returns a macindex of the raw_packet (or IP with the SNMP version)
getUnitIP(mac_index) Returns the IP address of the unit
getUnitMAC(IP Address) Returns the macindex of the unit
getLastError(void) Returns the most recent error text (not fully implemented)

Notes

*1 Please note that adding an IP directly will effectively shut off any discovery/auto-detection.

*2 UPNP Only

*3 Has no effect when using SNMP.

Clone this wiki locally