lib/rflow/components/http/extensions.rb in rflow-components-http-1.1.0 vs lib/rflow/components/http/extensions.rb in rflow-components-http-1.1.1
- old
+ new
@@ -1,9 +1,112 @@
class RFlow
+ # @!parse
+ # # Fake classes in this tree to document the actual message types.
+ # class Message
+ # # Fake classes in this tree to document the actual message types.
+ # class Data
+ # # HTTP messages.
+ # module HTTP
+ # # RFlow message representing an HTTP request.
+ # class Request
+ # # @!attribute client_ip
+ # # The IP the request originated from.
+ # # @return [String]
+ #
+ # # @!attribute client_port
+ # # The port the request originated from.
+ # # @return [Integer]
+ #
+ # # @!attribute server_ip
+ # # The IP the request went to.
+ # # @return [String]
+ #
+ # # @!attribute server_port
+ # # The port the request went to.
+ # # @return [Integer]
+ #
+ # # @!attribute method
+ # # The HTTP method (POST, GET, etc.).
+ # # @return [String]
+ #
+ # # @!attribute uri
+ # # The URI the request was for.
+ # # @return [String]
+ #
+ # # @!attribute query_string
+ # # The query string attached to the URI.
+ # # @return [String]
+ #
+ # # @!attribute protocol
+ # # The HTTP protocol being used for the request.
+ # # @return [String]
+ #
+ # # @!attribute headers
+ # # The HTTP request headers.
+ # # @return [Hash]
+ #
+ # # @!attribute content
+ # # The HTTP body content.
+ # # @return [String]
+ #
+ # # Just here to force Yard to create documentation.
+ # # @!visibility private
+ # def initialize; end
+ # end
+ #
+ # # RFlow message representing an HTTP response.
+ # class Response
+ # # @!attribute client_ip
+ # # The IP the response is going to.
+ # # @return [String]
+ #
+ # # @!attribute client_port
+ # # The port the response is going to.
+ # # @return [Integer]
+ #
+ # # @!attribute server_ip
+ # # The IP the response is coming from.
+ # # @return [String]
+ #
+ # # @!attribute server_port
+ # # The port the response is coming from.
+ # # @return [Integer]
+ #
+ # # @!attribute protocol
+ # # The HTTP protocol being used for the response.
+ # # @return [String]
+ #
+ # # @!attribute status_code
+ # # The HTTP response code.
+ # # @return [Integer]
+ #
+ # # @!attribute status_reason_phrase
+ # # The server-supplied reason phrase (+OK+, +Moved Temporarily+, etc.) for the {status_code}.
+ # # @return [String]
+ #
+ # # @!attribute headers
+ # # The HTTP response headers.
+ # # @return [Hash]
+ #
+ # # @!attribute content
+ # # The HTTP response body content.
+ # # @return [String]
+ #
+ # # Just here to force Yard to create documentation.
+ # # @!visibility private
+ # def initialize; end
+ # end
+ # end
+ # end
+ # end
+
+ # Code for RFlow components.
module Components
module HTTP
+ # @!visibility private
module Extensions
+ # @!visibility private
module IPConnectionExtension
# Default accessors
# TODO: validate the stuffs
['client_ip', 'client_port', 'server_ip', 'server_port'].each do |name|
define_method name do |*args|
@@ -14,11 +117,13 @@
end
end
end
# Need to be careful when extending to not clobber data already in data_object
+ # @!visibility private
module HTTPRequestExtension
+ # @!visibility private
def self.extended(base_data)
base_data.data_object ||= {'uri' => '/', 'method' => 'GET', 'protocol' => 'HTTP/1.0', 'headers' => {}, 'content' => ''}
end
# Default accessors
@@ -31,10 +136,12 @@
end
end
end
# Need to be careful when extending to not clobber data already in data_object
+ # @!visibility private
module HTTPResponseExtension
+ # @!visibility private
def self.extended(base_data)
base_data.data_object ||= {'protocol' => 'HTTP/1.0', 'status_code' => 200, 'status_reason_phrase' => 'OK', 'headers' => {}, 'content' => ''}
end
# Default accessors