lscp_client.h   lscp_client.h 
// lscp_client.h // lscp_client.h
//
/**************************************************************************
**
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
A.
***************************************************************************
**/
#ifndef __LSCP_CLIENT_H #ifndef __LSCP_CLIENT_H
#define __LSCP_CLIENT_H #define __LSCP_CLIENT_H
#include "lscp_socket.h" #include "lscp_socket.h"
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Client data structures. // Client data structures.
// Invalid channel /** Invalid channel index. */
#define LSCP_CHANNEL_INVALID (-1) #define LSCP_CHANNEL_INVALID (-1)
// Maximum number of engines returned by lscp_get_available_engines. /** Audio output types. */
#define LSCP_MAX_ENGINES 256
// Audio output types.
typedef enum _lscp_audio_t typedef enum _lscp_audio_t
{ {
LSCP_AUDIO_NONE = 0, LSCP_AUDIO_NONE = 0,
LSCP_AUDIO_ALSA, LSCP_AUDIO_ALSA,
LSCP_AUDIO_JACK LSCP_AUDIO_JACK
} lscp_audio_t; } lscp_audio_t;
// MIDI input types. /** MIDI input types. */
typedef enum _lscp_midi_t typedef enum _lscp_midi_t
{ {
LSCP_MIDI_NONE = 0, LSCP_MIDI_NONE = 0,
LSCP_MIDI_ALSA LSCP_MIDI_ALSA
} lscp_midi_t; } lscp_midi_t;
// Buffer fill usage types. /** Buffer fill stream usage types. */
typedef enum _lscp_usage_t typedef enum _lscp_usage_t
{ {
LSCP_USAGE_BYTES = 0, LSCP_USAGE_BYTES = 0,
LSCP_USAGE_PERCENTAGE LSCP_USAGE_PERCENTAGE
} lscp_usage_t; } lscp_usage_t;
// Engine info cache struct. /** Engine info cache struct. */
typedef struct _lscp_engine_info_t typedef struct _lscp_engine_info_t
{ {
char * description; char * description;
char * version; char * version;
} lscp_engine_info_t; } lscp_engine_info_t;
// Channel info cache struct. /** Channel info cache struct. */
typedef struct _lscp_channel_info_t typedef struct _lscp_channel_info_t
{ {
char * engine_name; char * engine_name;
lscp_audio_t audio_type; lscp_audio_t audio_type;
int audio_channel; int audio_channel;
char * instrument; char * instrument;
lscp_midi_t midi_type; lscp_midi_t midi_type;
char * midi_port; char * midi_port;
int midi_channel; int midi_channel;
float volume; float volume;
} lscp_channel_info_t; } lscp_channel_info_t;
// Buffer fill cache struct. /** Buffer fill cache struct. */
typedef struct _lscp_buffer_fill_t typedef struct _lscp_buffer_fill_t
{ {
unsigned int stream_id; unsigned int stream_id;
unsigned long stream_usage; unsigned long stream_usage;
} lscp_buffer_fill_t; } lscp_buffer_fill_t;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Client socket main structure. // Client socket main structure.
struct _lscp_client_t; struct _lscp_client_t;
/** Client callback procedure prototype. */
typedef lscp_status_t (*lscp_client_proc_t) typedef lscp_status_t (*lscp_client_proc_t)
( (
struct _lscp_client_t *pClient, struct _lscp_client_t *pClient,
const char *pchBuffer, const char *pchBuffer,
int cchBuffer, int cchBuffer,
void *pvData void *pvData
); );
/** Client descriptor struct. */
typedef struct _lscp_client_t { typedef struct _lscp_client_t {
// Client socket stuff. // Client socket stuff.
lscp_client_proc_t pfnCallback; lscp_client_proc_t pfnCallback;
void * pvData; void * pvData;
lscp_socket_agent_t tcp; lscp_socket_agent_t tcp;
lscp_socket_agent_t udp; lscp_socket_agent_t udp;
// Session identifier. // Session identifier.
char * sessid; char * sessid;
// Info struct caches. // Info struct caches.
const char ** engines; char ** engines;
int iMaxEngines;
lscp_engine_info_t engine_info; lscp_engine_info_t engine_info;
lscp_channel_info_t channel_info; lscp_channel_info_t channel_info;
// Result and error status. // Result and error status.
char * pszResult; char * pszResult;
int iErrno; int iErrno;
// Stream buffers status. // Stream buffers status.
lscp_buffer_fill_t *buffer_fill; lscp_buffer_fill_t *buffer_fill;
int iStreamCount; int iStreamCount;
} lscp_client_t; } lscp_client_t;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Client socket functions. // Client socket functions.
lscp_client_t* lscp_client_create (char *pszHost, int iPort, lscp_cli lscp_client_t * lscp_client_create (char *pszHost, int
ent_proc_t pfnCallback, void *pvData); iPort, lscp_client_proc_t pfnCallback, void *pvData);
lscp_status_t lscp_client_join (lscp_client_t *pClient); lscp_status_t lscp_client_join (lscp_client_t *pCl
lscp_status_t lscp_client_destroy (lscp_client_t *pClient); ient);
lscp_status_t lscp_client_destroy (lscp_client_t *pCl
ient);
lscp_status_t lscp_client_call (lscp_client_t *pClient, const char *pchBuffer, int cchBuffer, char *pchResult, int *pcchResult); lscp_status_t lscp_client_call (lscp_client_t *pCl ient, const char *pchBuffer, int cchBuffer, char *pchResult, int *pcchResul t);
lscp_status_t lscp_client_subscribe (lscp_client_t *pClient); lscp_status_t lscp_client_subscribe (lscp_client_t *pCl
lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient); ient);
lscp_status_t lscp_client_unsubscribe (lscp_client_t *pCl
ient);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Client common protocol functions. // Client common protocol functions.
lscp_status_t lscp_client_query (lscp_client_t *pClient, const char lscp_status_t lscp_client_query (lscp_client_t *pCl
*pszQuery); ient, const char *pszQuery);
const char * lscp_client_get_result (lscp_client_t *pClient ); const char * lscp_client_get_result (lscp_client_t *pCl
int lscp_client_get_errno (lscp_client_t *pClient ); ient );
int lscp_client_get_errno (lscp_client_t *pCl
ient );
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Client command protocol functions. // Client command protocol functions.
lscp_status_t lscp_load_instrument (lscp_client_t *pCl ient, const char *pszFileName, int iInstrIndex, int iSamplerChannel); lscp_status_t lscp_load_instrument (lscp_client_t *pCl ient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
lscp_status_t lscp_load_engine (lscp_client_t *pCl ient, const char *pszEngineName, int iSamplerChannel); lscp_status_t lscp_load_engine (lscp_client_t *pCl ient, const char *pszEngineName, int iSamplerChannel);
int lscp_get_channels (lscp_client_t *pCl ient); int lscp_get_channels (lscp_client_t *pCl ient);
lscp_status_t lscp_add_channel (lscp_client_t *pCl ient); lscp_status_t lscp_add_channel (lscp_client_t *pCl ient);
lscp_status_t lscp_remove_channel (lscp_client_t *pCl ient, int iSamplerChannel); lscp_status_t lscp_remove_channel (lscp_client_t *pCl ient, int iSamplerChannel);
const char ** lscp_get_available_engines (lscp_client_t *pCl ient); const char ** lscp_get_available_engines (lscp_client_t *pCl ient);
 End of changes. 15 change blocks. 
22 lines changed or deleted 50 lines changed or added


 lscp_parser.h   lscp_parser.h 
// lscp_parser.h // lscp_parser.h
//
/**************************************************************************
**
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
A.
***************************************************************************
**/
#ifndef __LSCP_PARSER_H #ifndef __LSCP_PARSER_H
#define __LSCP_PARSER_H #define __LSCP_PARSER_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined(__WIN32__) #if defined(__WIN32__)
#define WIN32 #define WIN32
 End of changes. 1 change blocks. 
0 lines changed or deleted 22 lines changed or added


 lscp_server.h   lscp_server.h 
// lscp_server.h // lscp_server.h
//
/**************************************************************************
**
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
A.
***************************************************************************
**/
#ifndef __LSCP_SERVER_H #ifndef __LSCP_SERVER_H
#define __LSCP_SERVER_H #define __LSCP_SERVER_H
#include "lscp_socket.h" #include "lscp_socket.h"
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Server mode. // Server socket modes.
/** Server thread model. */
typedef enum _lscp_server_mode_t typedef enum _lscp_server_mode_t
{ {
LSCP_SERVER_THREAD = 0, LSCP_SERVER_THREAD = 0,
LSCP_SERVER_SELECT = 1 LSCP_SERVER_SELECT = 1
} lscp_server_mode_t; } lscp_server_mode_t;
/** Connection mode notification. */
typedef enum _lscp_connect_mode_t
{
LSCP_CONNECT_OPEN = 0,
LSCP_CONNECT_CLOSE = 1
} lscp_connect_mode_t;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Server sockets. // Server socket structures.
struct _lscp_server_t; struct _lscp_server_t;
/** Client connection descriptor struct. */
typedef struct _lscp_connect_t typedef struct _lscp_connect_t
{ {
struct _lscp_server_t *server; struct _lscp_server_t *server;
lscp_socket_agent_t client; lscp_socket_agent_t client;
int port; int port;
int ping; int ping;
char * sessid; char * sessid;
struct _lscp_connect_t *prev; struct _lscp_connect_t *prev;
struct _lscp_connect_t *next; struct _lscp_connect_t *next;
} lscp_connect_t; } lscp_connect_t;
/** Client connection list struct. */
typedef struct _lscp_connect_list_t typedef struct _lscp_connect_list_t
{ {
lscp_connect_t *first; lscp_connect_t *first;
lscp_connect_t *last; lscp_connect_t *last;
unsigned int count; unsigned int count;
lscp_mutex_t mutex; lscp_mutex_t mutex;
} lscp_connect_list_t; } lscp_connect_list_t;
/** Server callback procedure prototype. */
typedef lscp_status_t (*lscp_server_proc_t) typedef lscp_status_t (*lscp_server_proc_t)
( (
lscp_connect_t *pConnect, lscp_connect_t *pConnect,
const char *pchBuffer, const char *pchBuffer,
int cchBuffer, int cchBuffer,
void *pvData void *pvData
); );
/** Server descriptor struct. */
typedef struct _lscp_server_t typedef struct _lscp_server_t
{ {
lscp_server_mode_t mode; lscp_server_mode_t mode;
lscp_connect_list_t connects; lscp_connect_list_t connects;
lscp_server_proc_t pfnCallback; lscp_server_proc_t pfnCallback;
void *pvData; void *pvData;
lscp_socket_agent_t tcp; lscp_socket_agent_t tcp;
lscp_socket_agent_t udp; lscp_socket_agent_t udp;
lscp_thread_t *pWatchdog; lscp_thread_t *pWatchdog;
int iWatchdog; int iWatchdog;
int iSleep; int iSleep;
} lscp_server_t; } lscp_server_t;
lscp_server_t* lscp_server_create (int iPort, lscp_server_proc_t pfnC //-------------------------------------------------------------------------
allback, void *pvData); // Server socket functions.
lscp_server_t* lscp_server_create_ex (int iPort, lscp_server_proc_t pfnC
allback, void *pvData, lscp_server_mode_t mode); lscp_server_t * lscp_server_create (int iPort, lscp_server_proc_t pfnC
allback, void *pvData);
lscp_server_t * lscp_server_create_ex (int iPort, lscp_server_proc_t pfnC
allback, void *pvData, lscp_server_mode_t mode);
lscp_status_t lscp_server_join (lscp_server_t *pServer); lscp_status_t lscp_server_join (lscp_server_t *pServer);
lscp_status_t lscp_server_destroy (lscp_server_t *pServer); lscp_status_t lscp_server_destroy (lscp_server_t *pServer);
lscp_status_t lscp_server_broadcast (lscp_server_t *pServer, const char *pchBuffer, int cchBuffer); lscp_status_t lscp_server_broadcast (lscp_server_t *pServer, const char *pchBuffer, int cchBuffer);
lscp_status_t lscp_server_result (lscp_connect_t *pConnect, const ch ar *pchBuffer, int cchBuffer); lscp_status_t lscp_server_result (lscp_connect_t *pConnect, const ch ar *pchBuffer, int cchBuffer);
lscp_status_t lscp_server_subscribe (lscp_connect_t *pConnect, int iPor t); lscp_status_t lscp_server_subscribe (lscp_connect_t *pConnect, int iPor t);
lscp_status_t lscp_server_unsubscribe (lscp_connect_t *pConnect, const ch ar *pszSessID); lscp_status_t lscp_server_unsubscribe (lscp_connect_t *pConnect, const ch ar *pszSessID);
 End of changes. 10 change blocks. 
6 lines changed or deleted 44 lines changed or added


 lscp_socket.h   lscp_socket.h 
// lscp_socket.h // lscp_socket.h
//
/**************************************************************************
**
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
A.
***************************************************************************
**/
#ifndef __LSCP_SOCKET_H #ifndef __LSCP_SOCKET_H
#define __LSCP_SOCKET_H #define __LSCP_SOCKET_H
#if defined(__WIN32__) #if defined(__WIN32__)
#define WIN32 #define WIN32
#endif #endif
#if defined(WIN32) #if defined(WIN32)
#include <winsock.h> #include <winsock.h>
skipping to change at line 43 skipping to change at line 62
typedef int lscp_socket_t; typedef int lscp_socket_t;
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#define closesocket(s) close(s) #define closesocket(s) close(s)
#endif #endif
#define LSCP_BUFSIZ 1024 #define LSCP_BUFSIZ 1024
void lscp_socket_perror (const char *pszPrefix); void lscp_socket_perror (const char *pszPrefix);
#ifdef DEBUG
void lscp_socket_getopts (const char *pszPrefix, lscp_socket_t sock); void lscp_socket_getopts (const char *pszPrefix, lscp_socket_t sock);
void lscp_socket_trace (const char *pszPrefix, struct sockaddr_in *pAddr, const char *pchBuffer, int cchBuffer); void lscp_socket_trace (const char *pszPrefix, struct sockaddr_in *pAddr, const char *pchBuffer, int cchBuffer);
#endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Threaded socket agent struct helpers. // Threaded socket agent struct helpers.
typedef struct _lscp_socket_agent_t { typedef struct _lscp_socket_agent_t {
lscp_socket_t sock; lscp_socket_t sock;
struct sockaddr_in addr; struct sockaddr_in addr;
lscp_thread_t *pThread; lscp_thread_t *pThread;
int iState; int iState;
 End of changes. 3 change blocks. 
2 lines changed or deleted 22 lines changed or added


 lscp_thread.h   lscp_thread.h 
// lscp_thread.h // lscp_thread.h
//
/**************************************************************************
**
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
A.
***************************************************************************
**/
#ifndef __LSCP_THREAD_H #ifndef __LSCP_THREAD_H
#define __LSCP_THREAD_H #define __LSCP_THREAD_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined(__WIN32__) #if defined(__WIN32__)
#define WIN32 #define WIN32
 End of changes. 1 change blocks. 
0 lines changed or deleted 22 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/