1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Feature: Added stub for new socket API

This commit is contained in:
Philipp Schafft 2019-09-18 09:20:38 +00:00
parent 0589e0b97b
commit ec977403d7
4 changed files with 94 additions and 0 deletions

View File

@ -22,6 +22,7 @@ pkginclude_HEADERS = \
include/igloo/typedef.h \
include/igloo/interface.h \
include/igloo/io.h \
include/igloo/socket.h \
include/igloo/stdio.h \
include/igloo/filter.h \
include/igloo/objecthandler.h \
@ -38,6 +39,7 @@ libigloo_la_SOURCES = \
src/interface.c \
src/ro.c \
src/io.c \
src/socket.c \
src/stdio.c \
src/filter.c \
src/objecthandler.c \

40
include/igloo/socket.h Normal file
View File

@ -0,0 +1,40 @@
/* Copyright (C) 2019 Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _LIBIGLOO__SOCKET_H_
#define _LIBIGLOO__SOCKET_H_
/**
* @file
* Put a good description of this file here
*/
#ifdef __cplusplus
extern "C" {
#endif
/* Put stuff here */
#include "io.h"
igloo_RO_FORWARD_TYPE(igloo_socket_t);
#ifdef __cplusplus
}
#endif
#endif /* ! _LIBIGLOO__STDIO_H_ */

View File

@ -40,6 +40,7 @@ extern "C" {
#include "typedef.h"
typedef struct igloo_io_tag igloo_io_t;
typedef struct igloo_socket_tag igloo_socket_t;
typedef struct igloo_filter_tag igloo_filter_t;
typedef struct igloo_objecthandler_tag igloo_objecthandler_t;
typedef struct igloo_logmsg_tag igloo_logmsg_t;
@ -70,6 +71,7 @@ typedef union __attribute__ ((__transparent_union__)) {
/* Those are libigloo's own types */
igloo_RO_TYPE(igloo_ro_base_t)
igloo_RO_TYPE(igloo_io_t)
igloo_RO_TYPE(igloo_socket_t)
igloo_RO_TYPE(igloo_filter_t)
igloo_RO_TYPE(igloo_objecthandler_t)
igloo_RO_TYPE(igloo_logmsg_t)

50
src/socket.c Normal file
View File

@ -0,0 +1,50 @@
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2019, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <igloo/socket.h>
struct igloo_socket_tag {
igloo_ro_base_t __base;
};
static int __new(igloo_ro_t self, const igloo_ro_type_t *type, va_list ap);
static void __free(igloo_ro_t self);
static igloo_ro_t __get_interface_t(igloo_ro_t self, const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance);
igloo_RO_PUBLIC_TYPE(igloo_socket_t,
igloo_RO_TYPEDECL_FREE(__free),
igloo_RO_TYPEDECL_NEW(__new),
igloo_RO_TYPEDECL_GET_INTERFACE(__get_interface_t)
);
static int __new(igloo_ro_t self, const igloo_ro_type_t *type, va_list ap)
{
return 0;
}
static void __free(igloo_ro_t self)
{
}
static igloo_ro_t __get_interface_t(igloo_ro_t self, const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance)
{
igloo_socket_t *socket = igloo_RO_TO_TYPE(self, igloo_socket_t);
if (!socket)
return igloo_RO_NULL;
if (type != igloo_RO_GET_TYPE_BY_SYMBOL(igloo_io_t))
return igloo_RO_NULL;
return igloo_RO_NULL;
}