mosquitto/src/mux.c

89 lines
1.8 KiB
C
Raw Normal View History

2020-02-15 14:49:53 +00:00
/*
Copyright (c) 2009-2019 Roger Light <roger@atchoo.org>
All rights reserved. This program and the accompanying materials
2020-11-25 17:34:21 +00:00
are made available under the terms of the Eclipse Public License 2.0
2020-02-15 14:49:53 +00:00
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
2020-11-25 17:34:21 +00:00
https://www.eclipse.org/legal/epl-2.0/
2020-02-15 14:49:53 +00:00
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
2020-12-01 18:21:59 +00:00
SPDX-License-Identifier: EPL-2.0 OR EDL-1.0
2020-02-15 14:49:53 +00:00
Contributors:
Roger Light - initial implementation and documentation.
Tatsuzo Osawa - Add epoll.
*/
#include "mux.h"
int mux__init(struct mosquitto__listener_sock *listensock, int listensock_count)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__init(listensock, listensock_count);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__init(listensock, listensock_count);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__add_out(struct mosquitto *context)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__add_out(context);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__add_out(context);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__remove_out(struct mosquitto *context)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__remove_out(context);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__remove_out(context);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__add_in(struct mosquitto *context)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__add_in(context);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__add_in(context);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__delete(struct mosquitto *context)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__delete(context);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__delete(context);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__handle(struct mosquitto__listener_sock *listensock, int listensock_count)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__handle(listensock, listensock_count);
2020-02-15 14:49:53 +00:00
#else
return mux_poll__handle(listensock, listensock_count);
2020-02-15 14:49:53 +00:00
#endif
}
int mux__cleanup(void)
2020-02-15 14:49:53 +00:00
{
#ifdef WITH_EPOLL
return mux_epoll__cleanup();
2020-02-15 14:49:53 +00:00
#else
return mux_poll__cleanup();
2020-02-15 14:49:53 +00:00
#endif
}