CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Macros | Functions | Variables
server.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <float.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <netdb.h>`
`#include <sys/socket.h>`
`#include <sys/un.h>`
`#include <arpa/inet.h>`
`#include "lo_types_internal.h"`
`#include "lo_internal.h"`
`#include "lo/lo.h"`
`#include "lo/lo_throw.h"`

Go to the source code of this file.

## Classes
struct | queued_msg_list

## Macros
#define | geterror() errno
#define | LO_HOST_SIZE 1024

## Functions
static int | lo_can_coerce_spec (const char *a, const char *b)
static int | lo_can_coerce (char a, char b)
static void | dispatch_method (lo_server s, const char *path, lo_message msg)
static int | dispatch_queued (lo_server s)
static void | queue_data (lo_server s, lo_timetag ts, const char *path, lo_message msg)
static lo_server | lo_server_new_with_proto_internal (const char *group, const char *port, int proto, lo_err_handler err_h)
static int | lo_server_add_socket (lo_server s, int socket)
static void | lo_server_del_socket (lo_server s, int index, int socket)
static int | lo_server_join_multicast_group (lo_server s, const char *group)
lo_server | lo_server_new (const char *port, lo_err_handler err_h)
| Create a new server instance.
lo_server | lo_server_new_multicast (const char *group, const char *port, lo_err_handler err_h)
| Create a new server instance, and join a UDP multicast group.
lo_server | lo_server_new_with_proto (const char *port, int proto, lo_err_handler err_h)
| Create a new server instance, specifying protocol.
void | lo_server_free (lo_server s)
| Free up memory used by the lo_server object.
void * | lo_server_recv_raw (lo_server s, size_t *size)
void * | lo_server_recv_raw_stream (lo_server s, size_t *size)
| memcpy (data, buffer, ret)
| if (size)
int | lo_server_recv_noblock (lo_server s, int timeout)
| Look for an OSC message waiting to be received.
int | lo_server_recv (lo_server s)
| Block, waiting for an OSC message to be received.
int | lo_server_dispatch_data (lo_server s, void *data, size_t size)
| Dispatch a raw block of memory containing an OSC message.
double | lo_server_next_event_delay (lo_server s)
| Return the time in seconds until the next scheduled event.
int | lo_server_events_pending (lo_server s)
| Return true if there are scheduled events (eg. from bundles) waiting to be dispatched by the server.
lo_method | lo_server_add_method (lo_server s, const char *path, const char *typespec, lo_method_handler h, void *user_data)
| Add an OSC method to the specifed server.
void | lo_server_del_method (lo_server s, const char *path, const char *typespec)
| Delete an OSC method from the specifed server.
int | lo_server_get_socket_fd (lo_server s)
| Return the file descriptor of the server socket.
int | lo_server_get_port (lo_server s)
| Return the port number that the server has bound to.
int | lo_server_get_protocol (lo_server s)
| Return the protocol that the server is using.
char * | lo_server_get_url (lo_server s)
| Return an OSC URL that can be used to contact the server.
void | lo_server_pp (lo_server s)
| Pretty-print a lo_server object.
void | lo_throw (lo_server s, int errnum, const char *message, const char *path)

## Variables
struct lo_cs | lo_client_sockets = {-1, -1}
| data = malloc(ret)

## Macro Definition Documentation

#define geterror | ( |  | ) | errno

Definition at line 52 of file server.c.

Referenced by lo_server_join_multicast_group(), and lo_server_new_with_proto_internal().

#define LO_HOST_SIZE 1024

Definition at line 60 of file server.c.

Referenced by dispatch_method(), and lo_server_new_with_proto_internal().

## Function Documentation

static int lo_can_coerce_spec | ( | const char * | a,
|  | const char * | b
| ) |  |
| static

Definition at line 1369 of file server.c.

References lo_can_coerce().

Referenced by dispatch_method().

static int lo_can_coerce | ( | char | a,
|  | char | b
| ) |  |
| static

Definition at line 1386 of file server.c.

References lo_is_numerical_type(), and lo_is_string_type().

Referenced by lo_can_coerce_spec().

static void dispatch_method | ( | lo_server | s,
|  | const char * | path,
|  | lo_message | msg
| ) |  |
| static

Definition at line 942 of file server.c.

References lo_address_free(), lo_address_new(), lo_arg_size(), lo_can_coerce_spec(), lo_coerce(), LO_HOST_SIZE, lo_message_add_int32(), lo_message_add_string(), lo_message_free(), lo_message_new(), lo_pattern_match(), lo_send_message(), lo_throw(), LO_UDP, and _lo_strlist::next.

Referenced by dispatch_queued(), and lo_server_dispatch_data().

static int dispatch_queued | ( | lo_server | s | ) |
| static

Definition at line 1173 of file server.c.

References dispatch_method(), LO_INT_ERR, lo_message_free(), lo_throw(), lo_timetag_diff(), queued_msg_list::next, and queued_msg_list::ts.

Referenced by lo_server_recv().

static void queue_data | ( | lo_server | s,
|  | lo_timetag | ts,
|  | const char * | path,
|  | lo_message | msg
| ) |  |
| static

Definition at line 1136 of file server.c.

References lo_timetag_diff(), queued_msg_list::msg, queued_msg_list::next, queued_msg_list::path, and queued_msg_list::ts.

Referenced by lo_server_dispatch_data().

lo_server lo_server_new_with_proto_internal | ( | const char * | group,
|  | const char * | port,
|  | int | proto,
|  | lo_err_handler | err_h
| ) |  |
| static

Definition at line 158 of file server.c.

References geterror, LO_DEFAULT, LO_HOST_SIZE, LO_NOPORT, lo_server_free(), lo_server_join_multicast_group(), LO_TCP, lo_throw(), LO_UDP, LO_UNIX, LO_UNKNOWNPROTO, lo_cs::tcp, and lo_cs::udp.

Referenced by lo_server_new_multicast(), and lo_server_new_with_proto().

int lo_server_add_socket | ( | lo_server | s,
|  | int | socket
| ) |  |
| static

Definition at line 813 of file server.c.

Referenced by lo_server_recv_raw_stream().

void lo_server_del_socket | ( | lo_server | s,
|  | int | index,
|  | int | socket
| ) |  |
| static

Definition at line 836 of file server.c.

Referenced by lo_server_recv_raw_stream().

int lo_server_join_multicast_group | ( | lo_server | s,
|  | const char * | group
| ) |  |
| static

Definition at line 397 of file server.c.

References geterror, lo_server_free(), and lo_throw().

Referenced by lo_server_new_with_proto_internal().

void* lo_server_recv_raw | ( | lo_server | s,
|  | size_t * | size
| ) |  |

Definition at line 503 of file server.c.

References data, LO_MAX_MSG_SIZE, and memcpy().

Referenced by lo_server_recv().

void* lo_server_recv_raw_stream | ( | lo_server | s,
|  | size_t * | size
| ) |  |

Definition at line 528 of file server.c.

References data, LO_MAX_MSG_SIZE, lo_server_add_socket(), lo_server_del_socket(), lo_throw(), and LO_TOOBIG.

Referenced by lo_server_recv().

memcpy | ( | data | ,
|  | buffer | ,
|  | ret |
| ) |  |

Referenced by math::matrix::base_mat::base_mat(), csl::Buffer::copyOnlySamplesFrom(), csl::Buffer::copySamplesFrom(), csl::Buffer::copySamplesFromTo(), csl::RingBufferTap::destructiveNextBuffer(), csl::ShoeBox::getReflections(), csl::HRTF::HRTF(), csl::RemoteStream::initPacket(), lo_blob_new(), lo_bundle_serialise(), lo_coerce(), lo_message_add_blob(), lo_message_add_midi(), lo_message_deserialise(), lo_message_serialise(), lo_server_recv_raw(), csl::FFT::nextBuffer(), csl::BlockResizer::nextBuffer(), csl::RingBufferTap::nextBuffer(), csl::InOut::nextBuffer(), csl::BinauralPanner::nextBuffer(), csl::LSoundFile::nextBuffer(), csl::BufferStream::nextBuffer(), csl::RemoteStream::nextBuffer(), csl::Abst_SoundFile::nextBuffer(), csl::UnitGenerator::nextBuffer(), csl::Splitter::nextBuffer(), csl::RemoteIO::process_request_packet(), csl::VSTIO::processReplacing(), RS_Read_Loop(), csl::FilterSpecification::setFrequencies(), csl::FilterSpecification::setResponses(), csl::FIR::setTaps(), csl::FilterSpecification::setWeights(), csl::DecodedFile::writeBuffer(), csl::RingBuffer::writeBuffer(), and csl::BufferStream::writeBuffer().

if | ( | size |  | ) |

Definition at line 638 of file server.c.

Referenced by csl::LSoundFile::initFromSndfile(), csl::DLine::mono_next_buffer(), csl::CASoundFile::openForRead(), and RenderCallback().

void lo_throw | ( | lo_server | s,
|  | int | errnum,
|  | const char * | message,
|  | const char * | path
| ) |  |

Definition at line 1393 of file server.c.

Referenced by dispatch_method(), dispatch_queued(), lo_server_dispatch_data(), lo_server_join_multicast_group(), lo_server_new_with_proto_internal(), and lo_server_recv_raw_stream().

## Variable Documentation

struct lo_cs lo_client_sockets = {-1, -1}

Definition at line 69 of file server.c.

data = malloc(ret)

Definition at line 635 of file server.c.

Referenced by csl::MIDIIO::copyMessage(), lo_arg_host_endian(), lo_arg_network_endian(), lo_send_bundle_from(), lo_send_message_from(), lo_server_dispatch_data(), lo_server_recv(), lo_server_recv_raw(), lo_server_recv_raw_stream(), lo_validate_bundle(), and lo_validate_string().