Liking cljdoc? Tell your friends :D

puppetlabs.pcp.broker.core


add-connection!clj

(add-connection! broker connection)

Inputs: [broker :- Broker connection :- Connection] Returns: shared/BrokerDatabase

Add a Connection to the ':inventory' to track the websocket and add a corresponding change record the ':updates' vector.

Inputs: [broker :- Broker connection :- Connection]
Returns: shared/BrokerDatabase

Add a Connection to the ':inventory' to track the websocket and add
a corresponding change record the ':updates' vector.
sourceraw docstring

all-controllers-disconnected?clj

(all-controllers-disconnected? broker)
source

authenticated?clj

(authenticated? message connection)

Inputs: [message :- Message connection :- Connection] Returns: s/Bool

Check if the cert name advertised by the sender of the message contained in the specified Message matches the cert name in the certificate of the given Connection

Inputs: [message :- Message connection :- Connection]
Returns: s/Bool

Check if the cert name advertised by the sender of the message contained in
 the specified Message matches the cert name in the certificate of the
 given Connection
sourceraw docstring

authorized?clj

(authorized? broker request connection)

Inputs: [broker :- Broker request :- Message connection :- (s/maybe Connection)] Returns: s/Bool

Check if the message within the specified message is authorized

Inputs: [broker :- Broker request :- Message connection :- (s/maybe Connection)]
Returns: s/Bool

Check if the message within the specified message is authorized
sourceraw docstring

build-websocket-handlersclj

(build-websocket-handlers broker codec)

Inputs: [broker :- Broker codec :- Codec] Returns: #:s{Keyword IFn}

Inputs: [broker :- Broker codec :- Codec]
Returns: #:s{Keyword IFn}
sourceraw docstring

close-expired-connections!clj

(close-expired-connections! broker)

Forces clients to reconnect because the broker's CRL is out of date

Forces clients to reconnect because the broker's CRL is out of date
sourceraw docstring

controller-connection-timeoutclj

source

default-message-handlerclj

(default-message-handler broker whitelist client message)

Inputs: [broker :- Broker whitelist :- #{s/Str} client :- Client message :- Message]

Inputs: [broker :- Broker whitelist :- #{s/Str} client :- Client message :- Message]
sourceraw docstring

expire-ssl-connectionsclj

(expire-ssl-connections broker)

Inputs: [broker :- Broker]

Inputs: [broker :- Broker]
sourceraw docstring

expire-ssl-connections*clj

(expire-ssl-connections* inventory)

Inputs: [inventory :- shared/Inventory]

Inputs: [inventory :- shared/Inventory]
sourceraw docstring

forget-controller-subscriptionclj

(forget-controller-subscription broker uri controller-disconnection-ms client)

Inputs: [broker :- Broker uri :- s/Str controller-disconnection-ms :- s/Int client :- Client]

Inputs: [broker :- Broker uri :- s/Str controller-disconnection-ms :- s/Int client :- Client]
sourceraw docstring

get-certificate-chainclj

(get-certificate-chain ssl-context-factory)

Return the first non-empty certificate chain encountered while scanning the entries in the key store of the specified org.eclipse.jetty.util.ssl.SslContextFactory$Server instance - ssl-context-factory.

Return the first non-empty certificate chain encountered while scanning the
entries in the key store of the specified org.eclipse.jetty.util.ssl.SslContextFactory$Server
instance - `ssl-context-factory`.
sourceraw docstring

get-localhost-hostnameclj

(get-localhost-hostname)

Inputs: [] Returns: s/Str

Return the hostname of the host executing the code.

Inputs: []
Returns: s/Str

Return the hostname of the host executing the code.
sourceraw docstring

get-webserver-cnclj

(get-webserver-cn webserver-context)

Inputs: [webserver-context :- jetty10-core/ServerContext] Returns: (s/maybe s/Str)

Return the common name from the certificate the webserver specified by its context - webserver-context - will use when establishing SSL connections or nil if there was a problem finding out the certificate (for instance when the webserver is not SSL enabled).

Inputs: [webserver-context :- jetty10-core/ServerContext]
Returns: (s/maybe s/Str)

Return the common name from the certificate the webserver specified by its
context - `webserver-context` - will use when establishing SSL connections
or nil if there was a problem finding out the certificate (for instance
when the webserver is not SSL enabled).
sourceraw docstring

initclj

(init options)

Inputs: [options :- InitOptions] Returns: Broker

Inputs: [options :- InitOptions]
Returns: Broker
sourceraw docstring

initiate-controller-connectionsclj

(initiate-controller-connections broker
                                 ssl-context
                                 controller-uris
                                 controller-allowlist
                                 controller-disconnection-ms)

Inputs: [broker :- Broker ssl-context :- SSLContext controller-uris :- [s/Str] controller-allowlist :- #{s/Str} controller-disconnection-ms :- s/Int] Returns: #:p{Uri Connection}

Create PCP Clients for each controller URI

Inputs: [broker :- Broker ssl-context :- SSLContext controller-uris :- [s/Str] controller-allowlist :- #{s/Str} controller-disconnection-ms :- s/Int]
Returns: #:p{Uri Connection}

Create PCP Clients for each controller URI
sourceraw docstring

InitOptionsclj

source

log-accessclj

(log-access lvl message-data)
source

make-associate_response-data-contentclj

(make-associate_response-data-content id reason-to-deny)

Inputs: [id reason-to-deny] Returns: p/AssociateResponse

Inputs: [id reason-to-deny]
Returns: p/AssociateResponse
sourceraw docstring

make-ring-requestclj

(make-ring-request message connection)

Inputs: [message :- Message connection :- (s/maybe Connection)] Returns: (s/maybe ring/Request)

Inputs: [message :- Message connection :- (s/maybe Connection)]
Returns: (s/maybe ring/Request)
sourceraw docstring

maybe-purge-clients!clj

(maybe-purge-clients! broker target-timestamp)

After having slept for the grace period, if all controllers are still disconnected and the latest disconnection timestamp matches that expected, purge all clients.

After having slept for the grace period, if all controllers are still
disconnected and the latest disconnection timestamp matches that expected,
purge all clients.
sourceraw docstring

maybe-update-databaseclj

(maybe-update-database uri ws change entry)
source

MessageValidationOutcomeclj

Outcome of validate-message

Outcome of validate-message
sourceraw docstring

on-controller-connect!clj

(on-controller-connect! broker controller-uri _ws)
source

on-message!clj

(on-message! broker ws bytes)

If the broker service is not running, close the WebSocket connection. Otherwise process the message. Association is assumed to be completed on connection.

If the broker service is not running, close the WebSocket connection.
Otherwise process the message. Association is assumed to be completed
on connection.
sourceraw docstring

process-associate-request!clj

(process-associate-request! broker message connection)
(process-associate-request! _ request connection reason-to-deny)

Inputs: ([broker :- Broker message :- Message connection :- Connection] [_ :- Broker request :- Message connection :- Connection reason-to-deny :- (s/maybe s/Str)]) Returns: (s/maybe Connection)

Send an associate_response that will be successful if:

  • a reason-to-deny is not specified as an argument nor determined by reason-to-deny-association;
  • the requester client_type is not server;
  • the specified WebSocket connection has not been associated previously. If the request gets denied, the WebSocket connection will be closed and the function returns nil. Otherwise, the 'Connection' object's state will be marked as associated and returned. Also, in case another WebSocket connection with the same client is currently associated, such old connection will be superseded by the new one (i.e. the old connection will be closed by the brocker).

Note that this function will not update the broker by removing the connection from the 'inventory' map. It is assumed that such update will be done asynchronously by the onClose handler.

Inputs: ([broker :- Broker message :- Message connection :- Connection] [_ :- Broker request :- Message connection :- Connection reason-to-deny :- (s/maybe s/Str)])
Returns: (s/maybe Connection)

Send an associate_response that will be successful if:
  - a reason-to-deny is not specified as an argument nor determined by
    reason-to-deny-association;
  - the requester `client_type` is not `server`;
  - the specified WebSocket connection has not been associated previously.
If the request gets denied, the WebSocket connection will be closed and the
function returns nil.
Otherwise, the 'Connection' object's state will be marked as associated and
returned. Also, in case another WebSocket connection with the same client
is currently associated, such old connection will be superseded by the new
one (i.e. the old connection will be closed by the brocker).

Note that this function will not update the broker by removing the connection
from the 'inventory' map. It is assumed that such update will be done
asynchronously by the onClose handler.
sourceraw docstring

process-inventory-requestclj

(process-inventory-request broker message connection)

Inputs: [broker :- Broker message :- Message connection :- Connection]

Process a request for inventory data. This function assumes that the requester client is associated. Returns nil.

Inputs: [broker :- Broker message :- Message connection :- Connection]

Process a request for inventory data.
 This function assumes that the requester client is associated.
 Returns nil.
sourceraw docstring

process-message!clj

(process-message! broker bytes ws)

Inputs: [broker :- Broker bytes :- (s/conditional bytes? bytes string? s/Str) ws :- Websocket]

Deserialize, validate (authentication, authorization, and expiration), and process the specified raw message. Return the 'Connection' object associated to the specified 'Websocket' in case it gets modified (hence the '!' in the function name), otherwise nil. Also, log the message validation outcome via 'pcp-access' logger.

Inputs: [broker :- Broker bytes :- (s/conditional bytes? bytes string? s/Str) ws :- Websocket]

Deserialize, validate (authentication, authorization, and expiration), and
process the specified raw message. Return the 'Connection' object associated
to the specified 'Websocket' in case it gets modified (hence the '!' in the
function name), otherwise nil.
Also, log the message validation outcome via 'pcp-access' logger.
sourceraw docstring

process-server-message!clj

(process-server-message! broker message connection)

Inputs: [broker :- Broker message :- Message connection :- Connection] Returns: (s/maybe Connection)

Process a message directed at the middleware

Inputs: [broker :- Broker message :- Message connection :- Connection]
Returns: (s/maybe Connection)

Process a message directed at the middleware
sourceraw docstring

reason-to-deny-associationclj

(reason-to-deny-association _ connection as)

Inputs: [_ :- Broker connection :- Connection as :- p/Uri] Returns: (s/maybe s/Str)

Returns an error message describing why the session should not be allowed, if it should be denied

Inputs: [_ :- Broker connection :- Connection as :- p/Uri]
Returns: (s/maybe s/Str)

Returns an error message describing why the session should not be
allowed, if it should be denied
sourceraw docstring

remove-connection!clj

(remove-connection! broker ws)

Inputs: [broker :- Broker ws :- Websocket] Returns: shared/BrokerDatabase

Remove a Connection from ':inventory' and possibly ':subscriptions' and add a corresponding change record the ':updates' vector.

Inputs: [broker :- Broker ws :- Websocket]
Returns: shared/BrokerDatabase

Remove a Connection from ':inventory' and possibly ':subscriptions' and
add a corresponding change record the ':updates' vector.
sourceraw docstring

schedule-client-purge!clj

(schedule-client-purge! broker timestamp controller-disconnection-ms)
source

session-association-request?clj

(session-association-request? message)

Inputs: [message :- Message] Returns: s/Bool

Return true if message is a session association message

Inputs: [message :- Message]
Returns: s/Bool

Return true if message is a session association message
sourceraw docstring

startclj

(start broker)

Inputs: [broker :- Broker]

Inputs: [broker :- Broker]
sourceraw docstring

start-clientclj

(start-client broker
              ssl-context
              controller-allowlist
              controller-disconnection-ms
              uri)

Inputs: [broker :- Broker ssl-context :- SSLContext controller-allowlist :- #{s/Str} controller-disconnection-ms :- s/Int uri :- s/Str]

Inputs: [broker :- Broker ssl-context :- SSLContext controller-allowlist :- #{s/Str} controller-disconnection-ms :- s/Int uri :- s/Str]
sourceraw docstring

start-crl-monitoring!clj

(start-crl-monitoring! broker)

Inputs: [broker :- Broker]

Start periodic refreshing of connections using outdated crls

Inputs: [broker :- Broker]

Start periodic refreshing of connections using outdated crls
sourceraw docstring

start-handlersclj

(start-handlers broker)
source

statusclj

(status broker level)

Inputs: [broker :- Broker level :- status-core/ServiceStatusDetailLevel] Returns: status-core/StatusCallbackResponse

Inputs: [broker :- Broker level :- status-core/ServiceStatusDetailLevel]
Returns: status-core/StatusCallbackResponse
sourceraw docstring

stopclj

(stop broker)

Inputs: [broker :- Broker]

Inputs: [broker :- Broker]
sourceraw docstring

stop-handlersclj

(stop-handlers broker)
source

validate-messageclj

(validate-message broker message connection is-association-request)

Inputs: [broker :- Broker message :- Message connection :- Connection is-association-request :- s/Bool] Returns: MessageValidationOutcome

Determine whether the specified message should be processed by checking, in order, if the message: 1) is an associate-request as expected during Session Association; 2) is authenticated; 3) is authorized; 4) does not use multicast delivery.

Inputs: [broker :- Broker message :- Message connection :- Connection is-association-request :- s/Bool]
Returns: MessageValidationOutcome

Determine whether the specified message should be processed by checking,
 in order, if the message: 1) is an associate-request as expected during
 Session Association; 2) is authenticated; 3) is authorized; 4) does not
 use multicast delivery.
sourceraw docstring

watch-crlclj

(watch-crl watcher broker ssl-context-factory)

Inputs: [watcher :- (s/protocol watch/Watcher) broker :- Broker ssl-context-factory :- SslContextFactory$Server]

Inputs: [watcher :- (s/protocol watch/Watcher) broker :- Broker ssl-context-factory :- SslContextFactory$Server]
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close