swagger: '2.0'
info:
  title: 'QA | Cloudshark PV'
  version: '2.0.0'
  description: Packet analysis API for PCAP files.
basePath: /api/v2/analysis
schemes:
  - http

tags:
  - name: Health
  - name: Assets
  - name: File
  - name: Packets
  - name: Util
  - name: Follow
  - name: Stats
  - name: RTP
    x-go-name: rtp
  - name: HTTP
    x-go-name: httpreq
  - name: Hosts

paths:
  /health:
    get:
      tags:
        - Health
      operationId: getHealth
      summary: 'Check health of API'
      produces:
        - 'application/json'
      responses:
        '200':
          description: 'success'
          schema:
            $ref: '#/definitions/HealthResponse'
        '500':
          description: 'internal error'
          schema:
            $ref: '#/definitions/ApiError'
  /assets/map:
    get:
      tags:
        - Assets
      operationId: getMap
      summary: Static world map
      produces:
        - application/json
      responses:
        '200':
          description: An object containing GeoJSON map data
          schema:
            $ref: '#/definitions/MapResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ApiError'
  /status:
    get:
      tags:
        - File
      operationId: getStatus
      summary: 'Returns information about a currently loaded file'
      produces:
        - 'application/json'
      responses:
        '200':
          description: 'success'
          schema:
            $ref: '#/definitions/StatusResponse'
        '500':
          description: 'internal error'
          schema:
            $ref: '#/definitions/ApiError'

  /packets/list:
    get:
      tags:
        - Packets
      operationId: listPackets
      summary: 'Return a list of packets with the specified columns'
      parameters:
        - name: filter
          description: a display filter to apply to the returned list of packets
          type: string
          default: ''
          in: query
        - name: start
          type: number
          format: uint32
          in: query
          default: 0
        - name: count
          type: number
          format: uint32
          in: query
          description: The number of packets to return
          default: 1000
        - name: columns
          description: A comma separated list of packet fields to return the data for
          type: array
          items:
            type: string
          collectionFormat: csv
          in: query
          default: []
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/PacketsResponse'
        '500':
          description: Internal Error
          schema:
            $ref: '#/definitions/ApiError'

  /packets/fields:
    get:
      tags:
        - Packets
      operationId: getPacketFields
      summary: 'Return an array of packets with the specified fields returned in a map'
      parameters:
        - name: filter
          description: a display filter to apply to the returned list of packets
          type: string
          default: ''
          in: query
        - name: start
          type: number
          format: uint32
          in: query
          default: 0
        - name: count
          type: number
          format: uint32
          in: query
          description: The number of packets to return
          default: 1000
        - name: fields
          description: A comma separated list of up to 32 fields to return
          type: array
          items:
            type: string
          collectionFormat: csv
          in: query
          default: []
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/PacketFieldsResponse'
        '500':
          description: Internal Error
          schema:
            $ref: '#/definitions/ApiError'

  /packets/decode:
    get:
      tags:
        - Packets
      operationId: getDecode
      summary: Return the full packet tree and raw bytes of the requested packet
      parameters:
        - name: frame
          type: number
          format: uint32
          minimum: 1
          required: true
          in: query
        - name: prev_frame
          type: number
          format: uint32
          required: false
          in: query
      responses:
        '200':
          description: 'success'
          schema:
            $ref: '#/definitions/DecodeResponse'
        '500':
          description: internal error"
          schema:
            $ref: '#/definitions/ApiError'

  /util/checkfilter:
    get:
      tags:
        - Util
      operationId: checkFilter
      summary: tests a display filter to see if it is valid
      parameters:
        
        - name: f
          type: string
          required: true
          in: query
          description: the display filter string to tests
      responses:
        '200':
          description: the result of checking the display filter
          schema:
            $ref: '#/definitions/FilterCheckResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'
  /util/autocomplete:
    get:
      tags:
        - Util
      operationId: autocomplete
      summary: get autocomplete suggestions for the provided field or preference
      parameters:
        
        - name: field
          type: string
          required: false
          in: query
          description: a partial or complete field string to perform autocompelete on
        - name: preference
          type: string
          required: false
          in: query
          description: a partial or complete preference string to perform autocomplete on
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/AutocompleteResponse'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/ApiError'
        '500':
          description: an error occured
          schema:
            $ref: '#/definitions/ApiError'

  /follow/{protocol}:
    get:
      tags:
        - Follow
      operationId: followStream
      summary: 'Follow Stream data for the specified protocol and filter expression'
      parameters:
        - name: protocol
          in: path
          type: string
          required: true
        - name: filter
          in: query
          type: string
          required: true
        - name: sub_stream
          in: query
          type: number
          format: uint64
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/FollowStreamResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /stats/conversations:
    get:
      operationId: getConversations
      tags:
        - Stats
      summary: 'List conversation stats for the given protocol'
      parameters:
        - name: protocol
          in: query
          type: string
          required: true
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/ConversationsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /stats/dns:
    get:
      operationId: getDNSStats
      tags:
        - Stats
      summary: List of DNS stats for file
      parameters:
        - name: filter
          in: query
          type: string
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/DNSStatsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /stats/endpoints:
    get:
      operationId: getEndpoints
      tags:
        - Stats
      summary: 'List all endpoints for a given protocol'
      parameters:
        - name: protocol
          in: query
          type: string
          required: true
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/EndpointsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /stats/hierarchy:
    get:
      operationId: getProtoHierarchy
      tags:
        - Stats
      summary: The protocol hierarchy tree
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/ProtoHierarchyResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /stats/sip:
    get:
      tags:
        - Stats
      summary: 'List conversation stats'
      parameters:
        - name: filter
          in: query
          type: string
          required: false
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/SIPResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /rtp/streams:
    get:
      operationId: getRTPStreams
      tags:
        - RTP
      summary: List of RTP streams found in the file
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/RTPStreamsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /rtp/save:
    get:
      tags:
        - RTP
      summary: Retrieve WAV audio of the specified RTP stream
      parameters:
        - name: source
          in: query
          description: The source IP address of the RTP stream
          type: string
          required: true
        - name: source_port
          in: query
          description: The source port of the RTP stream
          type: number
          format: uint
          required: true
        - name: dest
          in: query
          description: The destination IP address of the RTP stream
          type: string
          required: true
        - name: dest_port
          in: query
          description: the destination port of the RTP stream
          type: number
          format: uint
          required: true
        - name: ssrc
          in: query
          description: The SSRC identifying the RTP stream
          required: true
          type: string
      produces:
        - audio/wav
      responses:
        '200':
          description: The requested RTP audio as a WAV file
          schema:
            type: file
          headers:
            Content-Disposition:
              type: string
            Content-Type:
              type: string
        '404':
          description: The requested stream was not found
          schema:
            $ref: '#/definitions/ApiError'

        '500':
          description: 'The audio for the requested stream is not available'
          schema:
            $ref: '#/definitions/ApiError'

  /http/requests:
    get:
      tags:
        - HTTP
      summary: Summary list of HTTP requests made within the file grouped by host
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/HTTPRequestsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /http/objects:
    get:
      tags:
        - HTTP
      summary: 'List the available HTTP Objects from the file'
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/HTTPObjectsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /http/objects/{token}:
    get:
      tags:
        - HTTP
      operationId: downloadHTTPObject
      summary: Download the raw bytes for the given HTTP Object token
      parameters:
        - name: token
          in: path
          type: string
          required: true
      produces:
        - application/octet-stream
      responses:
        '200':
          description: The requested object downloaded as a file
          schema:
            type: file
          headers:
            Content-Disposition:
              type: string
            Content-Type:
              type: string
        '404':
          description: The requested object was not found
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /http/details:
    get:
      tags:
        - HTTP
      operationId: getHTTPDetails
      summary: Detailed list of HTTP requests and responses from the file
      parameters:
        - name: filter
          in: query
          type: string
          description: an optional display filter to limit the HTTP Request data
          default: ''
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/HTTPDetailsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /hosts:
    get:
      tags:
        - Hosts
      summary: A list of resolved hostnames contained in the file
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/HostsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /voip/calls:
    get:
      tags:
        - VOIP
      summary: A list of the VoIP calls contained in the file
      parameters:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/VoIPCallsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /voip/conversations:
    get:
      tags:
        - VOIP
      summary: VoIP conversation records including SIP signaling and RTP streams
      parameters:
        - name: callid
          in: query
          type: number
          format: integer
          description: A call or conversation identifier with -1 corresponding to 'all calls'
          default: -1
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/VoIPConvsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  /dns/lookups:
    get:
      tags:
        - DNS
      summary: A list of DNS lookups found in the file including queries without responses and responses without queries
      parameters:
        - name: filter
          in: query
          type: string
          description: an optional additional display filter to further limit the DNS lookup data
          default: ''
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                $ref: '#/definitions/DNSLookupsResponse'
        '500':
          description: an error occurred
          schema:
            $ref: '#/definitions/ApiError'

  ##
  ## Definitions
  ##

definitions:
  ApiError:
    type: object
    properties:
      status:
        type: string
      message:
        type: string
      message_id:
        type: string
  StatusResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: object
        required:
          - filename
          - duration
          - filesize
          - frames
          - columns
        properties:
          filename:
            type: string
          duration:
            type: number
          filesize:
            type: integer
            format: uint32
          frames:
            type: integer
            format: uint32
          columns:
            type: array
            items:
              $ref: '#/definitions/ColumnInfo'

  ColumnInfo:
    type: object
    required:
      - title
      - format
      - visible
      - resolved
    properties:
      title:
        type: string
      format:
        type: string
      visible:
        type: boolean
      resolved:
        type: boolean

  PacketsResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: object
        required:
          - packets
        properties:
          packets:
            type: array
            items:
              $ref: '#/definitions/PacketSummary'

  PacketSummary:
    type: object
    required:
      - fg
      - bg
      - num
      - c
    properties:
      fg:
        type: string
        description: 'CSS compatible hex representation of foreground color'
      bg:
        type: string
        description: 'CSS compatible hex representation of background color'
      num:
        type: number
        format: uint64
        description: The packet number in the file starting from one
      c:
        type: array
        items:
          type: string
        description: An array of strings corresponding to the requested columns for the packet data
      pf:
        type: number
        format: uint64
        x-omitempty: true
        description: The previously displayed packet number when the list was generated
      comments:
        type: array
        items:
          type: string
        x-omitempty: true
        description: An optional array of comments for the packet read from the file

  PacketFieldsResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: object
        required:
          - packets
        properties:
          packets:
            type: array
            items:
              $ref: '#/definitions/PacketWithFields'

  PacketWithFields:
    type: object
    required:
      - fg
      - bg
      - num
      - fields
    properties:
      fg:
        type: string
        description: 'CSS compatible hex representation of foreground color'
      bg:
        type: string
        description: 'CSS compatible hex representation of background color'
      num:
        type: number
        format: uint64
        description: The packet number in the file starting from one
      pf:
        type: number
        format: uint64
        x-omitempty: true
        description: The previously displayed packet number when the list was generated
      comments:
        type: array
        items:
          type: string
        x-omitempty: true
        description: An optional array of comments for the packet read from the file
      fields:
        type: object
        additionalProperties:
          type: string

  DecodeResponse:
    type: object
    required:
      - data
    properties:
      data:
        $ref: '#/definitions/DecodeTree'

  DecodeTree:
    type: object
    required:
      - tree
      - bytes
      - tabs
      - followers
    properties:
      err:
        type: number
      tree:
        type: array
        items:
          $ref: '#/definitions/DecodeTreeItem'
      bytes:
        type: string
        description: base64 of frame bytes
      tabs:
        type: array
        description: 'additional data tabs'
        items:
          $ref: '#/definitions/AsciiTab'
      followers:
        type: array
        description: array of followers
        items:
          $ref: '#/definitions/Follower'

  Follower:
    type: object
    required:
      - protocol
      - filter
    properties:
      protocol:
        type: string
        description: protocol
      filter:
        type: string
        description: filter string
      stream:
        type: number
        format: uint64
        description: stream number
        minimum: 0
      sub_stream:
        type: number
        format: uint64
        description: substream number
        minimum: 0

  AutocompleteResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: object
        required:
          - suggestions
        properties:
          suggestions:
            type: array
            description: possible autocompletions
            items:
              $ref: '#/definitions/AutocompleteSuggestion'

  AutocompleteSuggestion:
    type: object
    required:
      - field
      - name
    properties:
      field:
        type: string
        description: the actual field value that can be suggested as a autocompletion
      name:
        type: string
        description: a human readable name for this autocomplete suggestion

  DecodeTreeItem:
    type: object
    required:
      - l
      - fn
      - f
      - e
      - eid
      - ds
    properties:
      l:
        type: string
        description: label
      fn:
        type: string
        description: fieldname
      f:
        type: string
        description: filter string
      e:
        type: number
        format: uint32
        description: subtree ett index
      eid:
        type: string
        description: subtree ett index unique ID
        x-omitempty: false
      ds:
        type: number
        format: uint32
        description: 'ascii-tab index for this field'
        x-omitempty: false
      n:
        type: array
        items:
          $ref: '#/definitions/DecodeTreeItem'
        description: subtree nodes
      h:
        type: array
        items:
          type: integer
          format: uint32
        x-nullable: true
        description: item start, item length
      g:
        type: boolean
        description: generated
      t:
        type: string
        enum: ['proto', 'framenum', 'url']
        description: Type of node, returned only if node is a protocol layer (proto), a reference to another packet (framenum) or a link (url)
      fnum:
        type: number
        format: int32
        description: packet number only if t is framenum

  AsciiTab:
    type: object
    required:
      - name
      - bytes
    properties:
      name:
        type: string
        description: title of the ascii tabs
      bytes:
        type: string
        description: base64 encoded tab data

  FilterCheckResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: object
        required:
          - status
        properties:
          status:
            type: string
            description: Set to OK if the filter is valid. Error if not.
          message:
            type: string
          warning:
            type: string

  FollowStreamPayload:
    type: object
    required:
      - n
      - d
      - s
    properties:
      n:
        description: The frame number containing this payload
        type: integer
        format: uint32
      d:
        description: The data of this payload encoded as base64
        type: string
        x-omitempty: false
      s:
        description: a flag indicating if this payload came from the server
        type: boolean
        x-omitempty: false

  FollowStreamResponse:
    type: object
    required:
      - shost
      - sport
      - sbytes
      - chost
      - cport
      - cbytes
    properties:
      shost:
        description: The server's hostname or ip address
        type: string
      sport:
        description: the port number used by the server
        type: number
        format: uint32
      sbytes:
        description: the number of bytes sent by the server
        type: number
        format: uint32
      chost:
        description: the client's hostname or ip address
        type: string
      cport:
        description: the port number used by the client's
        type: number
        format: uint32
      cbytes:
        description: the number of bytes sent by the client
        type: number
        format: uint32
      payloads:
        type: array
        items:
          $ref: '#/definitions/FollowStreamPayload'

  ConversationsResponse:
    type: object
    required:
      - proto
      - geoip
      - convs
    properties:
      proto:
        description: the protocol used in the given conversation
        type: string
      geoip:
        description: if geoip information is available or not
        type: boolean
      convs:
        type: array
        items:
          $ref: '#/definitions/Conversation'

  Conversation:
    type: object
    required:
      - saddr
      - daddr
      - rxf
      - rxb
      - rx_rate
      - txf
      - txb
      - tx_rate
      - totalf
      - totalb
      - start
      - stop
      - duration
      - filter
    properties:
      saddr:
        description: the source address of the conversation
        type: string
      daddr:
        description: the destination address of the conversation
        type: string
      sport:
        description: the source port in the conversation
        type: string
        format: uint32
      dport:
        description: the destination port in the conversation
        type: string
        format: uint32
      rxf:
        description: the number of received frames
        type: integer
        format: uint32
      rxb:
        description: the number of received bytes
        type: integer
        format: uint32
      rx_rate:
        description: the receive rate
        type: number
        format: float
      txf:
        description: the number of transmitted frames
        type: integer
        format: uint32
      txb:
        description: the number of transmitted bytes
        type: integer
        format: uint32
      tx_rate:
        description: the transmit rate
        type: number
        format: float
      totalf:
        description: the total number of frames transmitted and received
        type: integer
        format: uint32
      totalb:
        description: the total number of bytes transmitted and received
        type: integer
        format: uint32
      start:
        description: relative time in seconds from the start of the file when the conversation started
        type: number
        format: float
      stop:
        description: relative time in seconds from the start of the file when the conversation ended
        type: number
        format: float
      duration:
        description: total duration of conversation in seconds
        type: number
        format: float
      filter:
        description: a display filter which can be used to filter on this conversation
        type: string

  EndpointsResponse:
    type: object
    required:
      - proto
      - geoip
      - hosts
    properties:
      proto:
        description: the protocol requested for the list of endpoints
        type: string
      geoip:
        description: whether geoip information is available
        type: boolean
      hosts:
        description: a list of endpoints for the given protocol
        type: array
        items:
          $ref: '#/definitions/Endpoint'

  Endpoint:
    type: object
    required:
      - host
      - rxf
      - rxb
      - txf
      - txb
      - totalf
      - totalb
      - filter
    properties:
      host:
        description: the name of the endpoint
        type: string
      port:
        description: the port number of the endpoint
        type: string
        x-omitempty: true
      rxf:
        description: the number of frames received by the endpoint
        type: integer
        format: uint32
      rxb:
        description: the number of bytes received by the endpoint
        type: integer
        format: uint32
      txf:
        description: the number of frames transmitted by the endpoint
        type: integer
        format: uint32
      txb:
        description: the number of bytes transmitted by the endpoint
        type: integer
        format: uint32
      totalf:
        description: the total number of frames transmitted and received by the endpoint
        type: integer
        format: uint32
      totalb:
        description: the total number of bytes transmitted and received by the endpoint
        type: integer
        format: uint32
      filter:
        description: a display filter which can be used to filter on this endpoint
        type: string
      geoip_country:
        description: the GeoIP resolved country name
        type: string
        x-omitempty: true
      geoip_country_iso:
        description: the ISO standardized version of the GeoIP resolved country name
        type: string
        x-omitempty: true
      geoip_city:
        description: the GeoIP resolved city name
        type: string
        x-omitempty: true
      geoip_as_org:
        description: the GeoIP resolved AS organization name
        type: string
        x-omitempty: true
      geoip_as:
        description: the GeoIP resolved AS Number
        type: integer
        format: uint32
        x-omitempty: true
      geoip_lat:
        description: the GeoIP resolved latitude value
        type: number
        format: float
        x-omitempty: true
      geoip_lon:
        description: the GeoIP resolved longitude value
        type: number
        format: float
        x-omitempty: true

  SIPResponse:
    type: object
    required:
      - messages
      - resent
      - requests
      - replies
      - setup_min
      - setup_avg
      - setup_max
    properties:
      messages:
        description: The number of SIP messages seen
        type: integer
        format: uint32
      resent:
        description: The number of SIP messages that had to be reset
        type: integer
        format: uint32
      requests:
        type: object
        additionalProperties:
          type: integer
          format: uint32
      replies:
        type: object
        additionalProperties:
          type: integer
          format: uint32
      setup_min:
        type: integer
        format: uint32
      setup_avg:
        type: integer
        format: uint32
      setup_max:
        type: integer
        format: uint32

  RTPStreamsResponse:
    type: object
    required:
      - streams
    properties:
      streams:
        type: array
        items:
          $ref: '#/definitions/RTPStream'

  RTPStream:
    type: object
    required:
      - ssrc
      - payload
      - saddr
      - sport
      - daddr
      - dport
      - start_time
      - duration
      - pkts
      - lost
      - lost_percent
      - max_delta
      - min_delta
      - mean_delta
      - min_jitter
      - max_jitter
      - mean_jitter
      - expectednr
      - totalnr
      - ipver
    properties:
      ssrc:
        description: The SSRC identifier
        type: string
      payload:
        description: The RTP payload type
        type: string
      saddr:
        description: The source IP address
        type: string
      sport:
        description: The source port
        type: integer
        format: uint32
      daddr:
        description: The destination IP address
        type: string
      dport:
        description: The destination port
        type: integer
        format: uint32
      start_time:
        description: The start time in seconds relative to the start of the capture file
        type: number
      duration:
        description: The duration of the RTP stream in seconds
        type: number
      pkts:
        description: The number of packets
        type: integer
        format: uint32
      lost:
        description: The number of lost packets
        type: integer
        format: uint32
      lost_percent:
        type: number
        description: The percentage of lost packets
      max_delta:
        description: The maximum delta in timestamps of packets
        type: number
      min_delta:
        description: The minimum delta in timestamps of packets
        type: number
      mean_delta:
        description: The mean delta in timestamps of packets
        type: number
      min_jitter:
        description: The minimum jitter of packets
        type: number
      max_jitter:
        description: The maximum jitter of packets
        type: number
      mean_jitter:
        description: The mean jitter of packets
        type: number
      expectednr:
        description: The expected number of packets
        type: integer
        format: uint32
      totalnr:
        description: The total number of packets
        type: integer
        format: uint32
      problem:
        description: Indicates whether there is a problem with the RTP stream.
        type: boolean
      ipver:
        type: integer
        format: uint32
        description: The IP version used (4 or 6)

  HTTPRequestsResponse:
    type: object
    required:
      - requests
    properties:
      requests:
        description: The tree of HTTP requests broken down by host
        type: array
        items:
          $ref: '#/definitions/HTTPRequest'

  HTTPRequest:
    type: object
    required:
      - name
      - count
      - perc
      - sub
    properties:
      name:
        type: string
        description: The requested Hostname or URL
      count:
        description: The number of requests made for this resource
        type: integer
        format: int32
      perc:
        description: The percentage this request makes of the total at this level of the tree
        type: number
        format: float
      sub:
        description: A sub array of requests
        type: array
        items:
          $ref: '#/definitions/HTTPRequest'

  HTTPObjectsResponse:
    type: object
    required:
      - objects
    properties:
      objects:
        type: array
        items:
          $ref: '#/definitions/HTTPObject'

  HTTPObject:
    type: object
    required:
      - packet
      - length
      - object
    properties:
      packet:
        description: The starting packet number of object
        type: integer
        format: int32
      hostname:
        description: The hostname the object was downloaded from
        type: string
      content-type:
        description: The content-type describing the object
        type: string
      filename:
        description: The filename used during the download or transfer
        type: string
      length:
        description: The length in bytes of the object
        type: integer
        format: int32
      object:
        description: A download token which can be used to retrieve the raw bytes of the object from the Download endpoint
        type: string
      sha1:
        description: The SHA1 hash of the contents of the object.
        type: string

  HTTPDetailsResponse:
    type: object
    required:
      - data
    properties:
      data:
        type: array
        items:
          $ref: '#/definitions/HTTPRequestDetail'

  HTTPRequestDetail:
    type: object
    required:
      - timestamp
      - client
      - server
      - request_frame
      - response_frame
      - response_time
      - host
      - method
      - response_code
      - response_phrase
      - uri
      - stream
    properties:
      timestamp:
        description: 'ISO 8601 formatting timestamp string with millisecond precision in UTC. Format: YYYY-MM-DDTHH:mm:ss.sssZ'
        type: string
        format: date-time
        example: '2024-10-17:14:30:15.123Z'
      client:
        description: The client's name or IP address who made the HTTP request
        type: string
      server:
        description: The server's name or IP address that responded to the HTTP request
        type: string
      request_frame:
        description: The frame number of the HTTP request
        type: integer
        format: uint32
      response_frame:
        description: The frame number of the HTTP response
        type: integer
        format: uint32
      response_time:
        description: The time in seconds that it took the server to return a response
        type: number
        format: float64
      host:
        description: The value from the Host header in the request
        type: string
      method:
        description: The HTTP method used in the request
        type: string
      response_code:
        description: The HTTP response status code for the request
        type: number
        format: uint16
      response_phrase:
        description: The HTTP response status message for the request
        type: string
      uri:
        description: The URI of the HTTP request without the host or scheme
        format: string
      stream:
        description: The follow-stream filter expression for this request
        format: string

  DNSStatsResponse:
    type: object
    required:
      - stats
    properties:
      stats:
        description: The tree of DNS stats
        type: array
        items:
          $ref: '#/definitions/DNSStat'

  DNSStat:
    type: object
    required:
      - name
      - count
      - sub
    properties:
      name:
        type: string
        description: The name of the DNS stat
      count:
        description: The count for this stat
        type: integer
        format: int
      avg:
        description: The average for this stat
        type: number
        format: float64
        minimum: 0.0
      min:
        description: The minimum for this stat
        type: number
        format: float64
        minimum: 0.0
      max:
        description: The maximum for this stat
        type: number
        format: float64
        minimum: 0.0
      perc:
        description: The percentage for this stat
        type: number
        format: float64
        minimum: 0.0
      sub:
        description: A sub array of stats
        type: array
        items:
          $ref: '#/definitions/DNSStat'

  ProtoHierarchyResponse:
    type: object
    required:
      - protos
    properties:
      protos:
        description: The list of protocols
        type: array
        items:
          $ref: '#/definitions/ProtoHierarchy'

  ProtoHierarchy:
    type: object
    required:
      - proto
      - frames
      - frames_percent
      - bytes
      - bytes_percent
      - filter
      - protos
    properties:
      proto:
        description: The protocol name
        type: string
      frames:
        description: The number of frames using this protocol
        type: integer
        format: uint32
      frames_percent:
        description: Percentage of the total frames this protocol makes up
        type: number
        format: float64
      bytes:
        description: The total number of bytes for this protocol
        type: integer
        format: uint64
      bytes_percent:
        description: Percentage of the total bytes this protocol makes up
        type: number
        format: float64
      filter:
        description: The display filter for this protocol in the context of the tree and its parents
        type: string
      protos:
        description: The sub-protocols of this protocol
        type: array
        items:
          $ref: '#/definitions/ProtoHierarchy'

  VoIPCallsResponse:
    type: object
    required:
      - calls
    properties:
      calls:
        description: The list of calls
        type: array
        items:
          $ref: '#/definitions/VoIPCall'

  VoIPCall:
    type: object
    required:
      - call
      - start_time
      - stop_time
      - initial_speaker
      - from
      - to
      - protocol
      - packets
      - state
    properties:
      call:
        description: The call identifier
        type: integer
        format: uint16
      start_time:
        description: The start time for the call
        type: number
        format: float64
      stop_time:
        description: The stop time for the call
        type: number
        format: float64
      initial_speaker:
        description: The initial speaker in the call
        type: string
      from:
        description: The call's From address
        type: string
      to:
        description: The call's To address
        type: string
      protocol:
        description: The protocol used in the call
        type: string
      packets:
        description: The number of packets in the call
        type: integer
        format: uint32
      state:
        description: The call's state
        type: string
      comment:
        description: The call's comment
        type: string

  VoIPConvsResponse:
    type: object
    required:
      - conversations
    properties:
      conversations:
        description: The list of conversations
        type: array
        items:
          $ref: '#/definitions/VoIPConv'

  VoIPConv:
    type: object
    required:
      - frame
      - call
      - time
      - dst_addr
      - dst_port
      - src_addr
      - src_port
    properties:
      frame:
        description: The conversation's frame
        type: integer
        format: uint32
      call:
        description: The conversation's identifier
        type: integer
        format: uint16
      time:
        description: The duration of the conversation
        type: string
      dst_addr:
        description: The conversation's destination address
        type: string
      dst_port:
        description: The conversation's destination port
        type: integer
        format: uint16
      src_addr:
        description: The conversation's source address
        type: string
      src_port:
        description: The conversation's source port
        type: integer
        format: uint16
      label:
        description: The label of the conversation
        type: string
      comment:
        description: A comment for the conversation
        type: string

  HostsResponse:
    type: object
    properties:
      ipv4_hosts:
        description: List of resolved IPv4 hostnames
        type: array
        items:
          $ref: '#/definitions/Host'
      ipv6_hosts:
        description: List of resolved IPv6 hostnames
        type: array
        items:
          $ref: '#/definitions/Host'

  Host:
    type: object
    required:
      - name
      - addr
    properties:
      name:
        description: The hostname found in the capture file
        type: string
      addr:
        description: The IPv4/IPv6 address the hostname resolved to
        type: string

  DNSLookupsResponse:
    type: object
    required:
      - lookups
    properties:
      lookups:
        description: The list of DNS Lookups
        type: array
        items:
          $ref: '#/definitions/DNSLookup'

  DNSLookup:
    type: object
    required:
      - timestamp
      - client
      - server
    properties:
      timestamp:
        description: 'ISO 8601 formatting timestamp string with millisecond precision in UTC. Format: YYYY-MM-DDTHH:mm:ss.sssZ'
        type: string
        format: date-time
        example: '2024-10-17:14:30:15.123Z'
      client:
        description: The hostname or IP of the client making the query or receiving the response
        type: string
      server:
        description: The hostname or IP of the DNS server receiving the query or sending the response
        type: string
      query_frame:
        description: The frame number of the DNS query packet
        type: number
        format: uint64
      query_type:
        type: string
      full_query:
        type: string
      public_suffix:
        description: The effective top-level domain plus one level (eTLD+1) based on the Mozilla Public Suffix list
        type: string
      response_frame:
        description: The frame numbers of the DNS response packet
        type: number
        format: uint64
      response_types:
        description: A list of distinct DNS types sent in the response
        type: array
        items:
          type: string
      answer_count:
        description: The number of answers included in the response
        type: number
        format: uint
        x-omitempty: false
      response_time:
        description: The time it took to respond to the query
        type: number
        format: float64
      rcode:
        description: The DNS response code provided by the response packet, describing any errors
        type: string
      txid:
        description: The DNS transaction ID field from the exchange. May be used to construct a display filter.
        type: string

  HealthResponse:
    type: object
    required:
      - healthy
    properties:
      healthy:
        description: Indicates if the API is healthy
        type: boolean

  MapResponse:
    type: object
    required:
      - map
    properties:
      map:
        description: A GeoJSON representation of countries on Earth.
        type: object
    example: # Sample object
      map: '...'
