From 8cd9a2c3a944e804c72ef461df801116c6b44ac7 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 28 Nov 2013 19:37:39 -0800 Subject: doc updates --- doc/html/zot_8php.html | 128 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 104 insertions(+), 24 deletions(-) (limited to 'doc/html/zot_8php.html') diff --git a/doc/html/zot_8php.html b/doc/html/zot_8php.html index ae895864c..3fa97efb2 100644 --- a/doc/html/zot_8php.html +++ b/doc/html/zot_8php.html @@ -28,7 +28,7 @@ - + - - + + @@ -392,6 +392,15 @@ Functions
The Red Matrix
@@ -114,8 +114,8 @@ $(document).ready(function(){initNavTree('zot_8php.html','');}); Functions
 zot_new_uid ($channel_nick)
 
 zot_get_hubloc ($arr, $primary=false)
 
 zot_get_hublocs ($hash)
 
 zot_build_packet ($channel, $type= 'notify', $recipients=null, $remote_key=null, $secret=null)
 
 zot_zot ($url, $data)
+

import_xchan($arr,$ud_flags = 1) Takes an associative array of a fecthed discovery packet and updates all internal data structures which need to be updated as a result.

+
Parameters
+ + + +
array$arr=> json_decoded discovery packet
int$ud_flagsDetermines whether to create a directory update record if any changes occur, default 1 or true
+
+
+
Returns
array => 'success' (boolean true or false) 'message' (optional error string only if success is false)

Referenced by chanview_content(), gprobe_run(), magic_init(), message_post(), new_contact(), poco_load(), post_init(), update_directory_entry(), zot_refresh(), and zot_register_hub().

@@ -706,6 +715,18 @@ Functions
+

zot_build_packet($channel,$type = 'notify',$recipients = null, $remote_key = null, $secret = null) builds a zot notification packet that you can either store in the queue with a message array or call zot_zot to immediately zot it to the other side

+
Parameters
+ + + + + + +
array$channel=> sender channel structure
string$type=> packet type: one of 'ping', 'pickup', 'purge', 'refresh', 'notify', 'auth_check'
array$recipients=> envelope information, array ( 'guid' => string, 'guid_sig' => string ); empty for public posts
string$remote_key=> optional public site key of target hub used to encrypt entire packet NOTE: remote_key and encrypted packets are required for 'auth_check' packets, optional for all others
string$secret=> random string, required for packets which require verification/callback e.g. 'pickup', 'purge', 'notify', 'auth_check' — 'ping' and 'refresh' do not require verification
+
+
+
Returns
string json encoded zot packet

Referenced by build_sync_packet(), directory_run(), notifier_run(), post_init(), and zping_content().

@@ -724,8 +745,18 @@ Functions
-

: zot_fetch

-

We received a notification packet (in mod/post.php) that a message is waiting for us, and we've verified the sender. Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign. The entire pickup message is encrypted with the remote site's public key. If everything checks out on the remote end, we will receive back a packet containing one or more messages, which will be processed before returning.

+

zot_fetch($arr)

+
We received a notification packet (in mod/post.php) that a message is waiting for us, and we've verified the sender.
+Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site private key.
+The entire pickup message is encrypted with the remote site's public key. 
+If everything checks out on the remote end, we will receive back a packet containing one or more messages,
+which will be processed and delivered before this function ultimately returns.
+
Parameters
+ + +
array$arrdecrypted and json decoded notify packet from remote site
+
+

Referenced by post_post().

@@ -776,30 +807,27 @@ Functions
- +
- + - - - - - - - - - + - -
zot_get_hubloc zot_get_hublocs (  $arr,
 $primary = false 
$hash) )
-

Given an array of zot hashes, return all distinct hubs If primary is true, return only primary hubs Result is ordered by url to assist in batching. Return only the first primary hub as there should only be one.

+

zot_get_hublocs($hash) Given a zot hash, return all distinct hubs. This function is used in building the zot discovery packet and therefore should only be used by channels which are defined on this hub

+
Parameters
+ + +
string$hash- xchan_hash array of hubloc (hub location structures) hubloc_id int hubloc_guid char(255) hubloc_guid_sig text hubloc_hash char(255) hubloc_addr char(255) hubloc_flags int hubloc_status int hubloc_url char(255) hubloc_url_sig text hubloc_host char(255) hubloc_callback char(255) hubloc_connect char(255) hubloc_sitekey text hubloc_updated datetime hubloc_connected datetime
+
+
+

Only search for active hublocs - e.g. those that haven't been marked deleted

Referenced by zfinger_init().

@@ -819,7 +847,13 @@ Functions

: zot_gethub

-

A guid and a url, both signed by the sender, distinguish a known sender at a known location This function looks these up to see if the channel is known. If not, we will need to verify it.

+

A guid and a url, both signed by the sender, distinguish a known sender at a known location This function looks these up to see if the channel is known and therefore previously verified. If not, we will need to verify it.

+
Parameters
+ + +
array$arr$arr must contain: string $arr['guid'] => guid of conversant string $arr['guid_sig'] => guid signed with conversant's private key string $arr['url'] => URL of the origination hub of this communication string $arr['url_sig'] => URL signed with conversant's private key
+
+
Returns
: array => hubloc record

Referenced by import_post(), post_post(), zot_fetch(), and zot_import().

@@ -851,7 +885,15 @@ Functions

zot_import

Process an incoming array of messages which were obtained via pickup, and import, update, delete as directed.

-

The message types handled here are 'activity' (e.g. posts), 'mail' and 'profile'

+
Parameters
+ + + +
array$arr=> 'pickup' structure returned from remote site
string$sender_url=> the url specified by the sender in the initial communication we will verify the sender and url in each returned message structure and also verify that all the messages returned match the site url that we are currently processing.
+
+
+

The message types handled here are 'activity' (e.g. posts), 'mail' , 'profile', and 'channel_sync'

+
Returns
array => array ( [0] => string $channel_hash, [1] => string $delivery_status, [2] => string $address ) suitable for logging remotely, enumerating the processing results of each message/recipient combination.

Referenced by deliver_run(), and zot_fetch().

@@ -870,7 +912,16 @@ Functions
-

zot_new_uid($channel_nick) = unique nickname of controlling entity

+

Red implementation of zot protocol.

+

https://github.com/friendica/red/wiki/zot https://github.com/friendica/red/wiki/Zot—A-High-Level-Overview

+

zot_new_uid($channel_nick)

+

Generates a unique string for use as a zot guid using our DNS-based url, the channel nickname and some entropy. The entropy ensures uniqueness against re-installs where the same URL and nickname are chosen. NOTE: zot doesn't require this to be unique. Internally we use a whirlpool hash of this guid and the signature of this guid signed with the channel private key. This can be verified and should make the probability of collision of the verified result negligible within the constraints of our immediate universe.

+
Parameters
+ + +
stringchannel_nickname = unique nickname of controlling entity
+
+
Returns
string

Referenced by create_identity().

@@ -906,6 +957,16 @@ Functions
+

zot_process_response($hub,$arr,$outq) { Called immediately after sending a zot message which is using queue processing Updates the queue item according to the response result and logs any information returned to aid communications troubleshooting.

+
Parameters
+ + + + +
string$hub- url of site we just contacted
array$arr- output of z_post_url()
array$outq- The queue structure attached to this request
+
+
+
Returns
nothing

Referenced by deliver_run(), and queue_run().

@@ -934,8 +995,18 @@ Functions
-

: zot_refresh

-

zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified to fetch new permissions via a finger operation. This may result in a new connection (abook entry) being added to a local channel and it may result in auto-permissions being granted.

+

: zot_refresh($them, $channel = null)

+

zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified to fetch new permissions via a finger/discovery operation. This may result in a new connection (abook entry) being added to a local channel and it may result in auto-permissions being granted.

+

Friending in zot is accomplished by sending a refresh packet to a specific channel which indicates a permission change has been made by the sender which affects the target channel. The hub controlling the target channel does targetted discovery (a zot-finger request requesting permissions for the local channel). These are decoded here, and if necessary and abook structure (addressbook) is created to store the permissions assigned to this channel.

+

Initially these abook structures are created with a 'pending' flag, so that no reverse permissions are implied until this is approved by the owner channel. A channel can also auto-populate permissions in return and send back a refresh packet of its own. This is used by forum and group communication channels so that friending and membership in the channel's "club" is automatic.

+
Parameters
+ + + +
array$them=> xchan structure of sender
array$channel=> local channel structure of target recipient, required for "friending" operations
+
+
+
Returns
boolean true if successful, else false

Referenced by connections_content(), import_author_xchan(), onepoll_run(), and post_post().

@@ -954,6 +1025,15 @@ Functions
+

zot_register_hub($arr)

+

A communication has been received which has an unknown (to us) sender. Perform discovery based on our calculated hash of the sender at the origination address. This will fetch the discovery packet of the sender, which contains the public key we need to verify our guid and url signatures.

+
Parameters
+ + +
array$arr$arr must contain: string $arr['guid'] => guid of conversant string $arr['guid_sig'] => guid signed with conversant's private key string $arr['url'] => URL of the origination hub of this communication string $arr['url_sig'] => URL signed with conversant's private key
+
+
+
Returns
array => 'success' (boolean true or false) 'message' (optional error string only if success is false)

Referenced by post_post().

-- cgit v1.2.3 From 90fff1de1c81eca9cdca8c41ec8083b72965b4a2 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 6 Dec 2013 00:11:03 -0800 Subject: doc updates --- doc/html/zot_8php.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'doc/html/zot_8php.html') diff --git a/doc/html/zot_8php.html b/doc/html/zot_8php.html index 3fa97efb2..014f6795b 100644 --- a/doc/html/zot_8php.html +++ b/doc/html/zot_8php.html @@ -166,6 +166,8 @@ Functions    get_rpost_path ($observer)   + import_author_zot ($x) + 

Function Documentation

@@ -265,6 +267,24 @@ Functions

Referenced by rpost_callback(), and rpost_content().

+
+
+ +
+
+ + + + + + + + +
import_author_zot ( $x)
+
+ +

Referenced by import_author_xchan().

+
@@ -1008,7 +1028,7 @@ which will be processed and delivered before this function ultimately returns.
Returns
boolean true if successful, else false
-

Referenced by connections_content(), import_author_xchan(), onepoll_run(), and post_post().

+

Referenced by connections_content(), import_author_zot(), onepoll_run(), and post_post().

-- cgit v1.2.3