SPIN Framework

include/libloUtil.h

00001 // -----------------------------------------------------------------------------
00002 // |    ___  ___  _  _ _     ___                                        _      |
00003 // |   / __>| . \| || \ |   | __>_ _  ___ ._ _ _  ___  _ _ _  ___  _ _ | |__   |
00004 // |   \__ \|  _/| ||   |   | _>| '_><_> || ' ' |/ ._>| | | |/ . \| '_>| / /   |
00005 // |   <___/|_|  |_||_\_|   |_| |_|  <___||_|_|_|\___.|__/_/ \___/|_|  |_\_\   |
00006 // |                                                                           |
00007 // |---------------------------------------------------------------------------|
00008 //
00009 // http://spinframework.sourceforge.net
00010 // Copyright (C) 2009 Mike Wozniewski, Zack Settel
00011 //
00012 // Developed/Maintained by:
00013 //    Mike Wozniewski (http://www.mikewoz.com)
00014 //    Zack Settel (http://www.sheefa.net/zack)
00015 // 
00016 // Principle Partners:
00017 //    Shared Reality Lab, McGill University (http://www.cim.mcgill.ca/sre)
00018 //    La Societe des Arts Technologiques (http://www.sat.qc.ca)
00019 //
00020 // Funding by:
00021 //    NSERC/Canada Council for the Arts - New Media Initiative
00022 //    Heritage Canada
00023 //    Ministere du Developpement economique, de l'Innovation et de l'Exportation
00024 //
00025 // -----------------------------------------------------------------------------
00026 //  This file is part of the SPIN Framework.
00027 //
00028 //  SPIN Framework is free software: you can redistribute it and/or modify
00029 //  it under the terms of the GNU Lesser General Public License as published by
00030 //  the Free Software Foundation, either version 3 of the License, or
00031 //  (at your option) any later version.
00032 //
00033 //  SPIN Framework is distributed in the hope that it will be useful,
00034 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00035 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00036 //  GNU Lesser General Public License for more details.
00037 //
00038 //  You should have received a copy of the GNU Lesser General Public License
00039 //  along with SPIN Framework. If not, see <http://www.gnu.org/licenses/>.
00040 // -----------------------------------------------------------------------------
00041 
00042 #ifndef LIBLOUTIL_H
00043 #define LIBLOUTIL_H
00044 
00045 #include <lo/lo.h>
00046 #include <cstdlib>
00047 #include <cstring>
00048 
00049 typedef struct _lo_method {
00050         const char        *path;
00051         const char        *typespec;
00052         lo_method_handler  handler;
00053         char              *user_data;
00054         struct _lo_method *next;
00055 } *internal_lo_method;
00056 
00057 #ifdef LO_VERSION_25
00058 typedef struct _lo_server {
00059         int                      socket;
00060         struct addrinfo         *ai;
00061         lo_method                first;
00062         lo_err_handler           err_h;
00063         int                      port;
00064         char                    *hostname;
00065         char                    *path;
00066         int                      protocol;
00067         void                    *queued;
00068         struct sockaddr_storage  addr;
00069         socklen_t                addr_len;
00070 } *internal_lo_server;
00071 #else
00072 typedef struct _lo_server {
00073         struct addrinfo         *ai;
00074         lo_method                first;
00075         lo_err_handler           err_h;
00076         int                      port;
00077         char                    *hostname;
00078         char                    *path;
00079         int                      protocol;
00080         void                    *queued;
00081         struct sockaddr_storage  addr;
00082         socklen_t                addr_len;
00083         int                  sockets_len;
00084         int                  sockets_alloc;
00085 #ifdef HAVE_POLL
00086         struct pollfd        *sockets;
00087 #else
00088         struct { int fd; }   *sockets;
00089 #endif
00090 } *internal_lo_server;
00091 #endif
00092 
00093 
00109 void lo_server_del_method_with_userdata(lo_server lo_serv, const char *path, const char *typespec, void *userdata);
00110 
00111 
00112 
00113 #endif