## AgsOscConnection

AgsOscConnection — the OSC server side connection

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_OSC_CONNECTION_GET_OBJ_MUTEX()
gboolean | ags_osc_connection_test_flags ()
void | ags_osc_connection_set_flags ()
void | ags_osc_connection_unset_flags ()
gboolean | ags_osc_connection_timeout_expired ()
guchar * | ags_osc_connection_read_bytes ()
gint64 | ags_osc_connection_write_response ()
void | ags_osc_connection_close ()
AgsOscConnection * | ags_osc_connection_new ()

## Properties

char * | ip4 | Read / Write
char * | ip6 | Read / Write
AgsOscServer * | osc-server | Read / Write

## Signals

void | close | Run Last
gpointer | read-bytes | Run Last
gint64 | write-response | Run Last

## Types and Values

#define | AGS_OSC_CONNECTION_TIMEOUT_USEC
#define | AGS_OSC_CONNECTION_DEAD_LINE_USEC
#define | AGS_OSC_CONNECTION_CHUNK_SIZE
#define | AGS_OSC_CONNECTION_DEFAULT_CACHE_DATA_LENGTH
enum | AgsOscConnectionFlags

## Object Hierarchy

        GObject
        ╰── AgsOscConnection
            ╰── AgsOscWebsocketConnection

## Includes

    #include <ags/audio/osc/ags_osc_connection.h>

## Description

AgsOscConnection your OSC server side connection.

## Functions

### AGS_OSC_CONNECTION_GET_OBJ_MUTEX()

    #define AGS_OSC_CONNECTION_GET_OBJ_MUTEX(obj) (&(((AgsOscConnection *) obj)->obj_mutex))

### ags_osc_connection_test_flags ()

    gboolean
    ags_osc_connection_test_flags (AgsOscConnection *osc_connection,
                                   AgsOscConnectionFlags flags);

Test `flags` to be set on `osc_connection` .

#### Parameters

osc_connection | the AgsOscConnection |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_osc_connection_set_flags ()

    void
    ags_osc_connection_set_flags (AgsOscConnection *osc_connection,
                                  AgsOscConnectionFlags flags);

Set flags.

#### Parameters

osc_connection | the AgsOscConnection |
flags | the flags |

Since: 3.0.0

### ags_osc_connection_unset_flags ()

    void
    ags_osc_connection_unset_flags (AgsOscConnection *osc_connection,
                                    AgsOscConnectionFlags flags);

Unset flags.

#### Parameters

osc_connection | the AgsOscConnection |
flags | the flags |

Since: 3.0.0

### ags_osc_connection_timeout_expired ()

    gboolean
    ags_osc_connection_timeout_expired (struct timespec *start_time,
                                        struct timespec *timeout_delay);

Check `start_time` plus `timeout_delay` against current time.

#### Parameters

start_time | the start time timespec |
timeout_delay | the delay timespec |

#### Returns

`TRUE` if timeout expired, otherwise `FALSE`

Since: 3.0.0

### ags_osc_connection_read_bytes ()

    guchar *
    ags_osc_connection_read_bytes (AgsOscConnection *osc_connection,
                                   guint *data_length);

Read bytes.

#### Parameters

osc_connection | the AgsOscConnection |
data_length | the return location of byte array's length |

#### Returns

byte array read or `NULL` if no data available

Since: 3.0.0

### ags_osc_connection_write_response ()

    gint64
    ags_osc_connection_write_response (AgsOscConnection *osc_connection,
                                       GObject *osc_response);

Write response.

#### Parameters

osc_connection | the AgsOscConnection |
osc_response | the AgsOscResponse |

#### Returns

the count of bytes written

Since: 3.0.0

### ags_osc_connection_close ()

    void
    ags_osc_connection_close (AgsOscConnection *osc_connection);

Close `osc_connection` .

#### Parameters

osc_connection | the AgsOscConnection |

Since: 3.0.0

### ags_osc_connection_new ()

    AgsOscConnection *
    ags_osc_connection_new (GObject *osc_server);

Creates a new instance of AgsOscConnection

#### Parameters

osc_server | the AgsOscServer |

#### Returns

the new AgsOscConnection

Since: 3.0.0

## Types and Values

### AGS_OSC_CONNECTION_TIMEOUT_USEC

    #define AGS_OSC_CONNECTION_TIMEOUT_USEC (250)

### AGS_OSC_CONNECTION_DEAD_LINE_USEC

    #define AGS_OSC_CONNECTION_DEAD_LINE_USEC (60000000)

### AGS_OSC_CONNECTION_CHUNK_SIZE

    #define AGS_OSC_CONNECTION_CHUNK_SIZE (131072)

### AGS_OSC_CONNECTION_DEFAULT_CACHE_DATA_LENGTH

    #define AGS_OSC_CONNECTION_DEFAULT_CACHE_DATA_LENGTH (256)

### enum AgsOscConnectionFlags

Enum values to configure OSC connection.

#### Members

AGS_OSC_CONNECTION_ACTIVE | is active |
AGS_OSC_CONNECTION_INET4 | IPv4 connection |
AGS_OSC_CONNECTION_INET6 | IPv6 connection |

## Property Details

### The `“ip4”` property

      “ip4”                      char *

The IPv4 address as string of the server connection.

Owner: AgsOscConnection

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“ip6”` property

      “ip6”                      char *

The IPv6 address as string of the server connection.

Owner: AgsOscConnection

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“osc-server”` property

      “osc-server”               AgsOscServer *

The assigned AgsOscServer.

Owner: AgsOscConnection

Flags: Read / Write

Since: 3.0.0

## Signal Details

### The `“close”` signal

    void
    user_function (AgsOscConnection *osc_connection,
                   gpointer          user_data)

The ::close signal is emited as closing the file descriptor.

#### Parameters

osc_connection | the AgsOscConnection |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0

### The `“read-bytes”` signal

    gpointer
    user_function (AgsOscConnection *osc_connection,
                   gpointer          data_length,
                   gpointer          user_data)

The ::read-bytes signal is emited while read bytes.

#### Parameters

osc_connection | the AgsOscConnection |
data_length | the return location of byte array's length |
user_data | user data set when the signal handler was connected. |

#### Returns

byte array read or `NULL` if no data available

Flags: Run Last

Since: 3.0.0

### The `“write-response”` signal

    gint64
    user_function (AgsOscConnection *osc_connection,
                   GObject          *osc_response,
                   gpointer          user_data)

The ::write-response signal is emited while write response.

#### Parameters

osc_connection | the AgsOscConnection |
osc_response | the AgsOscResponse |
user_data | user data set when the signal handler was connected. |

#### Returns

the count bytes written

Flags: Run Last

Since: 3.0.0