Skip to content
Snippets Groups Projects
Commit 2d32b3cc authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa
Browse files

*NIXify

parent 9b3fb4fc
Branches
No related merge requests found
# Notes: # Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional. # - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs! # - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive. # - All section names are case-sensitive.
# - Section names should be unique on each level. # - Section names should be unique on each level.
#---------------------------------# #---------------------------------#
# general configuration # # general configuration #
#---------------------------------# #---------------------------------#
# version format # version format
#version: 0.10.{build} #version: 0.10.{build}
# branches to build # branches to build
branches: branches:
# blacklist # blacklist
except: except:
- gh-pages - gh-pages
# Do not build on tags (GitHub only) # Do not build on tags (GitHub only)
skip_tags: true skip_tags: true
#---------------------------------# #---------------------------------#
# environment configuration # # environment configuration #
#---------------------------------# #---------------------------------#
os: Windows Server 2012 os: Windows Server 2012
# scripts that run after cloning repository # scripts that run after cloning repository
install: install:
# install Win-Flex-Bison # install Win-Flex-Bison
#- cmd: cinst winflexbison -y #- cmd: cinst winflexbison -y
#---------------------------------# #---------------------------------#
# build configuration # # build configuration #
#---------------------------------# #---------------------------------#
# scripts to run before build # scripts to run before build
before_build: before_build:
- cmd: cmake . - cmd: cmake .
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services) # scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
# before_package: # before_package:
# scripts to run after build # scripts to run after build
# after_build: # after_build:
# to run your custom scripts instead of automatic MSBuild # to run your custom scripts instead of automatic MSBuild
build_script: build_script:
- cmd: cmake --build . - cmd: cmake --build .
# to disable automatic builds # to disable automatic builds
# build: off # build: off
\ No newline at end of file
/* /*
* ngtcp2 * ngtcp2
* *
* Copyright (c) 2019 ngtcp2 contributors * Copyright (c) 2019 ngtcp2 contributors
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to * distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to * permit persons to whom the Software is furnished to do so, subject to
* the following conditions: * the following conditions:
* *
* The above copyright notice and this permission notice shall be * The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software. * included in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef NGTCP2_NET_H #ifndef NGTCP2_NET_H
#define NGTCP2_NET_H #define NGTCP2_NET_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> # include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */ #endif /* HAVE_ARPA_INET_H */
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> # include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */ #endif /* HAVE_NETINET_IN_H */
#include <ngtcp2/ngtcp2.h> #include <ngtcp2/ngtcp2.h>
#if defined(WIN32) #if defined(WIN32)
/* Windows requires ws2_32 library for ntonl family functions. We /* Windows requires ws2_32 library for ntonl family functions. We
define inline functions for those function so that we don't have define inline functions for those function so that we don't have
dependeny on that lib. */ dependeny on that lib. */
# ifdef _MSC_VER # ifdef _MSC_VER
# define STIN static __inline # define STIN static __inline
# else # else
# define STIN static inline # define STIN static inline
# endif # endif
STIN uint32_t htonl(uint32_t hostlong) { STIN uint32_t htonl(uint32_t hostlong) {
uint32_t res; uint32_t res;
unsigned char *p = (unsigned char *)&res; unsigned char *p = (unsigned char *)&res;
*p++ = hostlong >> 24; *p++ = hostlong >> 24;
*p++ = (hostlong >> 16) & 0xffu; *p++ = (hostlong >> 16) & 0xffu;
*p++ = (hostlong >> 8) & 0xffu; *p++ = (hostlong >> 8) & 0xffu;
*p = hostlong & 0xffu; *p = hostlong & 0xffu;
return res; return res;
} }
STIN uint16_t htons(uint16_t hostshort) { STIN uint16_t htons(uint16_t hostshort) {
uint16_t res; uint16_t res;
unsigned char *p = (unsigned char *)&res; unsigned char *p = (unsigned char *)&res;
*p++ = hostshort >> 8; *p++ = hostshort >> 8;
*p = hostshort & 0xffu; *p = hostshort & 0xffu;
return res; return res;
} }
STIN uint32_t ntohl(uint32_t netlong) { STIN uint32_t ntohl(uint32_t netlong) {
uint32_t res; uint32_t res;
unsigned char *p = (unsigned char *)&netlong; unsigned char *p = (unsigned char *)&netlong;
res = *p++ << 24; res = *p++ << 24;
res += *p++ << 16; res += *p++ << 16;
res += *p++ << 8; res += *p++ << 8;
res += *p; res += *p;
return res; return res;
} }
STIN uint16_t ntohs(uint16_t netshort) { STIN uint16_t ntohs(uint16_t netshort) {
uint16_t res; uint16_t res;
unsigned char *p = (unsigned char *)&netshort; unsigned char *p = (unsigned char *)&netshort;
res = *p++ << 8; res = *p++ << 8;
res += *p; res += *p;
return res; return res;
} }
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* NGTCP2_NET_H */ #endif /* NGTCP2_NET_H */
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment