# rtsp address pool

The GstRTSPAddressPool is an object that maintains a collection of network addresses. It is used to allocate server ports and server multicast addresses but also to reserve client provided destination addresses.

A range of addresses can be added with gst_rtsp_address_pool_add_range. Both multicast and unicast addresses can be added.

With gst_rtsp_address_pool_acquire_address an unused address and port range can be acquired from the pool. With gst_rtsp_address_pool_reserve_address a specific address can be retrieved. Both methods return a boxed GstRTSPAddress that should be freed with gst_rtsp_address_free after usage, which brings the address back into the pool.

Last reviewed on 2013-07-16 (1.0.0)

## GstRTSPAddress

An address

### Members

`pool` (GstRTSPAddressPool *) –

the GstRTSPAddressPool owner of this address

`address` (gchar*) –

the address

`port` (guint16) –

the port number

`n_ports` (gint) –

number of ports

`ttl` (guint8) –

TTL or 0 for unicast addresses

## GstRtspServer.RTSPAddress

An address

### Members

`pool` (GstRtspServer.RTSPAddressPool) –

the GstRtspServer.RTSPAddressPool owner of this address

`address` (String) –

the address

`port` (Number) –

the port number

`n_ports` (Number) –

number of ports

`ttl` (Number) –

TTL or 0 for unicast addresses

## GstRtspServer.RTSPAddress

An address

### Members

`pool` (GstRtspServer.RTSPAddressPool) –

the GstRtspServer.RTSPAddressPool owner of this address

`address` (str) –

the address

`port` (int) –

the port number

`n_ports` (int) –

number of ports

`ttl` (int) –

TTL or 0 for unicast addresses

### Methods

#### gst_rtsp_address_copy

    GstRTSPAddress *
    gst_rtsp_address_copy (GstRTSPAddress * addr)

Make a copy of addr.

Parameters:

`addr` –

a GstRTSPAddress

Returns –

a copy of addr.

#### GstRtspServer.RTSPAddress.prototype.copy

    function GstRtspServer.RTSPAddress.prototype.copy(): {
        // javascript wrapper for 'gst_rtsp_address_copy'
    }

Make a copy of addr.

Parameters:

`addr` (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress

Returns (GstRtspServer.RTSPAddress) –

a copy of addr.

#### GstRtspServer.RTSPAddress.copy

    def GstRtspServer.RTSPAddress.copy (self):
        #python wrapper for 'gst_rtsp_address_copy'

Make a copy of addr.

Parameters:

`addr` (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress

Returns (GstRtspServer.RTSPAddress) –

a copy of addr.

#### gst_rtsp_address_free

    gst_rtsp_address_free (GstRTSPAddress * addr)

Free addr and releasing it back into the pool when owned by a pool.

Parameters:

`addr` –

a GstRTSPAddress

#### GstRtspServer.RTSPAddress.prototype.free

    function GstRtspServer.RTSPAddress.prototype.free(): {
        // javascript wrapper for 'gst_rtsp_address_free'
    }

Free addr and releasing it back into the pool when owned by a pool.

Parameters:

`addr` (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress

#### GstRtspServer.RTSPAddress.free

    def GstRtspServer.RTSPAddress.free (self):
        #python wrapper for 'gst_rtsp_address_free'

Free addr and releasing it back into the pool when owned by a pool.

Parameters:

`addr` (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress

## GstRTSPAddressPool

    GObject
        ╰──GstRTSPAddressPool

An address pool, all member are private

### Members

`parent` (GObject) –

the parent GObject

### Class structure

#### GstRTSPAddressPoolClass

Opaque Address pool class.

##### Fields

`parent_class` (GObjectClass) –
No description available

### GstRtspServer.RTSPAddressPoolClass

Opaque Address pool class.

##### Attributes

`parent_class` (GObject.ObjectClass) –
No description available

### GstRtspServer.RTSPAddressPoolClass

Opaque Address pool class.

##### Attributes

`parent_class` (GObject.ObjectClass) –
No description available

## GstRtspServer.RTSPAddressPool

    GObject.Object
        ╰──GstRtspServer.RTSPAddressPool

An address pool, all member are private

### Members

`parent` (GObject.Object) –

the parent GObject

## GstRtspServer.RTSPAddressPool

    GObject.Object
        ╰──GstRtspServer.RTSPAddressPool

An address pool, all member are private

### Members

`parent` (GObject.Object) –

the parent GObject

### Constructors

#### gst_rtsp_address_pool_new

    GstRTSPAddressPool *
    gst_rtsp_address_pool_new ()

Make a new GstRTSPAddressPool.

Returns ( [transfer: full]) –

a new GstRTSPAddressPool

#### GstRtspServer.RTSPAddressPool.prototype.new

    function GstRtspServer.RTSPAddressPool.prototype.new(): {
        // javascript wrapper for 'gst_rtsp_address_pool_new'
    }

Make a new GstRtspServer.RTSPAddressPool.

Returns (GstRtspServer.RTSPAddressPool) –

a new GstRtspServer.RTSPAddressPool

#### GstRtspServer.RTSPAddressPool.new

    def GstRtspServer.RTSPAddressPool.new ():
        #python wrapper for 'gst_rtsp_address_pool_new'

Make a new GstRtspServer.RTSPAddressPool.

Returns (GstRtspServer.RTSPAddressPool) –

a new GstRtspServer.RTSPAddressPool

### Methods

#### gst_rtsp_address_pool_acquire_address

    GstRTSPAddress *
    gst_rtsp_address_pool_acquire_address (GstRTSPAddressPool * pool,
                                           GstRTSPAddressFlags flags,
                                           gint n_ports)

Take an address and ports from pool. flags can be used to control the allocation. n_ports consecutive ports will be allocated of which the first one can be found in port.

Parameters:

`pool` –

a GstRTSPAddressPool

`flags` –

flags

`n_ports` –

the amount of ports

Returns ( [nullable]) –

a GstRTSPAddress that should be freed with gst_rtsp_address_free after use or NULL when no address could be acquired.

#### GstRtspServer.RTSPAddressPool.prototype.acquire_address

    function GstRtspServer.RTSPAddressPool.prototype.acquire_address(flags: GstRtspServer.RTSPAddressFlags, n_ports: Number): {
        // javascript wrapper for 'gst_rtsp_address_pool_acquire_address'
    }

Take an address and ports from pool. flags can be used to control the allocation. n_ports consecutive ports will be allocated of which the first one can be found in port.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`flags` (GstRtspServer.RTSPAddressFlags) –

flags

`n_ports` (Number) –

the amount of ports

Returns (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress that should be freed with gst_rtsp_address_free after use or NULL when no address could be acquired.

#### GstRtspServer.RTSPAddressPool.acquire_address

    def GstRtspServer.RTSPAddressPool.acquire_address (self, flags, n_ports):
        #python wrapper for 'gst_rtsp_address_pool_acquire_address'

Take an address and ports from pool. flags can be used to control the allocation. n_ports consecutive ports will be allocated of which the first one can be found in port.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`flags` (GstRtspServer.RTSPAddressFlags) –

flags

`n_ports` (int) –

the amount of ports

Returns (GstRtspServer.RTSPAddress) –

a GstRtspServer.RTSPAddress that should be freed with gst_rtsp_address_free after use or NULL when no address could be acquired.

#### gst_rtsp_address_pool_add_range

    gboolean
    gst_rtsp_address_pool_add_range (GstRTSPAddressPool * pool,
                                     const gchar* min_address,
                                     const gchar* max_address,
                                     guint16 min_port,
                                     guint16 max_port,
                                     guint8 ttl)

Adds the addresses from min_addess to max_address (inclusive) to pool. The valid port range for the addresses will be from min_port to max_port inclusive.

When ttl is 0, min_address and max_address should be unicast addresses. min_address and max_address can be set to GST_RTSP_ADDRESS_POOL_ANY_IPV4 or GST_RTSP_ADDRESS_POOL_ANY_IPV6 to bind to all available IPv4 or IPv6 addresses.

When ttl > 0, min_address and max_address should be multicast addresses.

Parameters:

`pool` –

a GstRTSPAddressPool

`min_address` –

a minimum address to add

`max_address` –

a maximum address to add

`min_port` –

the minimum port

`max_port` –

the maximum port

`ttl` –

a TTL or 0 for unicast addresses

Returns –

TRUE if the addresses could be added.

#### GstRtspServer.RTSPAddressPool.prototype.add_range

    function GstRtspServer.RTSPAddressPool.prototype.add_range(min_address: String, max_address: String, min_port: Number, max_port: Number, ttl: Number): {
        // javascript wrapper for 'gst_rtsp_address_pool_add_range'
    }

Adds the addresses from min_addess to max_address (inclusive) to pool. The valid port range for the addresses will be from min_port to max_port inclusive.

When ttl is 0, min_address and max_address should be unicast addresses. min_address and max_address can be set to GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV4 or GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV6 to bind to all available IPv4 or IPv6 addresses.

When ttl > 0, min_address and max_address should be multicast addresses.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`min_address` (String) –

a minimum address to add

`max_address` (String) –

a maximum address to add

`min_port` (Number) –

the minimum port

`max_port` (Number) –

the maximum port

`ttl` (Number) –

a TTL or 0 for unicast addresses

Returns (Number) –

TRUE if the addresses could be added.

#### GstRtspServer.RTSPAddressPool.add_range

    def GstRtspServer.RTSPAddressPool.add_range (self, min_address, max_address, min_port, max_port, ttl):
        #python wrapper for 'gst_rtsp_address_pool_add_range'

Adds the addresses from min_addess to max_address (inclusive) to pool. The valid port range for the addresses will be from min_port to max_port inclusive.

When ttl is 0, min_address and max_address should be unicast addresses. min_address and max_address can be set to GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV4 or GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV6 to bind to all available IPv4 or IPv6 addresses.

When ttl > 0, min_address and max_address should be multicast addresses.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`min_address` (str) –

a minimum address to add

`max_address` (str) –

a maximum address to add

`min_port` (int) –

the minimum port

`max_port` (int) –

the maximum port

`ttl` (int) –

a TTL or 0 for unicast addresses

Returns (bool) –

TRUE if the addresses could be added.

#### gst_rtsp_address_pool_clear

    gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool)

Clear all addresses in pool. There should be no outstanding allocations.

Parameters:

`pool` –

a GstRTSPAddressPool

#### GstRtspServer.RTSPAddressPool.prototype.clear

    function GstRtspServer.RTSPAddressPool.prototype.clear(): {
        // javascript wrapper for 'gst_rtsp_address_pool_clear'
    }

Clear all addresses in pool. There should be no outstanding allocations.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

#### GstRtspServer.RTSPAddressPool.clear

    def GstRtspServer.RTSPAddressPool.clear (self):
        #python wrapper for 'gst_rtsp_address_pool_clear'

Clear all addresses in pool. There should be no outstanding allocations.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

#### gst_rtsp_address_pool_dump

    gst_rtsp_address_pool_dump (GstRTSPAddressPool * pool)

Dump the free and allocated addresses to stdout.

Parameters:

`pool` –

a GstRTSPAddressPool

#### GstRtspServer.RTSPAddressPool.prototype.dump

    function GstRtspServer.RTSPAddressPool.prototype.dump(): {
        // javascript wrapper for 'gst_rtsp_address_pool_dump'
    }

Dump the free and allocated addresses to stdout.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

#### GstRtspServer.RTSPAddressPool.dump

    def GstRtspServer.RTSPAddressPool.dump (self):
        #python wrapper for 'gst_rtsp_address_pool_dump'

Dump the free and allocated addresses to stdout.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

#### gst_rtsp_address_pool_has_unicast_addresses

    gboolean
    gst_rtsp_address_pool_has_unicast_addresses (GstRTSPAddressPool * pool)

Used to know if the pool includes any unicast addresses.

Parameters:

`pool` –

a GstRTSPAddressPool

Returns –

TRUE if the pool includes any unicast addresses, FALSE otherwise

#### GstRtspServer.RTSPAddressPool.prototype.has_unicast_addresses

    function GstRtspServer.RTSPAddressPool.prototype.has_unicast_addresses(): {
        // javascript wrapper for 'gst_rtsp_address_pool_has_unicast_addresses'
    }

Used to know if the pool includes any unicast addresses.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

Returns (Number) –

TRUE if the pool includes any unicast addresses, FALSE otherwise

#### GstRtspServer.RTSPAddressPool.has_unicast_addresses

    def GstRtspServer.RTSPAddressPool.has_unicast_addresses (self):
        #python wrapper for 'gst_rtsp_address_pool_has_unicast_addresses'

Used to know if the pool includes any unicast addresses.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

Returns (bool) –

TRUE if the pool includes any unicast addresses, FALSE otherwise

#### gst_rtsp_address_pool_reserve_address

    GstRTSPAddressPoolResult
    gst_rtsp_address_pool_reserve_address (GstRTSPAddressPool * pool,
                                           const gchar* ip_address,
                                           guint port,
                                           guint n_ports,
                                           guint ttl,
                                           GstRTSPAddress ** address)

Take a specific address and ports from pool. n_ports consecutive ports will be allocated of which the first one can be found in port.

If ttl is 0, address should be a unicast address. If ttl > 0, address should be a valid multicast address.

Parameters:

`pool` –

a GstRTSPAddressPool

`ip_address` –

The IP address to reserve

`port` –

The first port to reserve

`n_ports` –

The number of ports

`ttl` –

The requested ttl

`address` ( [out]) –

storage for a GstRTSPAddress

Returns –

GST_RTSP_ADDRESS_POOL_OK if an address was reserved. The address is returned in address and should be freed with gst_rtsp_address_free after use.

#### GstRtspServer.RTSPAddressPool.prototype.reserve_address

    function GstRtspServer.RTSPAddressPool.prototype.reserve_address(ip_address: String, port: Number, n_ports: Number, ttl: Number): {
        // javascript wrapper for 'gst_rtsp_address_pool_reserve_address'
    }

Take a specific address and ports from pool. n_ports consecutive ports will be allocated of which the first one can be found in port.

If ttl is 0, address should be a unicast address. If ttl > 0, address should be a valid multicast address.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`ip_address` (String) –

The IP address to reserve

`port` (Number) –

The first port to reserve

`n_ports` (Number) –

The number of ports

`ttl` (Number) –

The requested ttl

Returns a tuple made of:

(GstRtspServer.RTSPAddressPoolResult ) –

GstRtspServer.RTSPAddressPoolResult.OK if an address was reserved. The address is returned in address and should be freed with gst_rtsp_address_free after use.

`address` (GstRtspServer.RTSPAddress ) –

GstRtspServer.RTSPAddressPoolResult.OK if an address was reserved. The address is returned in address and should be freed with gst_rtsp_address_free after use.

#### GstRtspServer.RTSPAddressPool.reserve_address

    def GstRtspServer.RTSPAddressPool.reserve_address (self, ip_address, port, n_ports, ttl):
        #python wrapper for 'gst_rtsp_address_pool_reserve_address'

Take a specific address and ports from pool. n_ports consecutive ports will be allocated of which the first one can be found in port.

If ttl is 0, address should be a unicast address. If ttl > 0, address should be a valid multicast address.

Parameters:

`pool` (GstRtspServer.RTSPAddressPool) –

a GstRtspServer.RTSPAddressPool

`ip_address` (str) –

The IP address to reserve

`port` (int) –

The first port to reserve

`n_ports` (int) –

The number of ports

`ttl` (int) –

The requested ttl

Returns a tuple made of:

(GstRtspServer.RTSPAddressPoolResult ) –

GstRtspServer.RTSPAddressPoolResult.OK if an address was reserved. The address is returned in address and should be freed with gst_rtsp_address_free after use.

`address` (GstRtspServer.RTSPAddress ) –

GstRtspServer.RTSPAddressPoolResult.OK if an address was reserved. The address is returned in address and should be freed with gst_rtsp_address_free after use.

## Function Macros

### GST_RTSP_ADDRESS_POOL_CAST

    #define GST_RTSP_ADDRESS_POOL_CAST(obj)         ((GstRTSPAddressPool*)(obj))

### GST_RTSP_ADDRESS_POOL_CLASS_CAST

    #define GST_RTSP_ADDRESS_POOL_CLASS_CAST(klass) ((GstRTSPAddressPoolClass*)(klass))

## Enumerations

### GstRTSPAddressFlags

Flags used to control allocation of addresses

##### Members

`GST_RTSP_ADDRESS_FLAG_NONE` (0) –

no flags

`GST_RTSP_ADDRESS_FLAG_IPV4` (1) –

an IPv4 address

`GST_RTSP_ADDRESS_FLAG_IPV6` (2) –

and IPv6 address

`GST_RTSP_ADDRESS_FLAG_EVEN_PORT` (4) –

address with an even port

`GST_RTSP_ADDRESS_FLAG_MULTICAST` (8) –

a multicast address

`GST_RTSP_ADDRESS_FLAG_UNICAST` (16) –

a unicast address

### GstRtspServer.RTSPAddressFlags

Flags used to control allocation of addresses

##### Members

`GstRtspServer.RTSPAddressFlags.NONE` (0) –

no flags

`GstRtspServer.RTSPAddressFlags.IPV4` (1) –

an IPv4 address

`GstRtspServer.RTSPAddressFlags.IPV6` (2) –

and IPv6 address

`GstRtspServer.RTSPAddressFlags.EVEN_PORT` (4) –

address with an even port

`GstRtspServer.RTSPAddressFlags.MULTICAST` (8) –

a multicast address

`GstRtspServer.RTSPAddressFlags.UNICAST` (16) –

a unicast address

### GstRtspServer.RTSPAddressFlags

Flags used to control allocation of addresses

##### Members

`GstRtspServer.RTSPAddressFlags.NONE` (0) –

no flags

`GstRtspServer.RTSPAddressFlags.IPV4` (1) –

an IPv4 address

`GstRtspServer.RTSPAddressFlags.IPV6` (2) –

and IPv6 address

`GstRtspServer.RTSPAddressFlags.EVEN_PORT` (4) –

address with an even port

`GstRtspServer.RTSPAddressFlags.MULTICAST` (8) –

a multicast address

`GstRtspServer.RTSPAddressFlags.UNICAST` (16) –

a unicast address

### GstRTSPAddressPoolResult

Result codes from RTSP address pool functions.

##### Members

`GST_RTSP_ADDRESS_POOL_OK` (0) –

no error

`GST_RTSP_ADDRESS_POOL_EINVAL` (-1) –

invalid arguments were provided to a function

`GST_RTSP_ADDRESS_POOL_ERESERVED` (-2) –

the addres has already been reserved

`GST_RTSP_ADDRESS_POOL_ERANGE` (-3) –

the address is not in the pool

`GST_RTSP_ADDRESS_POOL_ELAST` (-4) –

last error

### GstRtspServer.RTSPAddressPoolResult

Result codes from RTSP address pool functions.

##### Members

`GstRtspServer.RTSPAddressPoolResult.OK` (0) –

no error

`GstRtspServer.RTSPAddressPoolResult.EINVAL` (-1) –

invalid arguments were provided to a function

`GstRtspServer.RTSPAddressPoolResult.ERESERVED` (-2) –

the addres has already been reserved

`GstRtspServer.RTSPAddressPoolResult.ERANGE` (-3) –

the address is not in the pool

`GstRtspServer.RTSPAddressPoolResult.ELAST` (-4) –

last error

### GstRtspServer.RTSPAddressPoolResult

Result codes from RTSP address pool functions.

##### Members

`GstRtspServer.RTSPAddressPoolResult.OK` (0) –

no error

`GstRtspServer.RTSPAddressPoolResult.EINVAL` (-1) –

invalid arguments were provided to a function

`GstRtspServer.RTSPAddressPoolResult.ERESERVED` (-2) –

the addres has already been reserved

`GstRtspServer.RTSPAddressPoolResult.ERANGE` (-3) –

the address is not in the pool

`GstRtspServer.RTSPAddressPoolResult.ELAST` (-4) –

last error

## Constants

### GST_RTSP_ADDRESS_POOL_ANY_IPV4

    #define GST_RTSP_ADDRESS_POOL_ANY_IPV4  "0.0.0.0"

Used with gst_rtsp_address_pool_add_range to bind to all IPv4 addresses

### GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV4

Used with GstRtspServer.RTSPAddressPool.prototype.add_range to bind to all IPv4 addresses

### GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV4

Used with GstRtspServer.RTSPAddressPool.add_range to bind to all IPv4 addresses

### GST_RTSP_ADDRESS_POOL_ANY_IPV6

    #define GST_RTSP_ADDRESS_POOL_ANY_IPV6  "::"

Used with gst_rtsp_address_pool_add_range to bind to all IPv6 addresses

### GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV6

Used with GstRtspServer.RTSPAddressPool.prototype.add_range to bind to all IPv6 addresses

### GstRtspServer.RTSP_ADDRESS_POOL_ANY_IPV6

Used with GstRtspServer.RTSPAddressPool.add_range to bind to all IPv6 addresses

The results of the search are