Moved include of arpa/inet.h to spdylay_net.h

spdylay_net.h is compatibility layer for network related header files.
In the nature of spdylay library it should not depend on the actual
networking implementations, but we need some system headers for
optimization. Currently, arpha/inet.h and netinet/in.h are needed for
ntoh*/hton* functions.
This commit is contained in:
Tatsuhiro Tsujikawa 2012-03-24 00:14:04 +09:00
parent e9b56ab1f6
commit 5deef03687
5 changed files with 46 additions and 4 deletions

View File

@ -40,7 +40,8 @@ HFILES = spdylay_pq.h spdylay_int.h spdylay_map.h spdylay_queue.h \
spdylay_buffer.h spdylay_frame.h spdylay_zlib.h \
spdylay_session.h spdylay_helper.h spdylay_stream.h spdylay_int.h \
spdylay_npn.h \
spdylay_submit.h spdylay_outbound_item.h
spdylay_submit.h spdylay_outbound_item.h \
spdylay_net.h
libspdylay_la_SOURCES = $(HFILES) $(OBJECTS)
libspdylay_la_LDFLAGS = -no-undefined \

View File

@ -24,12 +24,12 @@
*/
#include "spdylay_frame.h"
#include <arpa/inet.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include "spdylay_helper.h"
#include "spdylay_net.h"
#define spdylay_frame_get_nv_len(IN, LEN_SIZE) \
(LEN_SIZE == 2 ? spdylay_get_uint16(IN) : spdylay_get_uint32(IN))

View File

@ -25,7 +25,8 @@
#include "spdylay_helper.h"
#include <string.h>
#include <arpa/inet.h>
#include "spdylay_net.h"
void spdylay_put_uint16be(uint8_t *buf, uint16_t n)
{

40
lib/spdylay_net.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Spdylay - SPDY Library
*
* Copyright (c) 2012 Tatsuhiro Tsujikawa
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SPDYLAY_NET_H
#define SPDYLAY_NET_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
#endif /* SPDYLAY_NET_H */

View File

@ -28,9 +28,9 @@
#include <stddef.h>
#include <stdio.h>
#include <assert.h>
#include <arpa/inet.h>
#include "spdylay_helper.h"
#include "spdylay_net.h"
/*
* Returns non-zero if the number of opened streams is larger than or