<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/securitycenter/v1/connection.proto

namespace Google\Cloud\SecurityCenter\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Contains information about the IP connection associated with the finding.
 *
 * Generated from protobuf message <code>google.cloud.securitycenter.v1.Connection</code>
 */
class Connection extends \Google\Protobuf\Internal\Message
{
    /**
     * Destination IP address. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>string destination_ip = 1;</code>
     */
    private $destination_ip = '';
    /**
     * Destination port. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>int32 destination_port = 2;</code>
     */
    private $destination_port = 0;
    /**
     * Source IP address.
     *
     * Generated from protobuf field <code>string source_ip = 3;</code>
     */
    private $source_ip = '';
    /**
     * Source port.
     *
     * Generated from protobuf field <code>int32 source_port = 4;</code>
     */
    private $source_port = 0;
    /**
     * IANA Internet Protocol Number such as TCP(6) and UDP(17).
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Connection.Protocol protocol = 5;</code>
     */
    private $protocol = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $destination_ip
     *           Destination IP address. Not present for sockets that are listening and not
     *           connected.
     *     @type int $destination_port
     *           Destination port. Not present for sockets that are listening and not
     *           connected.
     *     @type string $source_ip
     *           Source IP address.
     *     @type int $source_port
     *           Source port.
     *     @type int $protocol
     *           IANA Internet Protocol Number such as TCP(6) and UDP(17).
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Securitycenter\V1\Connection::initOnce();
        parent::__construct($data);
    }

    /**
     * Destination IP address. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>string destination_ip = 1;</code>
     * @return string
     */
    public function getDestinationIp()
    {
        return $this->destination_ip;
    }

    /**
     * Destination IP address. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>string destination_ip = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setDestinationIp($var)
    {
        GPBUtil::checkString($var, True);
        $this->destination_ip = $var;

        return $this;
    }

    /**
     * Destination port. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>int32 destination_port = 2;</code>
     * @return int
     */
    public function getDestinationPort()
    {
        return $this->destination_port;
    }

    /**
     * Destination port. Not present for sockets that are listening and not
     * connected.
     *
     * Generated from protobuf field <code>int32 destination_port = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setDestinationPort($var)
    {
        GPBUtil::checkInt32($var);
        $this->destination_port = $var;

        return $this;
    }

    /**
     * Source IP address.
     *
     * Generated from protobuf field <code>string source_ip = 3;</code>
     * @return string
     */
    public function getSourceIp()
    {
        return $this->source_ip;
    }

    /**
     * Source IP address.
     *
     * Generated from protobuf field <code>string source_ip = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setSourceIp($var)
    {
        GPBUtil::checkString($var, True);
        $this->source_ip = $var;

        return $this;
    }

    /**
     * Source port.
     *
     * Generated from protobuf field <code>int32 source_port = 4;</code>
     * @return int
     */
    public function getSourcePort()
    {
        return $this->source_port;
    }

    /**
     * Source port.
     *
     * Generated from protobuf field <code>int32 source_port = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setSourcePort($var)
    {
        GPBUtil::checkInt32($var);
        $this->source_port = $var;

        return $this;
    }

    /**
     * IANA Internet Protocol Number such as TCP(6) and UDP(17).
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Connection.Protocol protocol = 5;</code>
     * @return int
     */
    public function getProtocol()
    {
        return $this->protocol;
    }

    /**
     * IANA Internet Protocol Number such as TCP(6) and UDP(17).
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Connection.Protocol protocol = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setProtocol($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1\Connection\Protocol::class);
        $this->protocol = $var;

        return $this;
    }

}

