Xojo Developer Conference
Join us from 25th to 27th April 2018 in Denver.

Platforms to show: All Mac Windows Linux Cross-Platform

CURLNMBS.ChunkBegin(FileInfo as CURLNFileInfoMBS, Remains as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: The event called on begin of a new chunk.
Notes: If splitting of data transfer is enabled, this callback is called before download of an individual chunk started. Note that parameter "remains" works only for FTP wildcard downloading (for now), otherwise is not used.
CURLNMBS.ChunkEnd(FileInfo as CURLNFileInfoMBS, Remains as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: Download of a chunk ended.
Notes:
If splitting of data transfer is enabled this callback is called after download of an individual chunk finished.
This event is called for skipped or downloaded files.
CURLNMBS.DebugMessage(infotype as Integer, data as string, dataSize as Integer)
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: A debug event to get data of ongoing process.
Notes:
You may need to set OptionVerbose to true.

infotype constants:
kInfo_TEXT0The data is informational text.
kInfo_HEADER_IN1The data is header (or header-like) data received from the peer.
kInfo_HEADER_OUT2The data is header (or header-like) data sent to the peer.
kInfo_DATA_IN3The data is protocol data received from the peer.
kInfo_DATA_OUT4The data is protocol data sent to the peer.
kInfo_SSL_DATA_IN5The data is protocol data received from the peer.
kInfo_SSL_DATA_OUT6The data is protocol data sent to the peer.

If you set CollectDebugData, the plugin will collect the messages and provide them via the DebugData property. You can still use this event to write your own log instead of in addition.
CURLNMBS.FileNameMatch(Pattern as String, Name as String) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: Match a file against a pattern.
Notes:
If you don't implement this event, you get the default implementation from CURL.
Return kFileNameMatchNoMatch, kFileNameMatchIsMatch or kFileNameMatchFailed.
CURLNMBS.Finished(Result as Integer)
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: The event called when transfer has finished.
Notes:
For Perform and PerformMT it is called before Perform function returns, so in PerformMT this is called on the thread.
For use with CURLNMultiMBS, it is called after TransferFinished event and before TransfersFinished event.
If you want to modify GUI and use PeformMT, you may need to start a timer to do so.
CURLNMBS.Header(data as string, dataSize as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: New Header data was received.
Notes:
You can get error 23 if you don't return lenb(data) in this event.
Or just leave it emtpy so RB will not include it in your application the plugin will return lenb(data) itself.

If you set CollectHeaderData to true, the plugin will collect the messages and provide them via the HeaderData property. You can still use this event to write your own log instead of in addition.
CURLNMBS.Progress(dltotal as Int64, dlnow as Int64, ultotal as Int64, ulnow as Int64, percent as Double) as boolean
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: An event to report progress of ongoing transfers.
Notes:
This function gets called by libCURL with a frequent interval during operation (roughly once per second) no matter if data is being transfered or not. Unknown/unused argument values passed to the callback will be set to zero (like if you only download data, the upload size will remain 0).
Returning a true from this event will cause libCURL to abort the transfer and return kError_ABORTED_BY_CALLBACK.

You can run CURL from a thread to download several things at the same time or keep the GUI more responsive. For better GUI, you can even call a method like app.DoEvents to get the GUI updated more often.

When sending email, ultotal may be zero. In that case use OptionInFileSize to know size of email to upload.
CURLNMBS.Read(count as Integer) as string
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: This event gets called by libCURL as soon as it needs to read data in order to send it to the peer.
Notes:
Return the number of bytes requested. Never return a string with lenb(string)>count. You can return 0 to inform about end of file.

If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it, like when you've told you will upload N bytes and you upload less than N bytes), you may experience that the server "hangs" waiting for the rest of the data that won't come.

The read event may return CURL_READFUNC_ABORT (&h10000000) to stop the current operation immediately, resulting in a kError_ABORTED_BY_CALLBACK error code from the transfer (Added in 7.12.1)

This event is not called when using PerformMT.

If you provide Input data via SetInputData method, this event is not called and data is taken from the data you provided.
CURLNMBS.RestartRead() as boolean
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: An event to inform you that reading on the file needs to start at the beginning again.
Notes:
Return true on success.
If you use a binarystream for reading you will have to set position to 0 in this event.

This event is not called when using PerformMT.
CURLNMBS.Seek(pos as Int64, whence as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 12.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: Called when CURL needs to perform a seek.
Notes:
Normally only needed if you resume a download (Seek forward) or upload is reset (seek back).
Whence is kSeekOriginCurrent, kSeekOriginEnd or kSeekOriginSet.
Please return one of this constants: kSeekReturnCantSeek, kSeekReturnFail or kSeekReturnOk.
CURLNMBS.SSHKey(KnownKey as string, KnownKeyLength as Integer, KnownKeyType as Integer, FoundKey as string, FoundKeyLength as Integer, FoundKeyType as Integer, MatchStatus as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 10.0, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: The event for known hosts callback for SFTP and SCP.
Notes:
KnownKey: The known key as string encoded with base64 if KnownKeyLength is zero, otherwise the "raw" data.
KnownKeyLength: The length of the key. Zero for base64 encoded key.
KnownKeyType: The type of the key. (0 = Unknown, 1 = RSA1, 2 = RSA, 3 = DSS)
FoundKey: The found key as string encoded with base64 if FoundKeyLength is zero, otherwise the "raw" data.
FoundKeyLength: The length of the key. Zero for base64 encoded key.
FoundKeyType: The type of the key. (0 = Unknown, 1 = RSA1, 2 = RSA, 3 = DSS)
MatchStatus: The status CURL found. (0 = OK, 1 = Mismatch, 2 = Missing)

Return one of the following values:
CURLKHSTAT_FINE_ADD_TO_FILE0Fine and add to file
CURLKHSTAT_FINE1Fine
CURLKHSTAT_REJECT2reject the connection, return an error
CURLKHSTAT_DEFER3do not accept it, but we can't answer right now so this causes a CURLE_DEFER error but otherwise the connection will be left intact etc
CURLNMBS.Write(data as string, dataSize as Integer) as Integer
event, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: No, Feedback.

Function: This event gets called by libCURL as soon as there is data received that needs to be saved.
Notes:
Return the number of bytes actually taken care of. If that amount differs from the amount passed to your function, it'll signal an error to the library and it will abort the transfer and return kError_WRITE_ERROR.

This function may be called with zero bytes data if the transfered file is empty.

The event function will be passed as much data as possible in all invokes, but you cannot possibly make any assumptions. It may be one byte, it may be thousands. The maximum amount of data that can be passed to the write callback is defined in the CURL.h header file: CURL_MAX_WRITE_SIZE (16384).

If you set CollectOutputData to true, the plugin will automatically collect the data and provide it to you after the transfer with the OutputData property. This collecting feature will only work right, if there is enough free memory. You can of course still process data yourself in this event instead of in addition.

The items on this page are in the following plugins: MBS CURL Plugin.




Links
MBS FileMaker Plugins