From 84f85ceac0f993be95dda89584749ea59fe5b8e7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 7 Aug 2014 13:49:07 +0000 Subject: Tox added from branch git-svn-id: http://svn.miranda-ng.org/main/trunk@10115 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/Tox_10.vcxproj | 209 ++++ protocols/Tox/Tox_10.vcxproj.filters | 62 ++ protocols/Tox/Tox_11.vcxproj | 234 +++++ protocols/Tox/Tox_11.vcxproj.filters | 62 ++ protocols/Tox/Tox_12.vcxproj | 218 +++++ protocols/Tox/Tox_12.vcxproj.filters | 62 ++ protocols/Tox/dll/libtox.dll | Bin 0 -> 2922568 bytes protocols/Tox/docs/README.md | 18 + protocols/Tox/include/tox/tox.h | 666 +++++++++++++ protocols/Tox/include/tox/toxav.h | 393 ++++++++ protocols/Tox/include/tox/toxdns.h | 85 ++ protocols/Tox/lib/libtox.def | 1728 ++++++++++++++++++++++++++++++++++ protocols/Tox/lib/libtox.exp | Bin 0 -> 242802 bytes protocols/Tox/lib/libtox.lib | Bin 0 -> 401722 bytes protocols/Tox/res/resource.rc | Bin 0 -> 4956 bytes protocols/Tox/src/common.h | 25 + protocols/Tox/src/main.cpp | 52 + protocols/Tox/src/resource.h | Bin 0 -> 992 bytes protocols/Tox/src/stdafx.cpp | 18 + protocols/Tox/src/tox_contacts.cpp | 70 ++ protocols/Tox/src/tox_events.cpp | 29 + protocols/Tox/src/tox_instances.cpp | 44 + protocols/Tox/src/tox_proto.cpp | 161 ++++ protocols/Tox/src/tox_proto.h | 108 +++ protocols/Tox/src/tox_services.cpp | 16 + protocols/Tox/src/version.h | 15 + 26 files changed, 4275 insertions(+) create mode 100644 protocols/Tox/Tox_10.vcxproj create mode 100644 protocols/Tox/Tox_10.vcxproj.filters create mode 100644 protocols/Tox/Tox_11.vcxproj create mode 100644 protocols/Tox/Tox_11.vcxproj.filters create mode 100644 protocols/Tox/Tox_12.vcxproj create mode 100644 protocols/Tox/Tox_12.vcxproj.filters create mode 100644 protocols/Tox/dll/libtox.dll create mode 100644 protocols/Tox/docs/README.md create mode 100644 protocols/Tox/include/tox/tox.h create mode 100644 protocols/Tox/include/tox/toxav.h create mode 100644 protocols/Tox/include/tox/toxdns.h create mode 100644 protocols/Tox/lib/libtox.def create mode 100644 protocols/Tox/lib/libtox.exp create mode 100644 protocols/Tox/lib/libtox.lib create mode 100644 protocols/Tox/res/resource.rc create mode 100644 protocols/Tox/src/common.h create mode 100644 protocols/Tox/src/main.cpp create mode 100644 protocols/Tox/src/resource.h create mode 100644 protocols/Tox/src/stdafx.cpp create mode 100644 protocols/Tox/src/tox_contacts.cpp create mode 100644 protocols/Tox/src/tox_events.cpp create mode 100644 protocols/Tox/src/tox_instances.cpp create mode 100644 protocols/Tox/src/tox_proto.cpp create mode 100644 protocols/Tox/src/tox_proto.h create mode 100644 protocols/Tox/src/tox_services.cpp create mode 100644 protocols/Tox/src/version.h diff --git a/protocols/Tox/Tox_10.vcxproj b/protocols/Tox/Tox_10.vcxproj new file mode 100644 index 0000000000..093bf63a46 --- /dev/null +++ b/protocols/Tox/Tox_10.vcxproj @@ -0,0 +1,209 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F5282DBC-756B-4071-B186-3E82C0E8E1F7} + Tox + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + D:\X-Files\Projects\miranda-ng\plugins\Tox\include;$(IncludePath) + D:\X-Files\Projects\miranda-ng\plugins\Tox\lib;$(LibraryPath) + + + D:\X-Files\Projects\miranda-ng\plugins\Tox\include;$(IncludePath) + D:\X-Files\Projects\miranda-ng\plugins\Tox\lib;$(LibraryPath) + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + common.h + Use + + + Windows + true + $(ProfileDir)..\..\bin10\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;libtoxcore-0.lib + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + Use + common.h + + + Windows + true + $(ProfileDir)..\..\bin10\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;libtoxcore-0.lib + $(ProfileDir)..\..\bin10\lib;lib + $(IntDir)$(TargetName).lib + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin10\lib;lib + $(IntDir)$(TargetName).lib + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + Create + + + + + + + + \ No newline at end of file diff --git a/protocols/Tox/Tox_10.vcxproj.filters b/protocols/Tox/Tox_10.vcxproj.filters new file mode 100644 index 0000000000..35422ff8dc --- /dev/null +++ b/protocols/Tox/Tox_10.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + {86de5614-9de5-4ffc-bd34-21d9c671e172} + + + {ea03e4bb-b8dd-4b5b-b409-2513240d2511} + + + {283e5715-d541-4bda-9ec6-31b29865e1f0} + + + {b818611d-200d-4eb8-be7a-f15b396ae26d} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files\tox + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/protocols/Tox/Tox_11.vcxproj b/protocols/Tox/Tox_11.vcxproj new file mode 100644 index 0000000000..5a58eb882a --- /dev/null +++ b/protocols/Tox/Tox_11.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {BCFAB658-326E-466D-995B-E76636C1DEA4} + Tox + + + + DynamicLibrary + true + Unicode + v110_xp + + + DynamicLibrary + true + Unicode + v110_xp + + + DynamicLibrary + false + true + Unicode + v110_xp + + + DynamicLibrary + false + true + Unicode + v110_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + D:\X-Files\Projects\miranda-ng\plugins\Tox\include;$(IncludePath) + D:\X-Files\Projects\miranda-ng\plugins\Tox\lib;$(LibraryPath) + + + D:\X-Files\Projects\miranda-ng\plugins\Tox\include;$(IncludePath) + D:\X-Files\Projects\miranda-ng\plugins\Tox\lib;$(LibraryPath) + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + common.h + Use + + + Windows + true + $(ProfileDir)..\..\bin11\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;user32.lib;libtoxcore-0.lib + false + /SAFESEH:NO %(AdditionalOptions) + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + Use + common.h + + + Windows + true + $(ProfileDir)..\..\bin11\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;user32.lib;libtoxcore-0.lib;%(AdditionalDependencies) + false + /SAFESEH:NO %(AdditionalOptions) + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;user32.lib;libtoxcore-0.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin11\lib;lib + $(IntDir)$(TargetName).lib + /SAFESEH:NO %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;user32.lib;libtoxcore-0.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin11\lib;lib + $(IntDir)$(TargetName).lib + /SAFESEH:NO %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + + + + + + + + + Create + + + + + + + + + + + + + + \ No newline at end of file diff --git a/protocols/Tox/Tox_11.vcxproj.filters b/protocols/Tox/Tox_11.vcxproj.filters new file mode 100644 index 0000000000..35422ff8dc --- /dev/null +++ b/protocols/Tox/Tox_11.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + {86de5614-9de5-4ffc-bd34-21d9c671e172} + + + {ea03e4bb-b8dd-4b5b-b409-2513240d2511} + + + {283e5715-d541-4bda-9ec6-31b29865e1f0} + + + {b818611d-200d-4eb8-be7a-f15b396ae26d} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files\tox + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/protocols/Tox/Tox_12.vcxproj b/protocols/Tox/Tox_12.vcxproj new file mode 100644 index 0000000000..c6b095ea9e --- /dev/null +++ b/protocols/Tox/Tox_12.vcxproj @@ -0,0 +1,218 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {BCFAB658-326E-466D-995B-E76636C1DEA4} + Tox + + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + v120_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + common.h + Use + + + Windows + true + $(ProfileDir)..\..\bin12\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;user32.lib;libtox.lib + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + Use + common.h + + + Windows + true + $(ProfileDir)..\..\bin12\lib;lib + $(IntDir)$(TargetName).lib + comctl32.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;user32.lib;libtoxcore-0.lib + $(ProfileDir)..\..\bin12\lib;lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + xcopy dll\*.dll $(SolutionDir)$(Configuration) + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + + + Windows + true + true + true + false + comctl32.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin12\lib;lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + Create + + + + + + + + + + + + + + \ No newline at end of file diff --git a/protocols/Tox/Tox_12.vcxproj.filters b/protocols/Tox/Tox_12.vcxproj.filters new file mode 100644 index 0000000000..35422ff8dc --- /dev/null +++ b/protocols/Tox/Tox_12.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + {86de5614-9de5-4ffc-bd34-21d9c671e172} + + + {ea03e4bb-b8dd-4b5b-b409-2513240d2511} + + + {283e5715-d541-4bda-9ec6-31b29865e1f0} + + + {b818611d-200d-4eb8-be7a-f15b396ae26d} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files\tox + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/protocols/Tox/dll/libtox.dll b/protocols/Tox/dll/libtox.dll new file mode 100644 index 0000000000..208a9d7c5d Binary files /dev/null and b/protocols/Tox/dll/libtox.dll differ diff --git a/protocols/Tox/docs/README.md b/protocols/Tox/docs/README.md new file mode 100644 index 0000000000..0879158997 --- /dev/null +++ b/protocols/Tox/docs/README.md @@ -0,0 +1,18 @@ +Prerequisites +------------- + +You will need PowerShell for preparing the `.def` file. + +### Tox-Core + +Download Tox DLL from [the CI server](https://jenkins.libtoxcore.so/job/toxcore_win32_dll/). Put that DLL into `dll` directory, copy the `include` files. + +Now you need to prepare the `.def` file for the DLL. You have to prepare the corresponding `.lib` file for the DLL. To do it, start PowerShell and enter a Visual Studio command environment. Then execute the following script: + + PS> 'EXPORTS' | Out-File .\libtox.def -Encoding ascii; dumpbin.exe /exports .\libtox.dll | % { ($_ -split '\s+')[4] } | Out-File .\libtox.def -Append -Encoding ascii + +It prepares the `def` file for the next step - the `lib` tool: + + PS> lib /def:libtox.def /out:libtox.lib /machine:x86 + +You'll get the `libtox.lib` import library in the current directory. Copy it to `lib` project directory and you're ready! diff --git a/protocols/Tox/include/tox/tox.h b/protocols/Tox/include/tox/tox.h new file mode 100644 index 0000000000..14426f31cc --- /dev/null +++ b/protocols/Tox/include/tox/tox.h @@ -0,0 +1,666 @@ +/* tox.h + * + * The Tox public API. + * + * Copyright (C) 2013 Tox project All Rights Reserved. + * + * This file is part of Tox. + * + * Tox 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. + * + * Tox 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 Tox. If not, see . + * + */ + +#ifndef TOX_H +#define TOX_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#define TOX_MAX_NAME_LENGTH 128 + +/* Maximum length of single messages after which they should be split. */ +#define TOX_MAX_MESSAGE_LENGTH 1368 +#define TOX_MAX_STATUSMESSAGE_LENGTH 1007 +#define TOX_CLIENT_ID_SIZE 32 + +#define TOX_FRIEND_ADDRESS_SIZE (TOX_CLIENT_ID_SIZE + sizeof(uint32_t) + sizeof(uint16_t)) + +#define TOX_ENABLE_IPV6_DEFAULT 1 + +/* Errors for m_addfriend + * FAERR - Friend Add Error + */ +enum { + TOX_FAERR_TOOLONG = -1, + TOX_FAERR_NOMESSAGE = -2, + TOX_FAERR_OWNKEY = -3, + TOX_FAERR_ALREADYSENT = -4, + TOX_FAERR_UNKNOWN = -5, + TOX_FAERR_BADCHECKSUM = -6, + TOX_FAERR_SETNEWNOSPAM = -7, + TOX_FAERR_NOMEM = -8 +}; + +/* USERSTATUS - + * Represents userstatuses someone can have. + */ +typedef enum { + TOX_USERSTATUS_NONE, + TOX_USERSTATUS_AWAY, + TOX_USERSTATUS_BUSY, + TOX_USERSTATUS_INVALID +} +TOX_USERSTATUS; + +#ifndef __TOX_DEFINED__ +#define __TOX_DEFINED__ +typedef struct Tox Tox; +#endif + +/* NOTE: Strings in Tox are all UTF-8, (This means that there is no terminating NULL character.) + * + * The exact buffer you send will be received at the other end without modification. + * + * Do not treat Tox strings as C strings. + */ + +/* return TOX_FRIEND_ADDRESS_SIZE byte address to give to others. + * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] + */ +void tox_get_address(const Tox *tox, uint8_t *address); + +/* Add a friend. + * Set the data that will be sent along with friend request. + * address is the address of the friend (returned by getaddress of the friend you wish to add) it must be TOX_FRIEND_ADDRESS_SIZE bytes. TODO: add checksum. + * data is the data and length is the length. + * + * return the friend number if success. + * return TOX_FAERR_TOOLONG if message length is too long. + * return TOX_FAERR_NOMESSAGE if no message (message length must be >= 1 byte). + * return TOX_FAERR_OWNKEY if user's own key. + * return TOX_FAERR_ALREADYSENT if friend request already sent or already a friend. + * return TOX_FAERR_UNKNOWN for unknown error. + * return TOX_FAERR_BADCHECKSUM if bad checksum in address. + * return TOX_FAERR_SETNEWNOSPAM if the friend was already there but the nospam was different. + * (the nospam for that friend was set to the new one). + * return TOX_FAERR_NOMEM if increasing the friend list size fails. + */ +int32_t tox_add_friend(Tox *tox, const uint8_t *address, const uint8_t *data, uint16_t length); + + +/* Add a friend without sending a friendrequest. + * return the friend number if success. + * return -1 if failure. + */ +int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *client_id); + +/* return the friend number associated to that client id. + return -1 if no such friend */ +int32_t tox_get_friend_number(const Tox *tox, const uint8_t *client_id); + +/* Copies the public key associated to that friend id into client_id buffer. + * Make sure that client_id is of size CLIENT_ID_SIZE. + * return 0 if success. + * return -1 if failure. + */ +int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *client_id); + +/* Remove a friend. + * + * return 0 if success. + * return -1 if failure. + */ +int tox_del_friend(Tox *tox, int32_t friendnumber); + +/* Checks friend's connecting status. + * + * return 1 if friend is connected to us (Online). + * return 0 if friend is not connected to us (Offline). + * return -1 on failure. + */ +int tox_get_friend_connection_status(const Tox *tox, int32_t friendnumber); + +/* Checks if there exists a friend with given friendnumber. + * + * return 1 if friend exists. + * return 0 if friend doesn't exist. + */ +int tox_friend_exists(const Tox *tox, int32_t friendnumber); + +/* Send a text chat message to an online friend. + * + * return the message id if packet was successfully put into the send queue. + * return 0 if it was not. + * + * maximum length of messages is TOX_MAX_MESSAGE_LENGTH, your client must split larger messages + * or else sending them will not work. No the core will not split messages for you because that + * requires me to parse UTF-8. + * + * You will want to retain the return value, it will be passed to your read_receipt callback + * if one is received. + * m_sendmessage_withid will send a message with the id of your choosing, + * however we can generate an id for you by calling plain m_sendmessage. + */ +uint32_t tox_send_message(Tox *tox, int32_t friendnumber, const uint8_t *message, uint32_t length); +uint32_t tox_send_message_withid(Tox *tox, int32_t friendnumber, uint32_t theid, const uint8_t *message, + uint32_t length); + +/* Send an action to an online friend. + * + * return the message id if packet was successfully put into the send queue. + * return 0 if it was not. + * + * maximum length of actions is TOX_MAX_MESSAGE_LENGTH, your client must split larger actions + * or else sending them will not work. No the core will not split actions for you because that + * requires me to parse UTF-8. + * + * You will want to retain the return value, it will be passed to your read_receipt callback + * if one is received. + * m_sendaction_withid will send an action message with the id of your choosing, + * however we can generate an id for you by calling plain m_sendaction. + */ +uint32_t tox_send_action(Tox *tox, int32_t friendnumber, const uint8_t *action, uint32_t length); +uint32_t tox_send_action_withid(Tox *tox, int32_t friendnumber, uint32_t theid, const uint8_t *action, uint32_t length); + +/* Set our nickname. + * name must be a string of maximum MAX_NAME_LENGTH length. + * length must be at least 1 byte. + * length is the length of name with the NULL terminator. + * + * return 0 if success. + * return -1 if failure. + */ +int tox_set_name(Tox *tox, const uint8_t *name, uint16_t length); + +/* + * Get your nickname. + * m - The messenger context to use. + * name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. + * + * return length of name. + * return 0 on error. + */ +uint16_t tox_get_self_name(const Tox *tox, uint8_t *name); + +/* Get name of friendnumber and put it in name. + * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. + * + * return length of name if success. + * return -1 if failure. + */ +int tox_get_name(const Tox *tox, int32_t friendnumber, uint8_t *name); + +/* returns the length of name on success. + * returns -1 on failure. + */ +int tox_get_name_size(const Tox *tox, int32_t friendnumber); +int tox_get_self_name_size(const Tox *tox); + +/* Set our user status. + * + * userstatus must be one of TOX_USERSTATUS values. + * max length of the status is TOX_MAX_STATUSMESSAGE_LENGTH. + * + * returns 0 on success. + * returns -1 on failure. + */ +int tox_set_status_message(Tox *tox, const uint8_t *status, uint16_t length); +int tox_set_user_status(Tox *tox, uint8_t userstatus); + +/* returns the length of status message on success. + * returns -1 on failure. + */ +int tox_get_status_message_size(const Tox *tox, int32_t friendnumber); +int tox_get_self_status_message_size(const Tox *tox); + +/* Copy friendnumber's status message into buf, truncating if size is over maxlen. + * Get the size you need to allocate from m_get_statusmessage_size. + * The self variant will copy our own status message. + * + * returns the length of the copied data on success + * retruns -1 on failure. + */ +int tox_get_status_message(const Tox *tox, int32_t friendnumber, uint8_t *buf, uint32_t maxlen); +int tox_get_self_status_message(const Tox *tox, uint8_t *buf, uint32_t maxlen); + +/* return one of TOX_USERSTATUS values. + * Values unknown to your application should be represented as TOX_USERSTATUS_NONE. + * As above, the self variant will return our own TOX_USERSTATUS. + * If friendnumber is invalid, this shall return TOX_USERSTATUS_INVALID. + */ +uint8_t tox_get_user_status(const Tox *tox, int32_t friendnumber); +uint8_t tox_get_self_user_status(const Tox *tox); + + +/* returns timestamp of last time friendnumber was seen online, or 0 if never seen. + * returns -1 on error. + */ +uint64_t tox_get_last_online(const Tox *tox, int32_t friendnumber); + +/* Set our typing status for a friend. + * You are responsible for turning it on or off. + * + * returns 0 on success. + * returns -1 on failure. + */ +int tox_set_user_is_typing(Tox *tox, int32_t friendnumber, uint8_t is_typing); + +/* Get the typing status of a friend. + * + * returns 0 if friend is not typing. + * returns 1 if friend is typing. + */ +uint8_t tox_get_is_typing(const Tox *tox, int32_t friendnumber); + +/* Sets whether we send read receipts for friendnumber. + * This function is not lazy, and it will fail if yesno is not (0 or 1). + */ +void tox_set_sends_receipts(Tox *tox, int32_t friendnumber, int yesno); + +/* Return the number of friends in the instance m. + * You should use this to determine how much memory to allocate + * for copy_friendlist. */ +uint32_t tox_count_friendlist(const Tox *tox); + +/* Return the number of online friends in the instance m. */ +uint32_t tox_get_num_online_friends(const Tox *tox); + +/* Copy a list of valid friend IDs into the array out_list. + * If out_list is NULL, returns 0. + * Otherwise, returns the number of elements copied. + * If the array was too small, the contents + * of out_list will be truncated to list_size. */ +uint32_t tox_get_friendlist(const Tox *tox, int32_t *out_list, uint32_t list_size); + +/* Set the function that will be executed when a friend request is received. + * Function format is function(Tox *tox, uint8_t * public_key, uint8_t * data, uint16_t length, void *userdata) + */ +void tox_callback_friend_request(Tox *tox, void (*function)(Tox *tox, const uint8_t *, const uint8_t *, uint16_t, + void *), void *userdata); + +/* Set the function that will be executed when a message from a friend is received. + * Function format is: function(Tox *tox, int32_t friendnumber, uint8_t * message, uint16_t length, void *userdata) + */ +void tox_callback_friend_message(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set the function that will be executed when an action from a friend is received. + * Function format is: function(Tox *tox, int32_t friendnumber, uint8_t * action, uint16_t length, void *userdata) + */ +void tox_callback_friend_action(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set the callback for name changes. + * function(Tox *tox, int32_t friendnumber, uint8_t *newname, uint16_t length, void *userdata) + * You are not responsible for freeing newname + */ +void tox_callback_name_change(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set the callback for status message changes. + * function(Tox *tox, int32_t friendnumber, uint8_t *newstatus, uint16_t length, void *userdata) + * You are not responsible for freeing newstatus. + */ +void tox_callback_status_message(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set the callback for status type changes. + * function(Tox *tox, int32_t friendnumber, uint8_t TOX_USERSTATUS, void *userdata) + */ +void tox_callback_user_status(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); + +/* Set the callback for typing changes. + * function (Tox *tox, int32_t friendnumber, uint8_t is_typing, void *userdata) + */ +void tox_callback_typing_change(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); + +/* Set the callback for read receipts. + * function(Tox *tox, int32_t friendnumber, uint32_t receipt, void *userdata) + * + * If you are keeping a record of returns from m_sendmessage; + * receipt might be one of those values, meaning the message + * has been received on the other side. + * Since core doesn't track ids for you, receipt may not correspond to any message. + * In that case, you should discard it. + */ +void tox_callback_read_receipt(Tox *tox, void (*function)(Tox *tox, int32_t, uint32_t, void *), void *userdata); + +/* Set the callback for connection status changes. + * function(Tox *tox, int32_t friendnumber, uint8_t status, void *userdata) + * + * Status: + * 0 -- friend went offline after being previously online + * 1 -- friend went online + * + * NOTE: This callback is not called when adding friends, thus the "after + * being previously online" part. it's assumed that when adding friends, + * their connection status is offline. + */ +void tox_callback_connection_status(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); + + +/**********ADVANCED FUNCTIONS (If you don't know what they do you can safely ignore them.) ************/ + +/* Functions to get/set the nospam part of the id. + */ +uint32_t tox_get_nospam(const Tox *tox); +void tox_set_nospam(Tox *tox, uint32_t nospam); + + +/**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ + +/* Set the callback for group invites. + * + * Function(Tox *tox, int friendnumber, uint8_t *group_public_key, void *userdata) + */ +void tox_callback_group_invite(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, void *), void *userdata); + +/* Set the callback for group messages. + * + * Function(Tox *tox, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata) + */ +void tox_callback_group_message(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set the callback for group actions. + * + * Function(Tox *tox, int groupnumber, int friendgroupnumber, uint8_t * action, uint16_t length, void *userdata) + */ +void tox_callback_group_action(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), + void *userdata); + +/* Set callback function for peer name list changes. + * + * It gets called every time the name list changes(new peer/name, deleted peer) + * Function(Tox *tox, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata) + */ +typedef enum { + TOX_CHAT_CHANGE_PEER_ADD, + TOX_CHAT_CHANGE_PEER_DEL, + TOX_CHAT_CHANGE_PEER_NAME, +} TOX_CHAT_CHANGE; + +void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), + void *userdata); + +/* Creates a new groupchat and puts it in the chats array. + * + * return group number on success. + * return -1 on failure. + */ +int tox_add_groupchat(Tox *tox); + +/* Delete a groupchat from the chats array. + * + * return 0 on success. + * return -1 if failure. + */ +int tox_del_groupchat(Tox *tox, int groupnumber); + +/* Copy the name of peernumber who is in groupnumber to name. + * name must be at least TOX_MAX_NAME_LENGTH long. + * + * return length of name if success + * return -1 if failure + */ +int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name); + +/* invite friendnumber to groupnumber + * return 0 on success + * return -1 on failure + */ +int tox_invite_friend(Tox *tox, int32_t friendnumber, int groupnumber); + +/* Join a group (you need to have been invited first.) + * + * returns group number on success + * returns -1 on failure. + */ +int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *friend_group_public_key); + +/* send a group message + * return 0 on success + * return -1 on failure + */ +int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint32_t length); + +/* send a group action + * return 0 on success + * return -1 on failure + */ +int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint32_t length); + +/* Return the number of peers in the group chat on success. + * return -1 on failure + */ +int tox_group_number_peers(const Tox *tox, int groupnumber); + +/* List all the peers in the group chat. + * + * Copies the names of the peers to the name[length][TOX_MAX_NAME_LENGTH] array. + * + * Copies the lengths of the names to lengths[length] + * + * returns the number of peers on success. + * + * return -1 on failure. + */ +int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t lengths[], + uint16_t length); + +/* Return the number of chats in the instance m. + * You should use this to determine how much memory to allocate + * for copy_chatlist. */ +uint32_t tox_count_chatlist(const Tox *tox); + +/* Copy a list of valid chat IDs into the array out_list. + * If out_list is NULL, returns 0. + * Otherwise, returns the number of elements copied. + * If the array was too small, the contents + * of out_list will be truncated to list_size. */ +uint32_t tox_get_chatlist(const Tox *tox, int *out_list, uint32_t list_size); + + +/****************FILE SENDING FUNCTIONS*****************/ +/* NOTE: This how to will be updated. + * + * HOW TO SEND FILES CORRECTLY: + * 1. Use tox_new_file_sender(...) to create a new file sender. + * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT + * 3. Send the data with tox_file_send_data(...) with chunk size tox_file_data_size(...) + * 4. When sending is done, send a tox_file_send_control(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED + * + * HOW TO RECEIVE FILES CORRECTLY: + * 1. wait for the callback set with tox_callback_file_send_request(...) + * 2. accept or refuse the connection with tox_file_send_control(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL + * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file. + * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED + * the file is done transferring. + * + * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive. + * + * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) + * the receiver must send a control packet with send_receive == 1 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being + * a uint64_t (in host byte order) containing the number of bytes received. + * + * If the sender receives this packet, he must send a control packet with send_receive == 0 and control_type == TOX_FILECONTROL_ACCEPT + * then he must start sending file data from the position (data , uint64_t in host byte order) received in the TOX_FILECONTROL_RESUME_BROKEN packet. + * + * To pause a file transfer send a control packet with control_type == TOX_FILECONTROL_PAUSE. + * To unpause a file transfer send a control packet with control_type == TOX_FILECONTROL_ACCEPT. + * + * If you receive a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_PAUSE, you must stop sending filenumber until the other + * person sends a control packet with send_receive == 0 and control_type == TOX_FILECONTROL_ACCEPT with the filenumber being a paused filenumber. + * + * If you receive a control packet with receive_send == 0 and control_type == TOX_FILECONTROL_PAUSE, it means the sender of filenumber has paused the + * transfer and will resume it later with a control packet with send_receive == 1 and control_type == TOX_FILECONTROL_ACCEPT for that file number. + * + * More to come... + */ + +enum { + TOX_FILECONTROL_ACCEPT, + TOX_FILECONTROL_PAUSE, + TOX_FILECONTROL_KILL, + TOX_FILECONTROL_FINISHED, + TOX_FILECONTROL_RESUME_BROKEN +}; +/* Set the callback for file send requests. + * + * Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) + */ +void tox_callback_file_send_request(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, uint64_t, const uint8_t *, + uint16_t, void *), void *userdata); + +/* Set the callback for file control requests. + * + * receive_send is 1 if the message is for a slot on which we are currently sending a file and 0 if the message + * is for a slot on which we are receiving the file + * + * Function(Tox *tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata) + * + */ +void tox_callback_file_control(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, uint8_t, uint8_t, const uint8_t *, + uint16_t, void *), void *userdata); + +/* Set the callback for file data. + * + * Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata) + * + */ +void tox_callback_file_data(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, const uint8_t *, uint16_t length, + void *), void *userdata); + + +/* Send a file send request. + * Maximum filename length is 255 bytes. + * return file number on success + * return -1 on failure + */ +int tox_new_file_sender(Tox *tox, int32_t friendnumber, uint64_t filesize, const uint8_t *filename, + uint16_t filename_length); + +/* Send a file control request. + * + * send_receive is 0 if we want the control packet to target a file we are currently sending, + * 1 if it targets a file we are currently receiving. + * + * return 0 on success + * return -1 on failure + */ +int tox_file_send_control(Tox *tox, int32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, + const uint8_t *data, uint16_t length); + +/* Send file data. + * + * return 0 on success + * return -1 on failure + */ +int tox_file_send_data(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length); + +/* Returns the recommended/maximum size of the filedata you send with tox_file_send_data() + * + * return size on success + * return -1 on failure (currently will never return -1) + */ +int tox_file_data_size(const Tox *tox, int32_t friendnumber); + +/* Give the number of bytes left to be sent/received. + * + * send_receive is 0 if we want the sending files, 1 if we want the receiving. + * + * return number of bytes remaining to be sent/received on success + * return 0 on failure + */ +uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t send_receive); + +/***************END OF FILE SENDING FUNCTIONS******************/ + +/* + * Use this function to bootstrap the client. + */ + +/* Resolves address into an IP address. If successful, sends a "get nodes" + * request to the given node with ip, port (in network byte order, HINT: use htons()) + * and public_key to setup connections + * + * address can be a hostname or an IP address (IPv4 or IPv6). + * if ipv6enabled is 0 (zero), the resolving sticks STRICTLY to IPv4 addresses + * if ipv6enabled is not 0 (zero), the resolving looks for IPv6 addresses first, + * then IPv4 addresses. + * + * returns 1 if the address could be converted into an IP address + * returns 0 otherwise + */ +int tox_bootstrap_from_address(Tox *tox, const char *address, uint8_t ipv6enabled, + uint16_t port, const uint8_t *public_key); + +/* return 0 if we are not connected to the DHT. + * return 1 if we are. + */ +int tox_isconnected(const Tox *tox); + +/* + * Run this function at startup. + * + * Initializes a tox structure + * The type of communication socket depends on ipv6enabled: + * If set to 0 (zero), creates an IPv4 socket which subsequently only allows + * IPv4 communication + * If set to anything else, creates an IPv6 socket which allows both IPv4 AND + * IPv6 communication + * + * return allocated instance of tox on success. + * return 0 if there are problems. + */ +Tox *tox_new(uint8_t ipv6enabled); + +/* Run this before closing shop. + * Free all datastructures. */ +void tox_kill(Tox *tox); + +/* Return the time in milliseconds before tox_do() should be called again + * for optimal performance. + * + * returns time (in ms) before the next tox_do() needs to be run on success. + */ +uint32_t tox_do_interval(Tox *tox); + +/* The main loop that needs to be run in intervals of tox_do_interval() ms. */ +void tox_do(Tox *tox); + +/* SAVING AND LOADING FUNCTIONS: */ + +/* return size of messenger data (for saving). */ +uint32_t tox_size(const Tox *tox); + +/* Save the messenger in data (must be allocated memory of size Messenger_size()). */ +void tox_save(const Tox *tox, uint8_t *data); + +/* Load the messenger from data of size length. + * + * returns 0 on success + * returns -1 on failure + */ +int tox_load(Tox *tox, const uint8_t *data, uint32_t length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/protocols/Tox/include/tox/toxav.h b/protocols/Tox/include/tox/toxav.h new file mode 100644 index 0000000000..0ded42bd56 --- /dev/null +++ b/protocols/Tox/include/tox/toxav.h @@ -0,0 +1,393 @@ +/** toxav.h + * + * Copyright (C) 2013 Tox project All Rights Reserved. + * + * This file is part of Tox. + * + * Tox 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. + * + * Tox 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 Tox. If not, see . + * + */ + + +#ifndef __TOXAV +#define __TOXAV +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* vpx_image_t */ +#include + +typedef void ( *ToxAVCallback ) ( int32_t, void *arg ); +typedef struct _ToxAv ToxAv; + +#ifndef __TOX_DEFINED__ +#define __TOX_DEFINED__ +typedef struct Tox Tox; +#endif + +#define RTP_PAYLOAD_SIZE 65535 + + +/** + * @brief Callbacks ids that handle the call states. + */ +typedef enum { + /* Requests */ + av_OnInvite, + av_OnStart, + av_OnCancel, + av_OnReject, + av_OnEnd, + + /* Responses */ + av_OnRinging, + av_OnStarting, + av_OnEnding, + + /* Protocol */ + av_OnError, + av_OnRequestTimeout, + av_OnPeerTimeout +} ToxAvCallbackID; + + +/** + * @brief Call type identifier. + */ +typedef enum { + TypeAudio = 192, + TypeVideo +} ToxAvCallType; + + +typedef enum { + av_CallNonExistant = -1, + av_CallInviting, /* when sending call invite */ + av_CallStarting, /* when getting call invite */ + av_CallActive, + av_CallHold, + av_CallHanged_up +} ToxAvCallState; + +/** + * @brief Error indicators. + */ +typedef enum { + ErrorNone = 0, + ErrorInternal = -1, /* Internal error */ + ErrorAlreadyInCall = -2, /* Already has an active call */ + ErrorNoCall = -3, /* Trying to perform call action while not in a call */ + ErrorInvalidState = -4, /* Trying to perform call action while in invalid state*/ + ErrorNoRtpSession = -5, /* Trying to perform rtp action on invalid session */ + ErrorAudioPacketLost = -6, /* Indicating packet loss */ + ErrorStartingAudioRtp = -7, /* Error in toxav_prepare_transmission() */ + ErrorStartingVideoRtp = -8 , /* Error in toxav_prepare_transmission() */ + ErrorTerminatingAudioRtp = -9, /* Returned in toxav_kill_transmission() */ + ErrorTerminatingVideoRtp = -10, /* Returned in toxav_kill_transmission() */ + ErrorPacketTooLarge = -11, /* Buffer exceeds size while encoding */ + ErrorInvalidCodecState = -12, /* Codec state not initialized */ + +} ToxAvError; + + +/** + * @brief Locally supported capabilities. + */ +typedef enum { + AudioEncoding = 1 << 0, + AudioDecoding = 1 << 1, + VideoEncoding = 1 << 2, + VideoDecoding = 1 << 3 +} ToxAvCapabilities; + + +/** + * @brief Encoding settings. + */ +typedef struct _ToxAvCodecSettings { + uint32_t video_bitrate; /* In kbits/s */ + uint16_t max_video_width; /* In px */ + uint16_t max_video_height; /* In px */ + + uint32_t audio_bitrate; /* In bits/s */ + uint16_t audio_frame_duration; /* In ms */ + uint32_t audio_sample_rate; /* In Hz */ + uint32_t audio_channels; + uint32_t audio_VAD_tolerance; /* In ms */ + + uint32_t jbuf_capacity; /* Size of jitter buffer */ +} ToxAvCodecSettings; + +extern const ToxAvCodecSettings av_DefaultSettings; + +/** + * @brief Start new A/V session. There can only be one session at the time. If you register more + * it will result in undefined behaviour. + * + * @param messenger The messenger handle. + * @param userdata The agent handling A/V session (i.e. phone). + * @param video_width Width of video frame. + * @param video_height Height of video frame. + * @return ToxAv* + * @retval NULL On error. + */ +ToxAv *toxav_new(Tox *messenger, int32_t max_calls); + +/** + * @brief Remove A/V session. + * + * @param av Handler. + * @return void + */ +void toxav_kill(ToxAv *av); + +/** + * @brief Register callback for call state. + * + * @param callback The callback + * @param id One of the ToxAvCallbackID values + * @return void + */ +void toxav_register_callstate_callback (ToxAVCallback callback, ToxAvCallbackID id, void *userdata); + +/** + * @brief Register callback for recieving audio data + * + * @param callback The callback + * @return void + */ +void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, int16_t *, int)); + +/** + * @brief Register callback for recieving video data + * + * @param callback The callback + * @return void + */ +void toxav_register_video_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, vpx_image_t *)); + +/** + * @brief Call user. Use its friend_id. + * + * @param av Handler. + * @param user The user. + * @param call_type Call type. + * @param ringing_seconds Ringing timeout. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_call(ToxAv *av, int32_t *call_index, int user, ToxAvCallType call_type, int ringing_seconds); + +/** + * @brief Hangup active call. + * + * @param av Handler. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_hangup(ToxAv *av, int32_t call_index); + +/** + * @brief Answer incomming call. + * + * @param av Handler. + * @param call_type Answer with... + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_answer(ToxAv *av, int32_t call_index, ToxAvCallType call_type ); + +/** + * @brief Reject incomming call. + * + * @param av Handler. + * @param reason Optional reason. Set NULL if none. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_reject(ToxAv *av, int32_t call_index, const char *reason); + +/** + * @brief Cancel outgoing request. + * + * @param av Handler. + * @param reason Optional reason. + * @param peer_id peer friend_id + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_cancel(ToxAv *av, int32_t call_index, int peer_id, const char *reason); + +/** + * @brief Terminate transmission. Note that transmission will be terminated without informing remote peer. + * + * @param av Handler. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_stop_call(ToxAv *av, int32_t call_index); + +/** + * @brief Must be call before any RTP transmission occurs. + * + * @param av Handler. + * @param support_video Is video supported ? 1 : 0 + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_prepare_transmission(ToxAv *av, int32_t call_index, ToxAvCodecSettings *codec_settings, int support_video); + +/** + * @brief Call this at the end of the transmission. + * + * @param av Handler. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_kill_transmission(ToxAv *av, int32_t call_index); + +/** + * @brief Encode and send video packet. + * + * @param av Handler. + * @param frame The encoded frame. + * @param frame_size The size of the encoded frame. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size); + +/** + * @brief Send audio frame. + * + * @param av Handler. + * @param frame The frame (raw 16 bit signed pcm with AUDIO_CHANNELS channels audio.) + * @param frame_size Its size in number of frames/samples (one frame/sample is 16 bits or 2 bytes) + * frame size should be AUDIO_FRAME_SIZE. + * @return int + * @retval 0 Success. + * @retval ToxAvError On error. + */ +int toxav_send_audio ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size); + +/** + * @brief Encode video frame + * + * @param av Handler + * @param dest Where to + * @param dest_max Max size + * @param input What to encode + * @return int + * @retval ToxAvError On error. + * @retval >0 On success + */ +int toxav_prepare_video_frame ( ToxAv *av, int32_t call_index, uint8_t *dest, int dest_max, vpx_image_t *input ); + +/** + * @brief Encode audio frame + * + * @param av Handler + * @param dest dest + * @param dest_max Max dest size + * @param frame The frame + * @param frame_size The frame size + * @return int + * @retval ToxAvError On error. + * @retval >0 On success + */ +int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t *dest, int dest_max, const int16_t *frame, + int frame_size); + +/** + * @brief Get peer transmission type. It can either be audio or video. + * + * @param av Handler. + * @param peer The peer + * @return int + * @retval ToxAvCallType On success. + * @retval ToxAvError On error. + */ +int toxav_get_peer_transmission_type ( ToxAv *av, int32_t call_index, int peer ); + +/** + * @brief Get id of peer participating in conversation + * + * @param av Handler + * @param peer peer index + * @return int + * @retval ToxAvError No peer id + */ +int toxav_get_peer_id ( ToxAv *av, int32_t call_index, int peer ); + +/** + * @brief Get current call state + * + * @param av Handler + * @param call_index What call + * @return int + * @retval ToxAvCallState State id + */ +ToxAvCallState toxav_get_call_state ( ToxAv *av, int32_t call_index ); +/** + * @brief Is certain capability supported + * + * @param av Handler + * @return int + * @retval 1 Yes. + * @retval 0 No. + */ +int toxav_capability_supported ( ToxAv *av, int32_t call_index, ToxAvCapabilities capability ); + +/** + * @brief Set queue limit + * + * @param av Handler + * @param call_index index + * @param limit the limit + * @return void + */ +int toxav_set_audio_queue_limit ( ToxAv *av, int32_t call_index, uint64_t limit ); + +/** + * @brief Set queue limit + * + * @param av Handler + * @param call_index index + * @param limit the limit + * @return void + */ +int toxav_set_video_queue_limit ( ToxAv *av, int32_t call_index, uint64_t limit ); + + +Tox *toxav_get_tox(ToxAv *av); + +int toxav_has_activity ( ToxAv *av, int32_t call_index, int16_t *PCM, uint16_t frame_size, float ref_energy ); + +#ifdef __cplusplus +} +#endif + +#endif /* __TOXAV */ diff --git a/protocols/Tox/include/tox/toxdns.h b/protocols/Tox/include/tox/toxdns.h new file mode 100644 index 0000000000..a0cc323b43 --- /dev/null +++ b/protocols/Tox/include/tox/toxdns.h @@ -0,0 +1,85 @@ +/* toxdns.h + * + * Tox secure username DNS toxid resolving functions. + * + * Copyright (C) 2014 Tox project All Rights Reserved. + * + * This file is part of Tox. + * + * Tox 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. + * + * Tox 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 Tox. If not, see . + * + */ + +#ifndef TOXDNS_H +#define TOXDNS_H + +#include + +/* How to use this api to make secure tox dns3 requests: + * + * 1. Get the public key of a server that supports tox dns3. + * 2. use tox_dns3_new() to create a new object to create DNS requests + * and handle responses for that server. + * 3. Use tox_generate_dns3_string() to generate a string based on the name we want to query and a request_id + * that must be stored somewhere for when we want to decrypt the response. + * 4. take the string and use it for your DNS request like this: + * _4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc._tox.utox.org + * 5. The TXT in the DNS you receive should look like this: + * v=tox3;id=2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp + * 6. Take the id string and use it with tox_decrypt_dns3_TXT() and the request_id corresponding to the + * request we stored earlier to get the Tox id returned by the DNS server. + */ + +/* Create a new tox_dns3 object for server with server_public_key of size TOX_CLIENT_ID_SIZE. + * + * return Null on failure. + * return pointer object on success. + */ +void *tox_dns3_new(uint8_t *server_public_key); + +/* Destroy the tox dns3 object. + */ +void tox_dns3_kill(void *dns3_object); + +/* Generate a dns3 string of string_max_len used to query the dns server referred to by to + * dns3_object for a tox id registered to user with name of name_len. + * + * the uint32_t pointed by request_id will be set to the request id which must be passed to + * tox_decrypt_dns3_TXT() to correctly decode the response. + * + * This is what the string returned looks like: + * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc + * + * returns length of string on sucess. + * returns -1 on failure. + */ +int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id, + uint8_t *name, uint8_t name_len); + +/* Decode and decrypt the id_record returned of length id_record_len into + * tox_id (needs to be at least TOX_FRIEND_ADDRESS_SIZE). + * + * request_id is the request id given by tox_generate_dns3_string() when creating the request. + * + * the id_record passed to this function should look somewhat like this: + * 2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp + * + * returns -1 on failure. + * returns 0 on success. + * + */ +int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, + uint32_t request_id); + +#endif diff --git a/protocols/Tox/lib/libtox.def b/protocols/Tox/lib/libtox.def new file mode 100644 index 0000000000..32b4bff8a7 --- /dev/null +++ b/protocols/Tox/lib/libtox.def @@ -0,0 +1,1728 @@ +EXPORTS +Version +All +following +stamp +functions +names +name +Assoc_add_entry +Assoc_get_close_entries +Assoc_self_client_id_changed +ClientPair_quick_sort +DHT_addfriend +DHT_bootstrap +DHT_bootstrap_from_address +DHT_delfriend +DHT_get_close_list +DHT_get_shared_key_recv +DHT_get_shared_key_sent +DHT_getfriendip +DHT_getnodes +DHT_isconnected +DHT_load +DHT_save +DHT_size +LAN_ip +LANdiscovery_init +U16_to_bytes +U32_to_bytes +VERSION_STRING +VP8_UVSSE +__pth_gpointer_locked +__pthread_clock_nanosleep +__pthread_shallcancel +__xl_f +_celt_autocorr +_celt_lpc +_pthread_cleanup_dest +_pthread_get_state +_pthread_invoke_cancel +_pthread_key_dest +_pthread_rel_time_in_ms +_pthread_set_state +_pthread_setnobreak +_pthread_time_in_ms +_pthread_time_in_ms_from_timespec +_pthread_tryjoin +_sodium_alignedcalloc +accept_crypto_connection +add_ext_header +add_groupchat +add_header +add_peer +add_tcp_relay +add_tcp_relay_peer +add_to_ping +addr_parse_ip +addr_resolve +addr_resolve_or_parse_ip +addto_lists +alg_quant +alg_unquant +amp2Log2 +anti_collapse +append_header_to_string +at_startup_ran +av_DefaultSettings +bs_list_add +bs_list_find +bs_list_free +bs_list_init +bs_list_remove +bs_list_trim +build_header +bytes_to_U16 +bytes_to_U32 +calculate_sum_sq +call_id_bigger +callback_file_control +callback_file_data +callback_file_sendrequest +callback_friendrequest +callback_groupaction +callback_groupmessage +callback_namelistchange +celt_decode_with_ec +celt_decoder_get_size +celt_decoder_init +celt_encode_with_ec +celt_encoder_get_size +celt_encoder_init +celt_fir +celt_iir +celt_lcg_rand +celt_pitch_xcorr_c +celt_preemphasis +chat_bootstrap +chat_bootstrap_nonlazy +check_control_input +check_fragments_for_errors +check_late_message +closelist_nodes +clt_mdct_backward +clt_mdct_forward +codec_init_session +codec_terminate_session +comb_filter +compute_allocation +compute_band_energies +compute_frame_size +compute_stereo_width +cond_print +cond_print_set +connection_data_handler +connection_lossy_data_handler +connection_status_handler +copy_chatlist +copy_connected_tcp_relays +copy_friendlist +count_chatlist +count_friendlist +create_announce_request +create_data_request +create_onion_packet +create_onion_path +create_queue +create_request +crypto_box +crypto_box_afternm +crypto_box_beforenm +crypto_box_beforenmbytes +crypto_box_boxzerobytes +crypto_box_curve25519xsalsa20poly1305 +crypto_box_curve25519xsalsa20poly1305_afternm +crypto_box_curve25519xsalsa20poly1305_beforenm +crypto_box_curve25519xsalsa20poly1305_keypair +crypto_box_curve25519xsalsa20poly1305_open +crypto_box_curve25519xsalsa20poly1305_open_afternm +crypto_box_curve25519xsalsa20poly1305_seed_keypair +crypto_box_keypair +crypto_box_macbytes +crypto_box_noncebytes +crypto_box_open +crypto_box_open_afternm +crypto_box_primitive +crypto_box_publickeybytes +crypto_box_secretkeybytes +crypto_box_seed_keypair +crypto_box_seedbytes +crypto_box_zerobytes +crypto_cmp +crypto_connection_status +crypto_core_hsalsa20 +crypto_core_salsa20 +crypto_hash_sha256 +crypto_hash_sha256_final +crypto_hash_sha256_init +crypto_hash_sha256_update +crypto_hash_sha512 +crypto_hash_sha512_final +crypto_hash_sha512_init +crypto_hash_sha512_update +crypto_kill +crypto_num_free_sendqueue_slots +crypto_onetimeauth_pick_best_implementation +crypto_onetimeauth_poly1305 +crypto_onetimeauth_poly1305_donna +crypto_onetimeauth_poly1305_donna_implementation +crypto_onetimeauth_poly1305_donna_implementation_name +crypto_onetimeauth_poly1305_donna_verify +crypto_onetimeauth_poly1305_implementation_name +crypto_onetimeauth_poly1305_set_implementation +crypto_onetimeauth_poly1305_verify +crypto_run_interval +crypto_scalarmult_curve25519 +crypto_scalarmult_curve25519_base +crypto_scalarmult_curve25519_ref10_fe_0 +crypto_scalarmult_curve25519_ref10_fe_1 +crypto_scalarmult_curve25519_ref10_fe_add +crypto_scalarmult_curve25519_ref10_fe_copy +crypto_scalarmult_curve25519_ref10_fe_cswap +crypto_scalarmult_curve25519_ref10_fe_frombytes +crypto_scalarmult_curve25519_ref10_fe_invert +crypto_scalarmult_curve25519_ref10_fe_mul +crypto_scalarmult_curve25519_ref10_fe_mul121666 +crypto_scalarmult_curve25519_ref10_fe_sq +crypto_scalarmult_curve25519_ref10_fe_sub +crypto_scalarmult_curve25519_ref10_fe_tobytes +crypto_secretbox_xsalsa20poly1305 +crypto_secretbox_xsalsa20poly1305_open +crypto_stream_salsa20 +crypto_stream_salsa20_xor +crypto_stream_xsalsa20 +crypto_stream_xsalsa20_xor +crypto_verify_16 +crypto_verify_32 +cryptopacket_registerhandler +current_time_monotonic +custom_lossless_packet_registerhandler +custom_lossy_packet_registerhandler +decode_pulses +decrypt_data +decrypt_data_symmetric +del_groupchat +denormalise_bands +dequeue +do_Assoc +do_DHT +do_TCP_connection +do_TCP_server +do_friends +do_groupchat +do_hardening +do_messenger +do_net_crypto +do_onion_client +do_sema_b_wait_intern +do_to_ping +downmix_float +downmix_int +eMeans +ec_dec_bit_logp +ec_dec_bits +ec_dec_icdf +ec_dec_init +ec_dec_uint +ec_dec_update +ec_decode +ec_decode_bin +ec_enc_bit_logp +ec_enc_bits +ec_enc_done +ec_enc_icdf +ec_enc_init +ec_enc_patch_initial_bits +ec_enc_shrink +ec_enc_uint +ec_encode +ec_encode_bin +ec_laplace_decode +ec_laplace_encode +ec_tell_frac +empty_queue +encode_pulses +encode_size +encrypt_data +encrypt_data_symmetric +encrypt_precompute +energy_VAD +extract_ext_header +extract_header +file_control +file_data +file_dataremaining +file_sendrequest +find_call +flush_peer_type +frame_size_select +free_message +friend_ips +friendreq_init +get_close_nodes +get_connection_dht_key +get_friendlist +get_nospam +get_num_online_friends +get_shared_key +getaddress +getclient_id +getfriend_id +getname +getself_name +group_action_send +group_client_names +group_message_send +group_names +group_newpeer +group_number_peers +group_numpeers +group_peername +group_sendaction +group_sendmessage +haar1 +handle_groupchatpacket +handle_recv_cancel +handle_recv_end +handle_recv_ending +handle_recv_error +handle_recv_invite +handle_recv_reject +handle_recv_ringing +handle_recv_start +handle_recv_starting +handle_remote_connection_change +handle_request +handle_timeout +host_to_net +hysteresis_decision +id_closest +id_copy +id_equal +increment_nonce +increment_nonce_number +init_audio_decoder +init_audio_encoder +init_call +init_caps +init_video_decoder +init_video_encoder +invite_friend +invoke_callback +ip_copy +ip_equal +ip_init +ip_isset +ip_ntoa +ip_pack +ip_reset +ip_unpack +ipport_copy +ipport_equal +ipport_isset +ipport_pack +ipport_unpack +is_timeout +isqrt32 +join_groupchat +kill_Assoc +kill_DHT +kill_TCP_connection +kill_TCP_server +kill_groupchat +kill_messenger +kill_net_crypto +kill_networking +kill_onion +kill_onion_announce +kill_onion_client +kill_ping +kill_sock +load_keys +load_state +m_addfriend +m_addfriend_norequest +m_callback_action +m_callback_connectionstatus +m_callback_connectionstatus_internal_av +m_callback_friendmessage +m_callback_friendrequest +m_callback_group_action +m_callback_group_invite +m_callback_group_message +m_callback_group_namelistchange +m_callback_msi_packet +m_callback_namechange +m_callback_read_receipt +m_callback_statusmessage +m_callback_typingchange +m_callback_userstatus +m_copy_self_statusmessage +m_copy_statusmessage +m_delfriend +m_friend_exists +m_get_friend_connectionstatus +m_get_istyping +m_get_last_online +m_get_name_size +m_get_self_name_size +m_get_self_statusmessage_size +m_get_self_userstatus +m_get_statusmessage_size +m_get_userstatus +m_group_peername +m_msi_packet +m_sendaction +m_sendaction_withid +m_sendmessage +m_sendmessage_withid +m_set_sends_receipts +m_set_statusmessage +m_set_userstatus +m_set_usertyping +message_to_send +messenger_load +messenger_run_interval +messenger_save +messenger_size +min_jbuf_size +min_readiness_idx +mlp_process +msg_parse +msi_answer +msi_cancel +msi_handle_packet +msi_hangup +msi_init_session +msi_invite +msi_msg_set_callid +msi_msg_set_calltype +msi_msg_set_info +msi_msg_set_reason +msi_new_message +msi_register_callback +msi_reject +msi_stopcall +msi_terminate_session +mutex_print +mutex_print_set +net +networking_at_startup +networking_poll +networking_registerhandler +new_Assoc +new_Assoc_default +new_DHT +new_TCP_connection +new_TCP_server +new_connection_handler +new_crypto_connection +new_filesender +new_groupchat +new_keys +new_messenger +new_net_crypto +new_networking +new_nonce +new_onion +new_onion_announce +new_onion_client +new_ping +new_symmetric_key +normalise_bands +onion_addfriend +onion_delfriend +onion_friend_num +onion_getfriend_DHT_pubkey +onion_getfriendip +onion_response_handler +onion_send_1 +onion_set_friend_DHT_pubkey +onion_set_friend_online +oniondata_registerhandler +oob_data_handler +optimize_framesize +opus_custom_decoder_ctl +opus_custom_encoder_ctl +opus_custom_mode_create +opus_decode +opus_decode_float +opus_decode_native +opus_decoder_create +opus_decoder_ctl +opus_decoder_destroy +opus_decoder_get_nb_samples +opus_decoder_get_size +opus_decoder_init +opus_encode +opus_encode_float +opus_encode_native +opus_encoder_create +opus_encoder_ctl +opus_encoder_destroy +opus_encoder_get_size +opus_encoder_init +opus_fft +opus_get_version_string +opus_ifft +opus_multistream_packet_pad +opus_multistream_packet_unpad +opus_packet_get_bandwidth +opus_packet_get_nb_channels +opus_packet_get_nb_frames +opus_packet_get_nb_samples +opus_packet_get_samples_per_frame +opus_packet_pad +opus_packet_parse +opus_packet_parse_impl +opus_packet_unpad +opus_pcm_soft_clip +opus_repacketizer_cat +opus_repacketizer_create +opus_repacketizer_destroy +opus_repacketizer_get_nb_frames +opus_repacketizer_get_size +opus_repacketizer_init +opus_repacketizer_out +opus_repacketizer_out_range +opus_repacketizer_out_range_impl +opus_strerror +pack_nodes +parse_message +parse_raw_data +patch_transient_decision +ping_array_add +ping_array_check +ping_array_free_all +ping_array_init +pitch_downsample +pitch_search +pthread_attr_destroy +pthread_attr_getdetachstate +pthread_attr_getinheritsched +pthread_attr_getscope +pthread_attr_getstackaddr +pthread_attr_getstacksize +pthread_attr_init +pthread_attr_setdetachstate +pthread_attr_setinheritsched +pthread_attr_setscope +pthread_attr_setstackaddr +pthread_attr_setstacksize +pthread_cancel +pthread_cond_broadcast +pthread_cond_destroy +pthread_cond_init +pthread_cond_signal +pthread_cond_timedwait +pthread_cond_timedwait_relative +pthread_cond_wait +pthread_condattr_destroy +pthread_condattr_getclock +pthread_condattr_getpshared +pthread_condattr_init +pthread_condattr_setclock +pthread_condattr_setpshared +pthread_create +pthread_create_wrapper +pthread_delay_np +pthread_delay_np_ms +pthread_detach +pthread_equal +pthread_exit +pthread_get_concurrency +pthread_getclean +pthread_getconcurrency +pthread_getevent +pthread_gethandle +pthread_getspecific +pthread_join +pthread_key_create +pthread_key_delete +pthread_kill +pthread_mutex_destroy +pthread_mutex_init +pthread_mutex_lock +pthread_mutex_timedlock +pthread_mutex_trylock +pthread_mutex_unlock +pthread_mutexattr_destroy +pthread_mutexattr_getprioceiling +pthread_mutexattr_getprotocol +pthread_mutexattr_getpshared +pthread_mutexattr_gettype +pthread_mutexattr_init +pthread_mutexattr_setprioceiling +pthread_mutexattr_setprotocol +pthread_mutexattr_setpshared +pthread_mutexattr_settype +pthread_num_processors_np +pthread_once +pthread_rwlock_destroy +pthread_rwlock_init +pthread_rwlock_rdlock +pthread_rwlock_timedrdlock +pthread_rwlock_timedwrlock +pthread_rwlock_tryrdlock +pthread_rwlock_trywrlock +pthread_rwlock_unlock +pthread_rwlock_wrlock +pthread_rwlockattr_destroy +pthread_rwlockattr_getpshared +pthread_rwlockattr_init +pthread_rwlockattr_setpshared +pthread_self +pthread_set_concurrency +pthread_set_num_processors_np +pthread_setcancelstate +pthread_setcanceltype +pthread_setconcurrency +pthread_setspecific +pthread_spin_destroy +pthread_spin_init +pthread_spin_lock +pthread_spin_trylock +pthread_spin_unlock +pthread_testcancel +pthread_timechange_handler_np +pthread_tls_init +public_key_valid +quant_all_bands +quant_coarse_energy +quant_energy_finalise +quant_fine_energy +queue +random_64b +random_int +random_node +random_nodes_path +random_nonce +randombytes +randombytes_buf +randombytes_close +randombytes_implementation_name +randombytes_random +randombytes_set_implementation +randombytes_stir +randombytes_sysrandom +randombytes_sysrandom_buf +randombytes_sysrandom_close +randombytes_sysrandom_implementation +randombytes_sysrandom_implementation_name +randombytes_sysrandom_stir +randombytes_sysrandom_uniform +randombytes_uniform +read_TCP_length +read_TCP_packet +read_packet_TCP_secure_connection +realloc_friendlist +reconfigure_video_encoder_bitrate +reconfigure_video_encoder_resolution +recv_tcp_relay_handler +remove_doubling +remove_request_received +renormalise_vector +resampling_factor +route_packet +route_tofriend +routing_data_handler +routing_response_handler +routing_status_handler +rtp_free_msg +rtp_handle_packet +rtp_init_session +rtp_new_message +rtp_send_msg +rtp_terminate_session +run_analysis +rwl_print +rwl_print_set +save_keys +send_LANdiscovery +send_announce_request +send_custom_lossless_packet +send_custom_lossy_packet +send_data +send_data_request +send_disconnect_request +send_error +send_friendrequest +send_lossy_cryptpacket +send_message +send_onion_data +send_onion_packet +send_onion_request +send_onion_response +send_oob_packet +send_ping_request +send_routing_request +sendpacket +set_callback_handle_recv_1 +set_connection_dht_public_key +set_direct_ip_port +set_filter_function +set_nick +set_nospam +set_socket_dualstack +set_socket_nonblock +set_socket_nosigpipe +set_tcp_connection_number +setfriendname +setname +silk_A2NLSF +silk_A2NLSF_FLP +silk_CB_lags_stage2 +silk_CB_lags_stage2_10_ms +silk_CB_lags_stage3 +silk_CB_lags_stage3_10_ms +silk_CNG +silk_CNG_Reset +silk_Decode +silk_Encode +silk_Get_Decoder_Size +silk_Get_Encoder_Size +silk_HP_variable_cutoff +silk_InitDecoder +silk_InitEncoder +silk_LBRR_flags_iCDF_ptr +silk_LPC_analysis_filter +silk_LPC_analysis_filter_FLP +silk_LPC_inverse_pred_gain +silk_LPC_inverse_pred_gain_FLP +silk_LP_variable_cutoff +silk_LSFCosTab_FIX_Q12 +silk_LTPScales_table_Q14 +silk_LTP_analysis_filter_FLP +silk_LTP_gain_BITS_Q5_ptrs +silk_LTP_gain_iCDF_ptrs +silk_LTP_gain_middle_avg_RD_Q14 +silk_LTP_per_index_iCDF +silk_LTP_scale_ctrl_FLP +silk_LTP_vq_gain_ptrs_Q7 +silk_LTP_vq_ptrs_Q7 +silk_LTP_vq_sizes +silk_LTPscale_iCDF +silk_Lag_range_stage3 +silk_Lag_range_stage3_10_ms +silk_NLSF2A +silk_NLSF2A_FLP +silk_NLSF_CB_NB_MB +silk_NLSF_CB_WB +silk_NLSF_EXT_iCDF +silk_NLSF_VQ +silk_NLSF_VQ_weights_laroia +silk_NLSF_decode +silk_NLSF_del_dec_quant +silk_NLSF_encode +silk_NLSF_interpolation_factor_iCDF +silk_NLSF_stabilize +silk_NLSF_unpack +silk_NSQ +silk_NSQ_del_dec +silk_NSQ_wrapper_FLP +silk_PLC +silk_PLC_Reset +silk_PLC_glue_frames +silk_Quantization_Offsets_Q10 +silk_Resampler_1_2_COEFS +silk_Resampler_1_3_COEFS +silk_Resampler_1_4_COEFS +silk_Resampler_1_6_COEFS +silk_Resampler_2_3_COEFS +silk_Resampler_2_3_COEFS_LQ +silk_Resampler_3_4_COEFS +silk_SNR_table_Q1 +silk_TargetRate_table_MB +silk_TargetRate_table_NB +silk_TargetRate_table_WB +silk_Transition_LP_A_Q28 +silk_Transition_LP_B_Q28 +silk_VAD_GetSA_Q8 +silk_VAD_Init +silk_VQ_WMat_EC +silk_ana_filt_bank_1 +silk_apply_sine_window_FLP +silk_autocorrelation_FLP +silk_biquad_alt +silk_burg_modified_FLP +silk_bwexpander +silk_bwexpander_32 +silk_bwexpander_FLP +silk_control_SNR +silk_control_audio_bandwidth +silk_control_encoder +silk_corrMatrix_FLP +silk_corrVector_FLP +silk_decode_core +silk_decode_frame +silk_decode_indices +silk_decode_parameters +silk_decode_pitch +silk_decode_pulses +silk_decode_signs +silk_decoder_set_fs +silk_delta_gain_iCDF +silk_encode_do_VAD_FLP +silk_encode_frame_FLP +silk_encode_indices +silk_encode_pulses +silk_encode_signs +silk_energy_FLP +silk_find_LPC_FLP +silk_find_LTP_FLP +silk_find_pitch_lags_FLP +silk_find_pred_coefs_FLP +silk_gain_iCDF +silk_gains_ID +silk_gains_dequant +silk_gains_quant +silk_init_decoder +silk_init_encoder +silk_inner_prod_aligned_scale +silk_inner_product_FLP +silk_insertion_sort_decreasing_FLP +silk_insertion_sort_increasing +silk_insertion_sort_increasing_all_values_int16 +silk_interpolate +silk_k2a_FLP +silk_levinsondurbin_FLP +silk_lin2log +silk_log2lin +silk_lsb_iCDF +silk_max_pulses_table +silk_nb_cbk_searchs_stage3 +silk_noise_shape_analysis_FLP +silk_pitch_analysis_core_FLP +silk_pitch_contour_10_ms_NB_iCDF +silk_pitch_contour_10_ms_iCDF +silk_pitch_contour_NB_iCDF +silk_pitch_contour_iCDF +silk_pitch_delta_iCDF +silk_pitch_lag_iCDF +silk_prefilter_FLP +silk_process_NLSFs +silk_process_NLSFs_FLP +silk_process_gains_FLP +silk_pulses_per_block_BITS_Q5 +silk_pulses_per_block_iCDF +silk_quant_LTP_gains +silk_quant_LTP_gains_FLP +silk_rate_levels_BITS_Q5 +silk_rate_levels_iCDF +silk_regularize_correlations_FLP +silk_resampler +silk_resampler_down2 +silk_resampler_down2_3 +silk_resampler_frac_FIR_12 +silk_resampler_init +silk_resampler_private_AR2 +silk_resampler_private_IIR_FIR +silk_resampler_private_down_FIR +silk_resampler_private_up2_HQ +silk_resampler_private_up2_HQ_wrapper +silk_residual_energy_FLP +silk_residual_energy_covar_FLP +silk_scale_copy_vector_FLP +silk_scale_vector_FLP +silk_schur_FLP +silk_shell_code_table0 +silk_shell_code_table1 +silk_shell_code_table2 +silk_shell_code_table3 +silk_shell_code_table_offsets +silk_shell_decoder +silk_shell_encoder +silk_sigm_Q15 +silk_sign_iCDF +silk_solve_LDL_FLP +silk_stereo_LR_to_MS +silk_stereo_MS_to_LR +silk_stereo_decode_mid_only +silk_stereo_decode_pred +silk_stereo_encode_mid_only +silk_stereo_encode_pred +silk_stereo_find_predictor +silk_stereo_only_code_mid_iCDF +silk_stereo_pred_joint_iCDF +silk_stereo_pred_quant_Q13 +silk_stereo_quant_pred +silk_sum_sqr_shift +silk_type_offset_VAD_iCDF +silk_type_offset_no_VAD_iCDF +silk_uniform3_iCDF +silk_uniform4_iCDF +silk_uniform5_iCDF +silk_uniform6_iCDF +silk_uniform8_iCDF +silk_warped_autocorrelation_FLP +sock_valid +sodium_bin2hex +sodium_hex2bin +sodium_init +sodium_memcmp +sodium_memzero +sodium_mlock +sodium_munlock +sodium_runtime_get_cpu_features +sodium_runtime_has_neon +sodium_runtime_has_sse2 +sodium_runtime_has_sse3 +spreading_decision +stereo_itheta +t_randomstr +terminate_call +terminate_queue +tf_select_table +thread_print +thread_print_set +timer_alloc +timer_init_session +timer_poll +timer_release +timer_terminate_session +to_host_family +to_net_family +tonality_analysis +tonality_get_info +tox_add_friend +tox_add_friend_norequest +tox_add_groupchat +tox_bootstrap_from_address +tox_callback_connection_status +tox_callback_file_control +tox_callback_file_data +tox_callback_file_send_request +tox_callback_friend_action +tox_callback_friend_message +tox_callback_friend_request +tox_callback_group_action +tox_callback_group_invite +tox_callback_group_message +tox_callback_group_namelist_change +tox_callback_name_change +tox_callback_read_receipt +tox_callback_status_message +tox_callback_typing_change +tox_callback_user_status +tox_count_chatlist +tox_count_friendlist +tox_decrypt_dns3_TXT +tox_del_friend +tox_del_groupchat +tox_dns3_kill +tox_dns3_new +tox_do +tox_do_interval +tox_file_data_remaining +tox_file_data_size +tox_file_send_control +tox_file_send_data +tox_friend_exists +tox_generate_dns3_string +tox_get_address +tox_get_chatlist +tox_get_client_id +tox_get_friend_connection_status +tox_get_friend_number +tox_get_friendlist +tox_get_is_typing +tox_get_last_online +tox_get_name +tox_get_name_size +tox_get_nospam +tox_get_num_online_friends +tox_get_self_name +tox_get_self_name_size +tox_get_self_status_message +tox_get_self_status_message_size +tox_get_self_user_status +tox_get_status_message +tox_get_status_message_size +tox_get_user_status +tox_group_action_send +tox_group_get_names +tox_group_message_send +tox_group_number_peers +tox_group_peername +tox_invite_friend +tox_isconnected +tox_join_groupchat +tox_kill +tox_load +tox_new +tox_new_file_sender +tox_save +tox_send_action +tox_send_action_withid +tox_send_message +tox_send_message_withid +tox_set_name +tox_set_nospam +tox_set_sends_receipts +tox_set_status_message +tox_set_user_is_typing +tox_set_user_status +tox_size +toxav_answer +toxav_call +toxav_cancel +toxav_capability_supported +toxav_get_call_state +toxav_get_peer_id +toxav_get_peer_transmission_type +toxav_get_tox +toxav_handle_packet +toxav_hangup +toxav_has_activity +toxav_kill +toxav_kill_transmission +toxav_new +toxav_prepare_audio_frame +toxav_prepare_transmission +toxav_prepare_video_frame +toxav_register_audio_recv_callback +toxav_register_callstate_callback +toxav_register_video_recv_callback +toxav_reject +toxav_send_audio +toxav_send_rtp_payload +toxav_send_video +toxav_stop_call +unix_time +unix_time_update +unpack_nodes +unquant_coarse_energy +unquant_energy_finalise +unquant_fine_energy +vp8_ac2quant +vp8_ac_uv_quant +vp8_ac_yquant +vp8_activity_masking +vp8_adjust_key_frame_context +vp8_alloc_compressor_data +vp8_alloc_frame_buffers +vp8_auto_select_speed +vp8_bilinear_filters +vp8_bilinear_filters_x86_4 +vp8_bilinear_filters_x86_8 +vp8_bilinear_predict16x16 +vp8_bilinear_predict16x16_c +vp8_bilinear_predict16x16_mmx +vp8_bilinear_predict16x16_sse2 +vp8_bilinear_predict16x16_ssse3 +vp8_bilinear_predict4x4 +vp8_bilinear_predict4x4_c +vp8_bilinear_predict4x4_mmx +vp8_bilinear_predict8x4 +vp8_bilinear_predict8x4_c +vp8_bilinear_predict8x4_mmx +vp8_bilinear_predict8x8 +vp8_bilinear_predict8x8_c +vp8_bilinear_predict8x8_mmx +vp8_bilinear_predict8x8_sse2 +vp8_bilinear_predict8x8_ssse3 +vp8_bits_per_mb +vp8_blend_b_c +vp8_blend_mb_inner_c +vp8_blend_mb_outer_c +vp8_block2above +vp8_block2left +vp8_block_error +vp8_block_error_c +vp8_block_error_mmx +vp8_block_error_xmm +vp8_bmode_encodings +vp8_bmode_prob +vp8_bmode_tree +vp8_build_block_doffsets +vp8_build_block_offsets +vp8_build_component_cost_table +vp8_build_inter16x16_predictors_mb +vp8_build_inter16x16_predictors_mbuv +vp8_build_inter16x16_predictors_mby +vp8_build_inter4x4_predictors_mbuv +vp8_build_inter_predictors_b +vp8_build_inter_predictors_mb +vp8_build_intra_predictors_mbuv_s +vp8_build_intra_predictors_mbuv_s_c +vp8_build_intra_predictors_mbuv_s_sse2 +vp8_build_intra_predictors_mbuv_s_ssse3 +vp8_build_intra_predictors_mby_s +vp8_build_intra_predictors_mby_s_c +vp8_build_intra_predictors_mby_s_sse2 +vp8_build_intra_predictors_mby_s_ssse3 +vp8_cal_sad +vp8_calc_ref_frame_costs +vp8_calc_ss_err +vp8_change_config +vp8_clear_system_state +vp8_clear_system_state_c +vp8_coef_bands +vp8_coef_encodings +vp8_coef_tree +vp8_coef_update_probs +vp8_compute_frame_size_bounds +vp8_convert_rfct_to_prob +vp8_copy32xn +vp8_copy32xn_c +vp8_copy32xn_sse2 +vp8_copy32xn_sse3 +vp8_copy_and_extend_frame +vp8_copy_and_extend_frame_with_rect +vp8_copy_mem16x16 +vp8_copy_mem16x16_c +vp8_copy_mem16x16_mmx +vp8_copy_mem16x16_sse2 +vp8_copy_mem8x4 +vp8_copy_mem8x4_c +vp8_copy_mem8x4_mmx +vp8_copy_mem8x8 +vp8_copy_mem8x8_c +vp8_copy_mem8x8_mmx +vp8_cost_mv_ref +vp8_cost_tokens +vp8_cost_tokens2 +vp8_create_common +vp8_create_compressor +vp8_create_decoder_instances +vp8_ctf_maps +vp8_dc2quant +vp8_dc_only_idct_add +vp8_dc_only_idct_add_c +vp8_dc_only_idct_add_mmx +vp8_dc_quant +vp8_dc_uv_quant +vp8_dct_value_cost_ptr +vp8_dct_value_tokens_ptr +vp8_de_alloc_frame_buffers +vp8_deblock +vp8_decode_frame +vp8_decode_mb_tokens +vp8_decode_mode_mvs +vp8_decoder_create_threads +vp8_decoder_remove_threads +vp8_default_bmode_probs +vp8_default_coef_probs +vp8_default_inv_zig_zag +vp8_default_mv_context +vp8_default_zig_zag1d +vp8_default_zig_zag_mask +vp8_denoiser_allocate +vp8_denoiser_denoise_mb +vp8_denoiser_filter +vp8_denoiser_filter_c +vp8_denoiser_filter_sse2 +vp8_denoiser_free +vp8_dequant_idct_add +vp8_dequant_idct_add_c +vp8_dequant_idct_add_mmx +vp8_dequant_idct_add_uv_block +vp8_dequant_idct_add_uv_block_c +vp8_dequant_idct_add_uv_block_mmx +vp8_dequant_idct_add_uv_block_sse2 +vp8_dequant_idct_add_y_block +vp8_dequant_idct_add_y_block_c +vp8_dequant_idct_add_y_block_mmx +vp8_dequant_idct_add_y_block_sse2 +vp8_dequantize_b +vp8_dequantize_b_c +vp8_dequantize_b_impl_mmx +vp8_dequantize_b_mmx +vp8_diamond_search_sad +vp8_diamond_search_sad_c +vp8_diamond_search_sadx4 +vp8_encode_frame +vp8_encode_inter16x16 +vp8_encode_inter16x16y +vp8_encode_intra +vp8_encode_intra16x16mbuv +vp8_encode_intra16x16mby +vp8_encode_intra4x4block +vp8_encode_intra4x4mby +vp8_encode_motion_vector +vp8_encode_value +vp8_end_first_pass +vp8_end_second_pass +vp8_estimate_entropy_savings +vp8_extend_mb_row +vp8_extra_bits +vp8_fast_quantize_b +vp8_fast_quantize_b_c +vp8_fast_quantize_b_impl_mmx +vp8_fast_quantize_b_mmx +vp8_fast_quantize_b_pair_c +vp8_fast_quantize_b_sse2 +vp8_fast_quantize_b_ssse3 +vp8_filter_block1d16_h6_only_sse2 +vp8_filter_block1d16_h6_sse2 +vp8_filter_block1d16_h6_ssse3 +vp8_filter_block1d16_v6_sse2 +vp8_filter_block1d16_v6_ssse3 +vp8_filter_block1d4_h6_ssse3 +vp8_filter_block1d4_v6_ssse3 +vp8_filter_block1d8_h6_only_sse2 +vp8_filter_block1d8_h6_sse2 +vp8_filter_block1d8_h6_ssse3 +vp8_filter_block1d8_v6_only_sse2 +vp8_filter_block1d8_v6_sse2 +vp8_filter_block1d8_v6_ssse3 +vp8_filter_block1d_h6_mmx +vp8_filter_block1dc_v6_mmx +vp8_filter_block2d_bil4x4_var_mmx +vp8_filter_block2d_bil_var_mmx +vp8_filter_block2d_bil_var_sse2 +vp8_filter_block2d_bil_var_ssse3 +vp8_filter_by_weight16x16 +vp8_filter_by_weight16x16_c +vp8_filter_by_weight16x16_sse2 +vp8_filter_by_weight4x4_c +vp8_filter_by_weight8x8 +vp8_filter_by_weight8x8_c +vp8_filter_by_weight8x8_sse2 +vp8_find_best_half_pixel_step +vp8_find_best_sub_pixel_step +vp8_find_best_sub_pixel_step_iteratively +vp8_find_near_mvs +vp8_find_near_mvs_bias +vp8_first_pass +vp8_fix_contexts +vp8_full_search_sad +vp8_full_search_sad_c +vp8_full_search_sadx3 +vp8_full_search_sadx8 +vp8_gaussian +vp8_get16x16var_sse2 +vp8_get4x4sse_cs +vp8_get4x4sse_cs_c +vp8_get4x4sse_cs_mmx +vp8_get4x4var_mmx +vp8_get8x8var_mmx +vp8_get8x8var_sse2 +vp8_get_compressed_data +vp8_get_inter_mbpred_error +vp8_get_mb_ss +vp8_get_mb_ss_c +vp8_get_mb_ss_mmx +vp8_get_mb_ss_sse2 +vp8_get_preview_raw_frame +vp8_get_quantizer +vp8_get_reference +vp8_gf_boost_qadjustment +vp8_half_horiz_variance16x_h_sse2 +vp8_half_horiz_variance8x_h_sse2 +vp8_half_horiz_vert_variance16x_h_sse2 +vp8_half_horiz_vert_variance8x_h_sse2 +vp8_half_vert_variance16x_h_sse2 +vp8_half_vert_variance8x_h_sse2 +vp8_hex_search +vp8_horizontal_line_2_1_scale_c +vp8_horizontal_line_5_3_scale_c +vp8_horizontal_line_5_4_scale_c +vp8_idct_dequant_0_2x_sse2 +vp8_idct_dequant_dc_0_2x_sse2 +vp8_idct_dequant_dc_full_2x_sse2 +vp8_idct_dequant_full_2x_sse2 +vp8_init3smotion_compensation +vp8_init_dsmotion_compensation +vp8_init_first_pass +vp8_init_mbmode_probs +vp8_init_mode_costs +vp8_init_second_pass +vp8_initialize_rd_consts +vp8_intra4x4_predict_c +vp8_intra_pred_uv_dc128_mmx +vp8_intra_pred_uv_dc_mmx2 +vp8_intra_pred_uv_dcleft_mmx2 +vp8_intra_pred_uv_dctop_mmx2 +vp8_intra_pred_uv_ho_mmx2 +vp8_intra_pred_uv_ho_ssse3 +vp8_intra_pred_uv_tm_sse2 +vp8_intra_pred_uv_tm_ssse3 +vp8_intra_pred_uv_ve_mmx +vp8_intra_pred_y_dc128_sse2 +vp8_intra_pred_y_dc_sse2 +vp8_intra_pred_y_dcleft_sse2 +vp8_intra_pred_y_dctop_sse2 +vp8_intra_pred_y_ho_sse2 +vp8_intra_pred_y_tm_sse2 +vp8_intra_pred_y_tm_ssse3 +vp8_intra_pred_y_ve_sse2 +vp8_kf_bmode_prob +vp8_kf_uv_mode_prob +vp8_kf_ymode_encodings +vp8_kf_ymode_prob +vp8_kf_ymode_tree +vp8_lookahead_depth +vp8_lookahead_destroy +vp8_lookahead_init +vp8_lookahead_peek +vp8_lookahead_pop +vp8_lookahead_push +vp8_loop_filter_bh +vp8_loop_filter_bh_c +vp8_loop_filter_bh_mmx +vp8_loop_filter_bh_sse2 +vp8_loop_filter_bhs_c +vp8_loop_filter_bhs_mmx +vp8_loop_filter_bhs_sse2 +vp8_loop_filter_bv +vp8_loop_filter_bv_c +vp8_loop_filter_bv_mmx +vp8_loop_filter_bv_sse2 +vp8_loop_filter_bvs_c +vp8_loop_filter_bvs_mmx +vp8_loop_filter_bvs_sse2 +vp8_loop_filter_frame +vp8_loop_filter_frame_init +vp8_loop_filter_frame_yonly +vp8_loop_filter_horizontal_edge_c +vp8_loop_filter_horizontal_edge_mmx +vp8_loop_filter_horizontal_edge_sse2 +vp8_loop_filter_horizontal_edge_uv_sse2 +vp8_loop_filter_init +vp8_loop_filter_mbh +vp8_loop_filter_mbh_c +vp8_loop_filter_mbh_mmx +vp8_loop_filter_mbh_sse2 +vp8_loop_filter_mbv +vp8_loop_filter_mbv_c +vp8_loop_filter_mbv_mmx +vp8_loop_filter_mbv_sse2 +vp8_loop_filter_partial_frame +vp8_loop_filter_row_normal +vp8_loop_filter_row_simple +vp8_loop_filter_simple_bh +vp8_loop_filter_simple_bv +vp8_loop_filter_simple_horizontal_edge_c +vp8_loop_filter_simple_horizontal_edge_mmx +vp8_loop_filter_simple_horizontal_edge_sse2 +vp8_loop_filter_simple_mbh +vp8_loop_filter_simple_mbv +vp8_loop_filter_simple_vertical_edge_c +vp8_loop_filter_simple_vertical_edge_mmx +vp8_loop_filter_simple_vertical_edge_sse2 +vp8_loop_filter_update_sharpness +vp8_loop_filter_vertical_edge_c +vp8_loop_filter_vertical_edge_mmx +vp8_loop_filter_vertical_edge_sse2 +vp8_loop_filter_vertical_edge_uv_sse2 +vp8_loopfilter_frame +vp8_machine_specific_config +vp8_mb_feature_data_bits +vp8_mb_init_dequantizer +vp8_mbblock_error +vp8_mbblock_error_c +vp8_mbblock_error_mmx +vp8_mbblock_error_mmx_impl +vp8_mbblock_error_xmm +vp8_mbblock_error_xmm_impl +vp8_mbloop_filter_horizontal_edge_c +vp8_mbloop_filter_horizontal_edge_mmx +vp8_mbloop_filter_horizontal_edge_sse2 +vp8_mbloop_filter_horizontal_edge_uv_sse2 +vp8_mbloop_filter_vertical_edge_c +vp8_mbloop_filter_vertical_edge_mmx +vp8_mbloop_filter_vertical_edge_sse2 +vp8_mbloop_filter_vertical_edge_uv_sse2 +vp8_mbpost_proc_across_ip +vp8_mbpost_proc_across_ip_c +vp8_mbpost_proc_across_ip_xmm +vp8_mbpost_proc_down +vp8_mbpost_proc_down_c +vp8_mbpost_proc_down_mmx +vp8_mbpost_proc_down_xmm +vp8_mbsplit_count +vp8_mbsplit_encodings +vp8_mbsplit_offset +vp8_mbsplit_probs +vp8_mbsplit_tree +vp8_mbsplits +vp8_mbuverror +vp8_mbuverror_c +vp8_mbuverror_mmx +vp8_mbuverror_mmx_impl +vp8_mbuverror_xmm +vp8_mbuverror_xmm_impl +vp8_mode_contexts +vp8_mode_order +vp8_mse16x16 +vp8_mse16x16_c +vp8_mse16x16_mmx +vp8_mse16x16_wmt +vp8_mse2psnr +vp8_multiframe_quality_enhance +vp8_mv_bit_cost +vp8_mv_cont +vp8_mv_pred +vp8_mv_ref_encoding_array +vp8_mv_ref_probs +vp8_mv_ref_tree +vp8_mv_update_probs +vp8_new_framerate +vp8_norm +vp8_optimize_mbuv +vp8_optimize_mby +vp8_pack_bitstream +vp8_pack_tokens_c +vp8_pick_frame_size +vp8_pick_inter_mode +vp8_pick_intra_mode +vp8_plane_add_noise +vp8_plane_add_noise_c +vp8_plane_add_noise_mmx +vp8_plane_add_noise_wmt +vp8_post_proc_down_and_across_mb_row +vp8_post_proc_down_and_across_mb_row_c +vp8_post_proc_down_and_across_mb_row_sse2 +vp8_post_proc_frame +vp8_prev_token_class +vp8_prob_cost +vp8_quantize_mb_c +vp8_quantize_mbuv_c +vp8_quantize_mby_c +vp8_rd_pick_inter_mode +vp8_rd_pick_intra_mode +vp8_receive_raw_frame +vp8_ref_frame_order +vp8_refining_search_sad +vp8_refining_search_sad_c +vp8_refining_search_sadx4 +vp8_regular_quantize_b +vp8_regular_quantize_b_c +vp8_regular_quantize_b_pair_c +vp8_regular_quantize_b_sse2 +vp8_regulate_q +vp8_remove_common +vp8_remove_compressor +vp8_remove_decoder_instances +vp8_reset_mb_tokens_context +vp8_restore_coding_context +vp8_reverse_trans +vp8_rtcd +vp8_rv +vp8_sad16x16 +vp8_sad16x16_c +vp8_sad16x16_mmx +vp8_sad16x16_sse3 +vp8_sad16x16_wmt +vp8_sad16x16x3 +vp8_sad16x16x3_c +vp8_sad16x16x3_sse3 +vp8_sad16x16x3_ssse3 +vp8_sad16x16x4d +vp8_sad16x16x4d_c +vp8_sad16x16x4d_sse3 +vp8_sad16x16x8 +vp8_sad16x16x8_c +vp8_sad16x16x8_sse4 +vp8_sad16x8 +vp8_sad16x8_c +vp8_sad16x8_mmx +vp8_sad16x8_wmt +vp8_sad16x8x3 +vp8_sad16x8x3_c +vp8_sad16x8x3_sse3 +vp8_sad16x8x3_ssse3 +vp8_sad16x8x4d +vp8_sad16x8x4d_c +vp8_sad16x8x4d_sse3 +vp8_sad16x8x8 +vp8_sad16x8x8_c +vp8_sad16x8x8_sse4 +vp8_sad4x4 +vp8_sad4x4_c +vp8_sad4x4_mmx +vp8_sad4x4_wmt +vp8_sad4x4x3 +vp8_sad4x4x3_c +vp8_sad4x4x3_sse3 +vp8_sad4x4x4d +vp8_sad4x4x4d_c +vp8_sad4x4x4d_sse3 +vp8_sad4x4x8 +vp8_sad4x4x8_c +vp8_sad4x4x8_sse4 +vp8_sad8x16 +vp8_sad8x16_c +vp8_sad8x16_mmx +vp8_sad8x16_wmt +vp8_sad8x16x3 +vp8_sad8x16x3_c +vp8_sad8x16x3_sse3 +vp8_sad8x16x4d +vp8_sad8x16x4d_c +vp8_sad8x16x4d_sse3 +vp8_sad8x16x8 +vp8_sad8x16x8_c +vp8_sad8x16x8_sse4 +vp8_sad8x8 +vp8_sad8x8_c +vp8_sad8x8_mmx +vp8_sad8x8_wmt +vp8_sad8x8x3 +vp8_sad8x8x3_c +vp8_sad8x8x3_sse3 +vp8_sad8x8x4d +vp8_sad8x8x4d_c +vp8_sad8x8x4d_sse3 +vp8_sad8x8x8 +vp8_sad8x8x8_c +vp8_sad8x8x8_sse4 +vp8_save_coding_context +vp8_second_pass +vp8_set_active_map +vp8_set_internal_size +vp8_set_mbmode_and_mvs +vp8_set_quantizer +vp8_set_reference +vp8_set_roimap +vp8_set_speed_features +vp8_setup_block_dptrs +vp8_setup_block_ptrs +vp8_setup_intra_recon +vp8_setup_intra_recon_top_line +vp8_setup_key_frame +vp8_setup_version +vp8_short_fdct4x4 +vp8_short_fdct4x4_c +vp8_short_fdct4x4_mmx +vp8_short_fdct4x4_sse2 +vp8_short_fdct8x4 +vp8_short_fdct8x4_c +vp8_short_fdct8x4_mmx +vp8_short_fdct8x4_sse2 +vp8_short_idct4x4llm +vp8_short_idct4x4llm_c +vp8_short_idct4x4llm_mmx +vp8_short_inv_walsh4x4 +vp8_short_inv_walsh4x4_1_c +vp8_short_inv_walsh4x4_c +vp8_short_inv_walsh4x4_mmx +vp8_short_inv_walsh4x4_sse2 +vp8_short_walsh4x4 +vp8_short_walsh4x4_c +vp8_short_walsh4x4_sse2 +vp8_six_tap_mmx +vp8_sixtap_predict16x16 +vp8_sixtap_predict16x16_c +vp8_sixtap_predict16x16_mmx +vp8_sixtap_predict16x16_sse2 +vp8_sixtap_predict16x16_ssse3 +vp8_sixtap_predict4x4 +vp8_sixtap_predict4x4_c +vp8_sixtap_predict4x4_mmx +vp8_sixtap_predict4x4_ssse3 +vp8_sixtap_predict8x4 +vp8_sixtap_predict8x4_c +vp8_sixtap_predict8x4_mmx +vp8_sixtap_predict8x4_sse2 +vp8_sixtap_predict8x4_ssse3 +vp8_sixtap_predict8x8 +vp8_sixtap_predict8x8_c +vp8_sixtap_predict8x8_mmx +vp8_sixtap_predict8x8_sse2 +vp8_sixtap_predict8x8_ssse3 +vp8_skip_fractional_mv_step +vp8_small_mvencodings +vp8_small_mvtree +vp8_start_encode +vp8_stop_encode +vp8_strict_quantize_b_c +vp8_stuff_mb +vp8_sub_mv_ref_encoding_array +vp8_sub_mv_ref_prob2 +vp8_sub_mv_ref_prob3 +vp8_sub_mv_ref_tree +vp8_sub_pel_filters +vp8_sub_pixel_mse16x16 +vp8_sub_pixel_mse16x16_c +vp8_sub_pixel_mse16x16_mmx +vp8_sub_pixel_mse16x16_wmt +vp8_sub_pixel_variance16x16 +vp8_sub_pixel_variance16x16_c +vp8_sub_pixel_variance16x16_mmx +vp8_sub_pixel_variance16x16_ssse3 +vp8_sub_pixel_variance16x16_wmt +vp8_sub_pixel_variance16x8 +vp8_sub_pixel_variance16x8_c +vp8_sub_pixel_variance16x8_mmx +vp8_sub_pixel_variance16x8_ssse3 +vp8_sub_pixel_variance16x8_wmt +vp8_sub_pixel_variance4x4 +vp8_sub_pixel_variance4x4_c +vp8_sub_pixel_variance4x4_mmx +vp8_sub_pixel_variance4x4_wmt +vp8_sub_pixel_variance8x16 +vp8_sub_pixel_variance8x16_c +vp8_sub_pixel_variance8x16_mmx +vp8_sub_pixel_variance8x16_wmt +vp8_sub_pixel_variance8x8 +vp8_sub_pixel_variance8x8_c +vp8_sub_pixel_variance8x8_mmx +vp8_sub_pixel_variance8x8_wmt +vp8_subtract_b +vp8_subtract_b_c +vp8_subtract_b_mmx +vp8_subtract_b_mmx_impl +vp8_subtract_b_sse2 +vp8_subtract_b_sse2_impl +vp8_subtract_mbuv +vp8_subtract_mbuv_c +vp8_subtract_mbuv_mmx +vp8_subtract_mbuv_sse2 +vp8_subtract_mby +vp8_subtract_mby_c +vp8_subtract_mby_mmx +vp8_subtract_mby_sse2 +vp8_swap_yv12_buffer +vp8_temporal_filter_apply +vp8_temporal_filter_apply_c +vp8_temporal_filter_apply_sse2 +vp8_temporal_filter_prepare_c +vp8_tokenize_mb +vp8_tokens_from_tree +vp8_tokens_from_tree_offset +vp8_transform_intra_mby +vp8_transform_mbuv +vp8_tree_probs_from_distribution +vp8_unpack_block1d16_h6_sse2 +vp8_update_coef_probs +vp8_update_entropy +vp8_update_gf_useage_maps +vp8_update_rate_correction_factors +vp8_update_reference +vp8_update_zbin_extra +vp8_use_as_reference +vp8_uv_mode_encodings +vp8_uv_mode_prob +vp8_uv_mode_tree +vp8_variance16x16 +vp8_variance16x16_c +vp8_variance16x16_mmx +vp8_variance16x16_wmt +vp8_variance16x8 +vp8_variance16x8_c +vp8_variance16x8_mmx +vp8_variance16x8_wmt +vp8_variance4x4 +vp8_variance4x4_c +vp8_variance4x4_mmx +vp8_variance4x4_wmt +vp8_variance8x16 +vp8_variance8x16_c +vp8_variance8x16_mmx +vp8_variance8x16_wmt +vp8_variance8x8 +vp8_variance8x8_c +vp8_variance8x8_mmx +vp8_variance8x8_wmt +vp8_variance_and_sad_16x16_sse2 +vp8_variance_halfpixvar16x16_h +vp8_variance_halfpixvar16x16_h_c +vp8_variance_halfpixvar16x16_h_mmx +vp8_variance_halfpixvar16x16_h_wmt +vp8_variance_halfpixvar16x16_hv +vp8_variance_halfpixvar16x16_hv_c +vp8_variance_halfpixvar16x16_hv_mmx +vp8_variance_halfpixvar16x16_hv_wmt +vp8_variance_halfpixvar16x16_v +vp8_variance_halfpixvar16x16_v_c +vp8_variance_halfpixvar16x16_v_mmx +vp8_variance_halfpixvar16x16_v_wmt +vp8_vertical_band_2_1_scale_c +vp8_vertical_band_2_1_scale_i_c +vp8_vertical_band_5_3_scale_c +vp8_vertical_band_5_4_scale_c +vp8_write_mvprobs +vp8_ymode_encodings +vp8_ymode_prob +vp8_ymode_tree +vp8_yv12_alloc_frame_buffer +vp8_yv12_copy_frame_c +vp8_yv12_copy_partial_frame_c +vp8_yv12_de_alloc_frame_buffer +vp8_yv12_extend_frame_borders_c +vp8_yv12_realloc_frame_buffer +vp8cx_base_skip_false_prob +vp8cx_create_encoder_threads +vp8cx_encode_inter_macroblock +vp8cx_encode_intra_macroblock +vp8cx_frame_init_quantizer +vp8cx_init_de_quantizer +vp8cx_init_mbrthread_data +vp8cx_init_quantizer +vp8cx_initialize_me_consts +vp8cx_mb_init_quantizer +vp8cx_pick_filter_level +vp8cx_pick_filter_level_fast +vp8cx_remove_encoder_threads +vp8cx_set_alt_lf_level +vp8dx_bool_decoder_fill +vp8dx_get_raw_frame +vp8dx_get_reference +vp8dx_receive_compressed_data +vp8dx_references_buffer +vp8dx_set_reference +vp8dx_start_decode +vp8mt_alloc_temp_buffers +vp8mt_de_alloc_temp_buffers +vp8mt_decode_mb_rows +vp9_alloc_frame_buffer +vp9_extend_frame_borders_c +vp9_extend_frame_inner_borders_c +vp9_free_frame_buffer +vp9_realloc_frame_buffer +vpx_calloc +vpx_codec_control_ +vpx_codec_dec_init_ver +vpx_codec_decode +vpx_codec_destroy +vpx_codec_enc_config_default +vpx_codec_enc_config_set +vpx_codec_enc_init_multi_ver +vpx_codec_enc_init_ver +vpx_codec_encode +vpx_codec_err_to_string +vpx_codec_error +vpx_codec_error_detail +vpx_codec_get_caps +vpx_codec_get_cx_data +vpx_codec_get_frame +vpx_codec_get_global_headers +vpx_codec_get_mem_map +vpx_codec_get_preview_frame +vpx_codec_get_stream_info +vpx_codec_iface_name +vpx_codec_peek_stream_info +vpx_codec_pkt_list_add +vpx_codec_pkt_list_get +vpx_codec_register_put_frame_cb +vpx_codec_register_put_slice_cb +vpx_codec_set_cx_data_buf +vpx_codec_set_mem_map +vpx_codec_version +vpx_codec_version_extra_str +vpx_codec_version_str +vpx_codec_vp8_cx +vpx_codec_vp8_cx_algo +vpx_codec_vp8_dx +vpx_codec_vp8_dx_algo +vpx_free +vpx_malloc +vpx_mem_get_version +vpx_mem_set_functions +vpx_mem_set_heap_size +vpx_mem_unset_functions +vpx_memalign +vpx_memcpy +vpx_memmove +vpx_memset +vpx_mmap_alloc +vpx_mmap_dtor +vpx_realloc +vpx_reset_mmx_state +vpx_scale_frame +vpx_scale_rtcd +vpx_validate_mmaps +vpx_yv12_copy_y_c +write_cryptpacket diff --git a/protocols/Tox/lib/libtox.exp b/protocols/Tox/lib/libtox.exp new file mode 100644 index 0000000000..be51aeee04 Binary files /dev/null and b/protocols/Tox/lib/libtox.exp differ diff --git a/protocols/Tox/lib/libtox.lib b/protocols/Tox/lib/libtox.lib new file mode 100644 index 0000000000..d9bf55a1e1 Binary files /dev/null and b/protocols/Tox/lib/libtox.lib differ diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc new file mode 100644 index 0000000000..54fa3d6340 Binary files /dev/null and b/protocols/Tox/res/resource.rc differ diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h new file mode 100644 index 0000000000..f27fc74af8 --- /dev/null +++ b/protocols/Tox/src/common.h @@ -0,0 +1,25 @@ +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include "version.h" +#include "resource.h" + +#include "..\include\tox\tox.h" + +extern HINSTANCE g_hInstance; + +#include "tox_proto.h" + +#endif //_COMMON_H_ \ No newline at end of file diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp new file mode 100644 index 0000000000..f9322d7f3e --- /dev/null +++ b/protocols/Tox/src/main.cpp @@ -0,0 +1,52 @@ +#include "common.h" + +int hLangpack; +HINSTANCE g_hInstance; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {00272A3E-F5FA-4090-8B67-3E62AC1EE0B4} + {0x272a3e, 0xf5fa, 0x4090, {0x8b, 0x67, 0x3e, 0x62, 0xac, 0x1e, 0xe0, 0xb4}} +}; + +DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) +{ + g_hInstance = hInstance; + + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = "TOX"; + pd.type = PROTOTYPE_PROTOCOL; + pd.fnInit = (pfnInitProto)CToxProto::InitProtoInstance; + pd.fnUninit = (pfnUninitProto)CToxProto::UninitProtoInstance; + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + return 0; +} \ No newline at end of file diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h new file mode 100644 index 0000000000..161dc416c0 Binary files /dev/null and b/protocols/Tox/src/resource.h differ diff --git a/protocols/Tox/src/stdafx.cpp b/protocols/Tox/src/stdafx.cpp new file mode 100644 index 0000000000..7d92b0fd29 --- /dev/null +++ b/protocols/Tox/src/stdafx.cpp @@ -0,0 +1,18 @@ +/* +Copyright (c) 2013-14 Miranda NG project (http://miranda-ng.org) + +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 version 2 +of the License. + +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 . +*/ + +#include "common.h" diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp new file mode 100644 index 0000000000..263e922595 --- /dev/null +++ b/protocols/Tox/src/tox_contacts.cpp @@ -0,0 +1,70 @@ +#include "common.h" + +bool CToxProto::IsProtoContact(MCONTACT hContact) +{ + return ::lstrcmpiA(::GetContactProto(hContact), m_szModuleName) == 0; +} + +MCONTACT CToxProto::GetContactByUserId(const wchar_t *userId) +{ + MCONTACT hContact = NULL; + + //EnterCriticalSection(&contact_search_lock); + + for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + { + ptrW cUserId(::db_get_wsa(hContact, m_szModuleName, "UserID")); + if (lstrcmpi(cUserId, userId) == 0) + break; + } + + //LeaveCriticalSection(&contact_search_lock); + + return hContact; +} + +MCONTACT CToxProto::AddContact(const wchar_t *userId, const wchar_t *nick, bool isHidden) +{ + MCONTACT hContact = GetContactByUserId(userId); + if ( !hContact) + { + hContact = (MCONTACT)::CallService(MS_DB_CONTACT_ADD, 0, 0); + ::CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName); + + db_set_b(hContact, "CList", "NotOnList", 1); + + if (isHidden) + db_set_b(hContact, "CList", "Hidden", 1); + + setWString(hContact, "UserId", userId); + setWString(hContact, "Nick", nick); + } + + return hContact; +} + +void __cdecl CToxProto::SearchByUidAsync(void* arg) +{ + ptrW userId((wchar_t*)arg); + + //MCONTACT hContact = GetContactByUserId(userId); + //if (hContact) + //{ + // ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact); + // ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)TOX_SEARCH_BYUID, 0); + // return; + //} + + //// there will be placed code + //// that will search for contact by userId + // ... + // ... + //// and call + PROTOSEARCHRESULT psr = {0}; + psr.cbSize = sizeof(psr); + //// get user id [and nick] + //psr.id = userId; + //psr.nick = nick; + + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)TOX_SEARCH_BYUID, (LPARAM)&psr); +} \ No newline at end of file diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp new file mode 100644 index 0000000000..550cdd2999 --- /dev/null +++ b/protocols/Tox/src/tox_events.cpp @@ -0,0 +1,29 @@ +#include "common.h" + +void CToxProto::OnFriendRequest(Tox *tox, const uint8_t *userId, const uint8_t *message, const uint16_t messageSize, void *arg) +{ +} + +void CToxProto::OnFriendMessage(Tox *tox, const int friendId, const uint8_t *message, const uint16_t messageSize, void *arg) +{ +} + +void CToxProto::OnFriendNameChange(Tox *tox, const int friendId, const uint8_t *name, const uint16_t nameSize, void *arg) +{ +} + +void CToxProto::OnStatusMessageChanged(Tox *tox, const int friendId, const uint8_t* message, const uint16_t messageSize, void *arg) +{ +} + +void CToxProto::OnUserStatusChanged(Tox *tox, int32_t friendnumber, uint8_t TOX_USERSTATUS, void *userdata) +{ +} + +void CToxProto::OnConnectionStatusChanged(Tox *tox, const int friendId, const uint8_t status, void *arg) +{ +} + +void CToxProto::OnAction(Tox *tox, const int friendId, const uint8_t *message, const uint16_t messageSize, void *arg) +{ +} \ No newline at end of file diff --git a/protocols/Tox/src/tox_instances.cpp b/protocols/Tox/src/tox_instances.cpp new file mode 100644 index 0000000000..ea010f894a --- /dev/null +++ b/protocols/Tox/src/tox_instances.cpp @@ -0,0 +1,44 @@ +#include "common.h" + +LIST CToxProto::instanceList(1, CToxProto::CompareProtos); + +int CToxProto::CompareProtos(const CToxProto *p1, const CToxProto *p2) +{ + return wcscmp(p1->m_tszUserName, p2->m_tszUserName); +} + +CToxProto* CToxProto::InitProtoInstance(const char* protoName, const wchar_t* userName) +{ + CToxProto *ppro = new CToxProto(protoName, userName); + CToxProto::instanceList.insert(ppro); + + return ppro; +} + +int CToxProto::UninitProtoInstance(CToxProto* ppro) +{ + CToxProto::instanceList.remove(ppro); + + delete ppro; + + return 0; +} + +void CToxProto::UninitInstances() +{ + CToxProto::instanceList.destroy(); +} + +CToxProto* CToxProto::GetContactInstance(MCONTACT hContact) +{ + char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + + if (proto == NULL) + return NULL; + + for (int i = 0; i < CToxProto::instanceList.getCount(); i++) + if ( !::strcmp(proto, CToxProto::instanceList[i]->m_szModuleName)) + return CToxProto::instanceList[i]; + + return NULL; +} \ No newline at end of file diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp new file mode 100644 index 0000000000..00303c8f0d --- /dev/null +++ b/protocols/Tox/src/tox_proto.cpp @@ -0,0 +1,161 @@ +#include "common.h" + +CToxProto::CToxProto(const char* protoName, const TCHAR* userName) : + PROTO(protoName, userName), + _tox(tox_new(0)) +{ + tox_callback_friend_request(_tox, OnFriendRequest, this); + tox_callback_friend_message(_tox, OnFriendMessage, this); + tox_callback_friend_action(_tox, OnAction, this); + tox_callback_name_change(_tox, OnFriendNameChange, this); + tox_callback_status_message(_tox, OnStatusMessageChanged, this); + tox_callback_user_status(_tox, OnUserStatusChanged, this); + tox_callback_connection_status(_tox, OnConnectionStatusChanged, this); + + CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::CreateAccMgrUI); +} + +CToxProto::~CToxProto() +{ + tox_kill(_tox); +} + +void CALLBACK CToxProto::TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) +{ + CToxProto *ppro = (CToxProto*)idEvent; + + tox_do(ppro->_tox); +} + +MCONTACT __cdecl CToxProto::AddToList(int flags, PROTOSEARCHRESULT* psr) +{ + MCONTACT hContact = AddContact(psr->id, psr->nick); + + return hContact; +} + +MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return 0; } + +int __cdecl CToxProto::Authorize(HANDLE hDbEvent) { return 0; } +int __cdecl CToxProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) { return 0; } +int __cdecl CToxProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT*) { return 0; } +int __cdecl CToxProto::AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage) { return 0; } + +HANDLE __cdecl CToxProto::ChangeInfo(int iInfoType, void* pInfoData) { return 0; } + +HANDLE __cdecl CToxProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { return 0; } +int __cdecl CToxProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) { return 0; } +int __cdecl CToxProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) { return 0; } +int __cdecl CToxProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename) { return 0; } + +DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact) +{ + switch(type) + { + case PFLAGNUM_1: + return PF1_IM | PF1_AUTHREQ | PF1_BASICSEARCH | PF1_ADDSEARCHRES; + case PFLAGNUM_2: + return PF2_ONLINE | PF2_SHORTAWAY | PF2_LIGHTDND; + case PFLAGNUM_4: + return PF4_SUPPORTTYPING; + case PFLAG_UNIQUEIDTEXT: + return (INT_PTR)"User Id"; + case PFLAG_UNIQUEIDSETTING: + return (DWORD_PTR)"UserId"; + } + + return 0; +} +int __cdecl CToxProto::GetInfo(MCONTACT hContact, int infoType) { return 0; } + +HANDLE __cdecl CToxProto::SearchBasic(const PROTOCHAR* id) +{ + //if ( !IsOnline()) return 0; + + this->ForkThread(&CToxProto::SearchByUidAsync, (void*)id); + + return (HANDLE)TOX_SEARCH_BYUID; +} + +HANDLE __cdecl CToxProto::SearchByEmail(const PROTOCHAR* email) { return 0; } +HANDLE __cdecl CToxProto::SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName) { return 0; } +HWND __cdecl CToxProto::SearchAdvanced(HWND owner) { return 0; } +HWND __cdecl CToxProto::CreateExtendedSearchUI(HWND owner) { return 0; } + +int __cdecl CToxProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT*) { return 0; } +int __cdecl CToxProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT*) { return 0; } +int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT*) { return 0; } +int __cdecl CToxProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) { return 0; } + +int __cdecl CToxProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT* hContactsList) { return 0; } +HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { return 0; } +int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg) { return 0; } +int __cdecl CToxProto::SendUrl(MCONTACT hContact, int flags, const char* url) { return 0; } + +int __cdecl CToxProto::SetApparentMode(MCONTACT hContact, int mode) { return 0; } + +int __cdecl CToxProto::SetStatus(int iNewStatus) +{ + if (iNewStatus == this->m_iDesiredStatus) + return 0; + + int old_status = this->m_iStatus; + this->m_iDesiredStatus = iNewStatus; + + if (iNewStatus == ID_STATUS_OFFLINE) + { + // lgout + m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; + + ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + + return 0; + } + else + { + if (old_status == ID_STATUS_OFFLINE/* && !this->IsOnline()*/) + { + m_iStatus = ID_STATUS_CONNECTING; + + // login + //_timer = SetTimer(NULL, (UINT_PTR)this, 30, (TIMERPROC)CToxProto::TimerProc); + } + else + { + // set tox status + TOX_USERSTATUS userstatus; + switch (iNewStatus) + { + case ID_STATUS_ONLINE: + userstatus = TOX_USERSTATUS_NONE; + break; + case ID_STATUS_AWAY: + userstatus = TOX_USERSTATUS_AWAY; + break; + case ID_STATUS_OCCUPIED: + userstatus = TOX_USERSTATUS_BUSY; + break; + default: + userstatus = TOX_USERSTATUS_INVALID; + break; + } + tox_set_user_status(_tox, userstatus); + + ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + + return 0; + } + } + + ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + + return 0; +} + +HANDLE __cdecl CToxProto::GetAwayMsg(MCONTACT hContact) { return 0; } +int __cdecl CToxProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) { return 0; } +int __cdecl CToxProto::SetAwayMsg(int iStatus, const PROTOCHAR* msg) { return 0; } + +int __cdecl CToxProto::UserIsTyping(MCONTACT hContact, int type) { return 0; } + +int __cdecl CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) { return 0; } \ No newline at end of file diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h new file mode 100644 index 0000000000..37fee20593 --- /dev/null +++ b/protocols/Tox/src/tox_proto.h @@ -0,0 +1,108 @@ +#ifndef _TOX_PROTO_H_ +#define _TOX_PROTO_H_ + +#include "common.h" + +#define TOX_SEARCH_BYUID 1001 + +struct CToxProto : public PROTO +{ +public: + + ////////////////////////////////////////////////////////////////////////////////////// + //Ctors + + CToxProto(const char *protoName, const wchar_t *userName); + ~CToxProto(); + + ////////////////////////////////////////////////////////////////////////////////////// + // Virtual functions + + virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + + virtual int __cdecl Authorize(HANDLE hDbEvent); + virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); + virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); + + virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); + + virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath); + virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason); + virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename); + + virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); + virtual int __cdecl GetInfo(MCONTACT hContact, int infoType); + + virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id); + virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email); + virtual HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName); + virtual HWND __cdecl SearchAdvanced(HWND owner); + virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); + + virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(MCONTACT hContact, PROTOFILEEVENT*); + virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT*); + + virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT* hContactsList); + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url); + + virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode); + virtual int __cdecl SetStatus(int iNewStatus); + + virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); + virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt); + virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg); + + virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); + + virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam); + + // instances + static CToxProto* InitProtoInstance(const char* protoName, const wchar_t* userName); + static int UninitProtoInstance(CToxProto* ppro); + + static CToxProto* GetContactInstance(MCONTACT hContact); + static void UninitInstances(); + +private: + + // instances + static LIST instanceList; + static int CompareProtos(const CToxProto *p1, const CToxProto *p2); + + static void CALLBACK TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD); + + // Instance data: + Tox *_tox; + UINT_PTR _timer; + + //services + INT_PTR __cdecl CreateAccMgrUI(WPARAM, LPARAM); + + //events + static void OnFriendRequest(Tox *tox, const uint8_t *userId, const uint8_t *message, const uint16_t messageSize, void *arg); + static void OnFriendMessage(Tox *tox, const int friendId, const uint8_t *message, const uint16_t messageSize, void *arg); + static void OnFriendNameChange(Tox *tox, const int friendId, const uint8_t *name, const uint16_t nameSize, void *arg); + static void OnStatusMessageChanged(Tox *tox, const int friendId, const uint8_t* message, const uint16_t messageSize, void *arg); + static void OnUserStatusChanged(Tox *tox, int32_t friendnumber, uint8_t TOX_USERSTATUS, void *userdata); + static void OnConnectionStatusChanged(Tox *tox, const int friendId, const uint8_t status, void *arg); + static void OnAction(Tox *tox, const int friendId, const uint8_t *message, const uint16_t messageSize, void *arg); + + // contacts + bool IsProtoContact(MCONTACT hContact); + MCONTACT GetContactByUserId(const wchar_t *userId); + MCONTACT CToxProto::AddContact(const wchar_t*userId, const wchar_t *nick, bool isHidden = false); + + void __cdecl SearchByUidAsync(void* arg); + + // dialogs + static INT_PTR CALLBACK AccountManagerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +}; + +#endif //_TOX_PROTO_H_ \ No newline at end of file diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp new file mode 100644 index 0000000000..dfd4907737 --- /dev/null +++ b/protocols/Tox/src/tox_services.cpp @@ -0,0 +1,16 @@ +#include "common.h" + +INT_PTR CALLBACK CToxProto::AccountManagerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + return FALSE; +} + +INT_PTR CToxProto::CreateAccMgrUI(WPARAM, LPARAM lParam) +{ + return (INT_PTR)CreateDialogParam( + g_hInstance, + MAKEINTRESOURCE(IDD_ACCMGR), + (HWND)lParam, + &CToxProto::AccountManagerProc, + (LPARAM)this); +} \ No newline at end of file diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h new file mode 100644 index 0000000000..f81fce4d79 --- /dev/null +++ b/protocols/Tox/src/version.h @@ -0,0 +1,15 @@ +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 11 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 0 + +#include + +#define __PLUGIN_NAME "Tox Protocol" +#define __INTERNAL_NAME "Tox" +#define __FILENAME "Tox.dll" +#define __DESCRIPTION "Tox protocol support for Miranda NG." +#define __AUTHOR "ForNeVeR, unsane" +#define __AUTHOREMAIL "" +#define __AUTHORWEB "http://miranda-ng.org/p/Tox/" +#define __COPYRIGHT "© 2014 Miranda NG project" -- cgit v1.2.3