summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Hiszpanski <chris@liburtc.org>2021-04-23 11:17:03 -0400
committerChris Hiszpanski <chris@liburtc.org>2021-04-23 11:17:03 -0400
commit79f4f70de1a6014d53b245b8069c833ce943f943 (patch)
treeeb998bbcb5348ff61428b8e9f00ce55c33419fd6 /include
parentbf35c493b425886f12e3daf530239b5e6b1bca7d (diff)
Update inline license blocks and expand tabs
Diffstat (limited to 'include')
-rw-r--r--include/config.h34
-rw-r--r--include/ice.h34
-rw-r--r--include/peerconn.h34
-rw-r--r--include/runloop.h34
-rw-r--r--include/str.h34
-rw-r--r--include/stun.h134
-rw-r--r--include/urtc.h34
7 files changed, 126 insertions, 212 deletions
diff --git a/include/config.h b/include/config.h
index a003218..ef59ab1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
#ifndef URTC_CONFIG_H
diff --git a/include/ice.h b/include/ice.h
index 8b7251f..0f929f7 100644
--- a/include/ice.h
+++ b/include/ice.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
#ifndef URTC_ICE_H
diff --git a/include/peerconn.h b/include/peerconn.h
index feecc0e..63e83ce 100644
--- a/include/peerconn.h
+++ b/include/peerconn.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
#ifndef URTC_PEERCONN_H
diff --git a/include/runloop.h b/include/runloop.h
index ea840e7..8162016 100644
--- a/include/runloop.h
+++ b/include/runloop.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
/**
diff --git a/include/str.h b/include/str.h
index f0164d3..d8dc6fb 100644
--- a/include/str.h
+++ b/include/str.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
#ifndef URTC_STR_H
diff --git a/include/stun.h b/include/stun.h
deleted file mode 100644
index 126e7f5..0000000
--- a/include/stun.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#ifndef URTC_STUN_H
-#define URTC_STUN_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SIZEOF_STUN_HDR 20
-
-// STUN Classes
-#define STUN_CLASS_REQUEST 0
-#define STUN_CLASS_INDICTATION 1
-#define STUN_CLASS_SUCCESS 2
-#define STUN_CLASS_ERROR 3
-
-// STUN Methods
-#define STUN_METHOD_RESERVED 0
-#define STUN_METHOD_BINDING 1
-
-
-///////////////////////////// TYPE DEFINITIONS /////////////////////////////
-
-typedef struct {
- int rc; // Retransmission count
- int rto; // Retransmission timeout (in ms)
- int sockfd; // Socket file descriptor
-} stun_client_t;
-
-typedef struct {
- char *server;
-} stun_client_config_t;
-
-// STUN Message Header
-typedef struct __attribute__((__packed__)) {
- uint16_t reserved:2; // Upper two bits are 0
- uint16_t type:14; // 14-bit type
- uint16_t msglen; // Message length
- uint32_t cookie; // Magic cookie
- uint8_t txid[12]; // Transaction ID
-} stun_msg_hdr_t;
-
-// STUN Attribute
-typedef struct {
- uint16_t type; // Attribute type
- uint16_t len; // Value length, prior to padding
- uint8_t *val; // Pointer to attribute value
-} stun_attr_t;
-
-// STUN Attribute: MAPPED-ADDRESS
-typedef struct __attribute__((__packed__)) {
- uint8_t reserved;
- uint8_t family;
- uint16_t port;
- union {
- uint8_t ipv4[4]; // IPv4 address is 32-bits
- uint8_t ipv6[16]; // IPv6 address is 128-bits
- };
-} stun_attr_mapped_address_t;
-
-// STUN Attribute: XOR-MAPPED-ADDRESS
-typedef stun_attr_mapped_address_t stun_attr_xor_mapped_address_t;
-
-// STUN Attribute: USERNAME
-
-
-////////////////////////////////// MACROS //////////////////////////////////
-
-// Get class from message header type
-#define CLASS(typ) (((typ >> 7) & 0x2) | ((typ >> 4) & 0x1))
-
-// Get method from message header type
-#define METHOD(typ) (((typ >> 2) & 0xF80) | ((typ >> 1) & 0x70) | (typ & 0xF))
-
-#define TYPE(cls, mthd) ( \
- ((mthd & 0xF80) << 2) | \
- ((cls & 0x2) << 7) | \
- ((mthd & 0x70) << 1) | \
- ((cls & 0x1) << 4) | \
- (mthd & 0xF) \
-)
-
-
-/////////////////////////// FORWARD DECLARATIONS ///////////////////////////
-
-/**
- * (callback) Binding request response handler
- *
- * @param[in] name
- * @param[in] arg User argument
- */
-typedef void (*stun_client_binding_response_callback)(
- const char *name,
- void *arg
-);
-
-/**
- * Sends a STUN binding request to the specified server
- *
- * @param[in] srv Server (hostname or IP address)
- * @param[in] cb Handler to call when a response is received
- * @param[in] arg Optional user argument to pass to callback
- */
-err_t stun_client_binding_request(
- runloop_t *rl,
- const char *srv,
- stun_client_binding_response_callback cb,
- void *arg
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* URTC_STUN_H */
diff --git a/include/urtc.h b/include/urtc.h
index 3eabba0..abf2939 100644
--- a/include/urtc.h
+++ b/include/urtc.h
@@ -1,19 +1,27 @@
-/*
- * liburtc
- * Copyright (C) 2019 Chris Hiszpanski
+/**
+ * Copyright (c) 2019-2021 Chris Hiszpanski. All rights reserved.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
*
- * This program 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 General Public License for more details.
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
*/
#ifndef URTC_H