Guitarix
nsm.h File Reference
#include <lo/lo.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  _nsm_client_t
 

Macros

#define NSM_API_VERSION_MAJOR   1
 
#define NSM_API_VERSION_MINOR   0
 
#define _NSM()   ((struct _nsm_client_t*)nsm)
 
#define NSM_EXPORT   __attribute__((unused)) static
 
#define OSC_REPLY(value)   lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value )
 
#define OSC_REPLY_ERR(errcode, value)   lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value )
 

Typedefs

typedef void * nsm_client_t
 
typedef int() nsm_open_callback(const char *name, const char *display_name, const char *client_id, char **out_msg, void *userdata)
 
typedef int() nsm_save_callback(char **out_msg, void *userdata)
 
typedef void() nsm_show_gui_callback(void *userdata)
 
typedef void() nsm_hide_gui_callback(void *userdata)
 
typedef void() nsm_active_callback(int b, void *userdata)
 
typedef void() nsm_session_is_loaded_callback(void *userdata)
 
typedef int() nsm_broadcast_callback(const char *, lo_message m, void *userdata)
 

Enumerations

enum  {
  ERR_OK = 0 , ERR_GENERAL = -1 , ERR_INCOMPATIBLE_API = -2 , ERR_BLACKLISTED = -3 ,
  ERR_LAUNCH_FAILED = -4 , ERR_NO_SUCH_FILE = -5 , ERR_NO_SESSION_OPEN = -6 , ERR_UNSAVED_CHANGES = -7 ,
  ERR_NOT_NOW = -8
}
 

Functions

NSM_EXPORT int nsm_is_active (nsm_client_t *nsm)
 
NSM_EXPORT const char * nsm_get_session_manager_name (nsm_client_t *nsm)
 
NSM_EXPORT const char * nsm_get_session_manager_features (nsm_client_t *nsm)
 
NSM_EXPORT nsm_client_tnsm_new (void)
 
NSM_EXPORT void nsm_send_is_dirty (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_send_is_clean (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_send_is_shown (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_send_is_hidden (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_send_progress (nsm_client_t *nsm, float p)
 
NSM_EXPORT void nsm_send_message (nsm_client_t *nsm, int priority, const char *msg)
 
NSM_EXPORT void nsm_send_announce (nsm_client_t *nsm, const char *app_name, const char *capabilities, const char *process_name)
 
NSM_EXPORT void nsm_send_broadcast (nsm_client_t *nsm, lo_message msg)
 
NSM_EXPORT void nsm_check_wait (nsm_client_t *nsm, int timeout)
 
NSM_EXPORT void nsm_check_nowait (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_thread_start (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_thread_stop (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_free (nsm_client_t *nsm)
 
NSM_EXPORT void nsm_set_open_callback (nsm_client_t *nsm, nsm_open_callback *open_callback, void *userdata)
 
NSM_EXPORT void nsm_set_save_callback (nsm_client_t *nsm, nsm_save_callback *save_callback, void *userdata)
 
NSM_EXPORT void nsm_set_show_callback (nsm_client_t *nsm, nsm_show_gui_callback *show_callback, void *userdata)
 
NSM_EXPORT void nsm_set_hide_callback (nsm_client_t *nsm, nsm_hide_gui_callback *hide_callback, void *userdata)
 
NSM_EXPORT void nsm_set_active_callback (nsm_client_t *nsm, nsm_active_callback *active_callback, void *userdata)
 
NSM_EXPORT void nsm_set_session_is_loaded_callback (nsm_client_t *nsm, nsm_session_is_loaded_callback *session_is_loaded_callback, void *userdata)
 
NSM_EXPORT void nsm_set_broadcast_callback (nsm_client_t *nsm, nsm_broadcast_callback *broadcast_callback, void *userdata)
 
NSM_EXPORT int _nsm_osc_open (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_save (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_announce_reply (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_error (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_session_is_loaded (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_show (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_hide (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int _nsm_osc_broadcast (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
 
NSM_EXPORT int nsm_init (nsm_client_t *nsm, const char *nsm_url)
 
NSM_EXPORT int nsm_init_thread (nsm_client_t *nsm, const char *nsm_url)
 

Macro Definition Documentation

◆ _NSM

#define _NSM ( )    ((struct _nsm_client_t*)nsm)

Definition at line 95 of file nsm.h.

◆ NSM_API_VERSION_MAJOR

#define NSM_API_VERSION_MAJOR   1

Definition at line 76 of file nsm.h.

◆ NSM_API_VERSION_MINOR

#define NSM_API_VERSION_MINOR   0

Definition at line 77 of file nsm.h.

◆ NSM_EXPORT

#define NSM_EXPORT   __attribute__((unused)) static

Definition at line 97 of file nsm.h.

◆ OSC_REPLY

#define OSC_REPLY (   value)    lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value )

Definition at line 405 of file nsm.h.

◆ OSC_REPLY_ERR

#define OSC_REPLY_ERR (   errcode,
  value 
)    lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value )

Definition at line 407 of file nsm.h.

Typedef Documentation

◆ nsm_active_callback

typedef void() nsm_active_callback(int b, void *userdata)

Definition at line 91 of file nsm.h.

◆ nsm_broadcast_callback

typedef int() nsm_broadcast_callback(const char *, lo_message m, void *userdata)

Definition at line 93 of file nsm.h.

◆ nsm_client_t

typedef void* nsm_client_t

Definition at line 86 of file nsm.h.

◆ nsm_hide_gui_callback

typedef void() nsm_hide_gui_callback(void *userdata)

Definition at line 90 of file nsm.h.

◆ nsm_open_callback

typedef int() nsm_open_callback(const char *name, const char *display_name, const char *client_id, char **out_msg, void *userdata)

Definition at line 87 of file nsm.h.

◆ nsm_save_callback

typedef int() nsm_save_callback(char **out_msg, void *userdata)

Definition at line 88 of file nsm.h.

◆ nsm_session_is_loaded_callback

typedef void() nsm_session_is_loaded_callback(void *userdata)

Definition at line 92 of file nsm.h.

◆ nsm_show_gui_callback

typedef void() nsm_show_gui_callback(void *userdata)

Definition at line 89 of file nsm.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ERR_OK 
ERR_GENERAL 
ERR_INCOMPATIBLE_API 
ERR_BLACKLISTED 
ERR_LAUNCH_FAILED 
ERR_NO_SUCH_FILE 
ERR_NO_SESSION_OPEN 
ERR_UNSAVED_CHANGES 
ERR_NOT_NOW 

Definition at line 135 of file nsm.h.

Function Documentation

◆ _nsm_osc_announce_reply()

NSM_EXPORT int _nsm_osc_announce_reply ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 465 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_broadcast()

NSM_EXPORT int _nsm_osc_broadcast ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 556 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_error()

NSM_EXPORT int _nsm_osc_error ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 490 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_hide()

NSM_EXPORT int _nsm_osc_hide ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 543 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_open()

NSM_EXPORT int _nsm_osc_open ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 410 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_save()

NSM_EXPORT int _nsm_osc_save ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 438 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_session_is_loaded()

NSM_EXPORT int _nsm_osc_session_is_loaded ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 512 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ _nsm_osc_show()

NSM_EXPORT int _nsm_osc_show ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
lo_message  msg,
void *  user_data 
)

Definition at line 530 of file nsm.h.

Referenced by nsm_init(), and nsm_init_thread().

◆ nsm_check_nowait()

NSM_EXPORT void nsm_check_nowait ( nsm_client_t nsm)

Definition at line 292 of file nsm.h.

◆ nsm_check_wait()

NSM_EXPORT void nsm_check_wait ( nsm_client_t nsm,
int  timeout 
)

Definition at line 284 of file nsm.h.

Referenced by nsm_check_nowait().

◆ nsm_free()

NSM_EXPORT void nsm_free ( nsm_client_t nsm)

Definition at line 316 of file nsm.h.

◆ nsm_get_session_manager_features()

NSM_EXPORT const char * nsm_get_session_manager_features ( nsm_client_t nsm)

Definition at line 164 of file nsm.h.

◆ nsm_get_session_manager_name()

NSM_EXPORT const char * nsm_get_session_manager_name ( nsm_client_t nsm)

Definition at line 157 of file nsm.h.

◆ nsm_init()

NSM_EXPORT int nsm_init ( nsm_client_t nsm,
const char *  nsm_url 
)

Definition at line 574 of file nsm.h.

◆ nsm_init_thread()

NSM_EXPORT int nsm_init_thread ( nsm_client_t nsm,
const char *  nsm_url 
)

Definition at line 602 of file nsm.h.

◆ nsm_is_active()

◆ nsm_new()

NSM_EXPORT nsm_client_t * nsm_new ( void  )

Definition at line 171 of file nsm.h.

◆ nsm_send_announce()

NSM_EXPORT void nsm_send_announce ( nsm_client_t nsm,
const char *  app_name,
const char *  capabilities,
const char *  process_name 
)

Definition at line 250 of file nsm.h.

◆ nsm_send_broadcast()

NSM_EXPORT void nsm_send_broadcast ( nsm_client_t nsm,
lo_message  msg 
)

Definition at line 274 of file nsm.h.

◆ nsm_send_is_clean()

NSM_EXPORT void nsm_send_is_clean ( nsm_client_t nsm)

Definition at line 211 of file nsm.h.

◆ nsm_send_is_dirty()

NSM_EXPORT void nsm_send_is_dirty ( nsm_client_t nsm)

Definition at line 203 of file nsm.h.

◆ nsm_send_is_hidden()

NSM_EXPORT void nsm_send_is_hidden ( nsm_client_t nsm)

Definition at line 227 of file nsm.h.

◆ nsm_send_is_shown()

NSM_EXPORT void nsm_send_is_shown ( nsm_client_t nsm)

Definition at line 219 of file nsm.h.

◆ nsm_send_message()

NSM_EXPORT void nsm_send_message ( nsm_client_t nsm,
int  priority,
const char *  msg 
)

Definition at line 243 of file nsm.h.

◆ nsm_send_progress()

NSM_EXPORT void nsm_send_progress ( nsm_client_t nsm,
float  p 
)

Definition at line 235 of file nsm.h.

◆ nsm_set_active_callback()

NSM_EXPORT void nsm_set_active_callback ( nsm_client_t nsm,
nsm_active_callback active_callback,
void *  userdata 
)

Definition at line 373 of file nsm.h.

◆ nsm_set_broadcast_callback()

NSM_EXPORT void nsm_set_broadcast_callback ( nsm_client_t nsm,
nsm_broadcast_callback broadcast_callback,
void *  userdata 
)

Definition at line 390 of file nsm.h.

◆ nsm_set_hide_callback()

NSM_EXPORT void nsm_set_hide_callback ( nsm_client_t nsm,
nsm_hide_gui_callback hide_callback,
void *  userdata 
)

Definition at line 365 of file nsm.h.

◆ nsm_set_open_callback()

NSM_EXPORT void nsm_set_open_callback ( nsm_client_t nsm,
nsm_open_callback open_callback,
void *  userdata 
)

Definition at line 340 of file nsm.h.

◆ nsm_set_save_callback()

NSM_EXPORT void nsm_set_save_callback ( nsm_client_t nsm,
nsm_save_callback save_callback,
void *  userdata 
)

Definition at line 348 of file nsm.h.

◆ nsm_set_session_is_loaded_callback()

NSM_EXPORT void nsm_set_session_is_loaded_callback ( nsm_client_t nsm,
nsm_session_is_loaded_callback session_is_loaded_callback,
void *  userdata 
)

Definition at line 381 of file nsm.h.

◆ nsm_set_show_callback()

NSM_EXPORT void nsm_set_show_callback ( nsm_client_t nsm,
nsm_show_gui_callback show_callback,
void *  userdata 
)

Definition at line 357 of file nsm.h.

◆ nsm_thread_start()

NSM_EXPORT void nsm_thread_start ( nsm_client_t nsm)

Definition at line 300 of file nsm.h.

◆ nsm_thread_stop()

NSM_EXPORT void nsm_thread_stop ( nsm_client_t nsm)

Definition at line 308 of file nsm.h.

Referenced by nsm_free().