úÎ^çYV=      !"#$%&'()*+,-./0123456789:;<portable experimentalpxqr.sta@gmail.com Safe-InferredGeneric KRPC message. ;Response messages are sent upon successful completion of a  query: > KResponse used to signal that callee successufully process a 7 procedure call and to return values from procedure. < KResponse should not be sent if error occurred during RPC,   should be sent instead. 3 KResponse can be only sent from server to client. = containing return values; match to the corresponding . @Query used to signal that caller want to make procedure call to E callee and pass arguments in. Therefore query may be only sent from 5 client to server but not in the opposite direction. values to be passed to method; method to call; one-time query token. @Errors are sent when a query cannot be fulfilled. Error message B can be send only from server to client but not in the opposite  direction. the type of error; human-readable text message; match to the corresponding . Types of RPC errors. 2Occur when client trying to call method server don't know. 2Malformed packet, invalid arguments or bad token. 2Occur when server fail to process procedure call. Some error doesn't fit in any other category. =This transaction ID is generated by the querying node and is = echoed in the response, so responses may be correlated with A multiple queries to the same node. The transaction ID should be E encoded as a short string of binary numbers, typically 2 characters 4 are enough as they cover 2^16 outstanding queries.  Received  or   can not be decoded. A remote node has send some  this node is unable to  decode. >/Responses, or KRPC message dictionaries with a "y" value of  "r", contain one additional key "r". The value of "r" is a , dictionary containing named return values. Example Response packet: A { "t" : "aa", "y" : "r", "r" : { "msg" : "you've sent: hi!" } } ?-Queries, or KRPC message dictionaries with a "y" value of  "q", contain two additional keys; "q" and "a". Key "q" has = a string value containing the method name of the query. Key "a" A has a dictionary value containing named arguments to the query. Example Query packet: B { "t" : "aa", "y" : "q", "q" : "ping", "a" : { "msg" : "hi!" } } @,Errors, or KRPC message dictionaries with a "y" value of "e",  contain one additional key "e". The value of "e" is a @ list. The first element is an integer representing the error = code. The second element is a string containing the error  message. Example Error Packet:  = { "t": "aa", "y":"e", "e":[201, "A Generic Error Ocurred"]}  or bencoded: 5 d1:eli201e23:A Generic Error Ocurrede1:t2:aa1:y1:ee AAccording to the table:   /http://bittorrent.org/beps/bep_0005.html#errors # BC>?D@EA     BC>?D@EAportable experimentalpxqr.sta@gmail.comNone =In order to perform or handle KRPC query you need to provide  corresponding   class.  Example:  * data Ping = Ping Text deriving BEncode * data Pong = Pong Text deriving BEncode   instance   Ping Pong where  method = "ping" !4Method name. Default implementation uses lowercased req  datatype name. "=Method datatype used to describe method name, parameters and 4 return values of procedure. Client use a method to invoke , server   implements% the method to make the actual work. :We use the following fantom types to ensure type-safiety: # param: Type of method parameters. - result: Type of return value of the method. F Example:  show (Method "concat" :: [Int] Int) == "concat :: [Int] -> Int" !"#$GF !"#$"#$ ! !"#$GFportable experimentalpxqr.sta@gmail.comNone% Used to signal protocol errors. &for e.g.: bad session token. 'for e.g.: node calls herself; (Used to signal : errors. )remote node not responding. *remote node return error; +unable to send query; ,-A monad which can perform or handle queries. -Ask for manager. .)Can be used to add logging for instance. /#Keep track pending queries made by this node and handle queries  made by remote nodes. 06Handler is a function which will be invoked then some remote  node querying this node. 1RPC manager options. 3Initial  incremented with each :; 48Time to wait for response from remote node, in seconds. 5$Maximum number of bytes to receive. 6?Bind socket to the specified address. To enable query handling  run <. 7,Unblock all pending calls and close socket. 8>Normally you should use Control.Monad.Trans.Resource.allocate  function. 9How many times : call have been performed. :!Enqueue query to the given node. This function should throw ( exception if quered node  respond with error' message or the query timeout expires. ;AMake handler from handler function. Any thrown exception will be = supressed and send over the wire back to the querying node. If the handler make some : normally it should handle  corresponding (s. <Should be run before any :, otherwise they will never  succeed. HPermissive defaults. =%&'()*+,-./IJKLMNO0PQRSTU12345VWXYZ6various protocol options; address to listen on; %handlers to run on incoming queries. new rpc manager. 78[\]9^_`a:bc;defghi<jklH%&'()*+,-./0123456789:;<,-.12345/678<(+*):9%'&0;+%'&(+*),-./IJKLMNO0PQRSTU12345VWXYZ678[\]9^_`a:bc;defghi<jklHportable experimentalpxqr.sta@gmail.comNone% !"%&'()*+,-./0123456789:;<%" !(+*):9%'&0;,-.12345/678<m         !"#$%&'(()*+,-./01234566789:;<=>?@ABCDEFGHIJKLMN4OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr krpc-0.6.0.0 Network.KRPCNetwork.KRPC.MessageNetwork.KRPC.MethodNetwork.KRPC.Managerdata-default-class-0.0.1Data.Default.Classdefnetwork-2.4.1.2Network.Socket.Types SockAddrInet SockAddrInet6 SockAddrUnixSockAddrKMessageERQ KResponserespValsrespIdKQuery queryArgs queryMethodqueryId MethodNameKError errorCode errorMessageerrorId ErrorCode MethodUnknown ProtocolError ServerError GenericError TransactionId decodeErrorunknownMessageKRPCmethodMethod methodNameHandlerFailureInvalidParameter BadAddress QueryFailureTimeoutExpired QueryFailed SendFailed MonadKRPC getManager liftHandlerManagerHandlerOptionsoptSeedTransactionoptQueryTimeout optMaxMsgSize newManager closeManager withManager getQueryCountqueryhandlerlistenbencoding-0.4.3.0Data.BEncode.TypesBDict$fBEncodeKResponse$fBEncodeKQuery$fBEncodeKError$fEnumErrorCodeunknownTransaction$fBEncodeKMessage$fExceptionKError$fBEncodeErrorCode $fShowMethod showsMethod$fDefaultOptionssockoptionslistenerThreadtransactionCounter pendingCallshandlers HandlerBody PendingCallsCallResCallIdTransactionCounterKResultdefaultSeedTransactiondefaultQueryTimeoutdefaultMaxMsgSizevalidateOptionssockAddrFamilyquerySignature sendMessagegenTransactionId registerQueryunregisterQuery queryResponse sendQueryprettyHFprettyQF runHandlerdispatchHandler handleQueryhandleResponse handleMessagelistener$fExceptionHandlerFailure$fExceptionQueryFailure$fMonadKRPChReaderT