/* * Copyright (C) 2022-2025 Jordan Bancino <@jordan:synapse.telodendria.org> * with other valuable contributors. See CONTRIBUTORS.txt for the full list. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef TELODENDRIA_ROUTES_H #define TELODENDRIA_ROUTES_H /*** * @Nm Routes * @Nd Matrix API endpoint handler functions. * @Dd April 28 2023 * @Xr Matrix HttpRouter * * .Nm * provides all of the Matrix API route functions, which for the sake * of brevity are not documented here---consult the official Matrix * specification for documentation on Matrix routes and the * .Xr telodendria-admin * page for admin API routes. * * @suppress-warnings */ #include #include #include #include #include #include /** * Every route function takes this structure, which contains the data * it needs to successfully handle an API request. */ typedef struct RouteArgs { MatrixHttpHandlerArgs *matrixArgs; HttpServerContext *context; } RouteArgs; /** * Build an HTTP router that sets up all the route functions to be * executed at the correct HTTP paths. */ extern HttpRouter * RouterBuild(void); #define ROUTE(name) \ extern void * \ name(Array *, void *) #define ROUTE_IMPL(name, path, args) \ void * \ name(Array * path, void * args) ROUTE(RouteVersions); ROUTE(RouteWellKnown); ROUTE(RouteKeyServer); ROUTE(RouteCapabilities); ROUTE(RouteLogin); ROUTE(RouteLogout); ROUTE(RouteRegister); ROUTE(RouteRefresh); ROUTE(RouteWhoami); ROUTE(RouteContacts); ROUTE(RouteMediaUpload); ROUTE(RouteMediaDownload); ROUTE(RouteMediaThumbnail); ROUTE(RouteMediaPreview); ROUTE(RouteRoomEvent); ROUTE(RouteRoomContext); ROUTE(RouteRoomRelations); ROUTE(RouteRoomTags); ROUTE(RouteForgetRoom); ROUTE(RouteTimestampToEvent); ROUTE(RouteSearch); ROUTE(RoutePushers); ROUTE(RouteTurnServer); ROUTE(RouteRoomThreads); ROUTE(RouteRoomHierarchy); ROUTE(RouteUpgradeRoom); ROUTE(RouteKnockRoom); ROUTE(RouteReport); ROUTE(RouteChangePwd); ROUTE(RouteDeactivate); ROUTE(RouteTokenValid); ROUTE(RouteUserProfile); ROUTE(RouteThreepidList); ROUTE(RouteThreepidAdd); ROUTE(RouteThreepidDelete); ROUTE(RouteThreepidBind); ROUTE(RouteThreepidUnbind); ROUTE(RouteUserDirectory); ROUTE(RouteDevices); ROUTE(RouteDeleteDevices); ROUTE(RouteAccountData); ROUTE(RoutePresence); ROUTE(RouteKeysUpload); ROUTE(RouteKeysQuery); ROUTE(RouteKeysClaim); ROUTE(RouteKeysChanges); ROUTE(RouteCrossSigningUpload); ROUTE(RouteSignaturesUpload); ROUTE(RouteSendToDevice); ROUTE(RouteRequestToken); ROUTE(RouteUiaFallback); ROUTE(RouteStaticDefault); ROUTE(RouteStaticLogin); ROUTE(RouteStaticResources); ROUTE(RouteFilter); ROUTE(RouteProcControl); ROUTE(RouteConfig); ROUTE(RoutePrivileges); ROUTE(RouteCreateRoom); ROUTE(RouteAliasDirectory); ROUTE(RouteRoomAliases); ROUTE(RouteAdminDeactivate); ROUTE(RouteAdminTokens); ROUTE(RouteFederationVersion); ROUTE(RouteFedInvite); ROUTE(RouteFedSend); ROUTE(RouteSendEvent); ROUTE(RouteMessages); ROUTE(RouteSync); ROUTE(RouteJoinRoom); ROUTE(RouteLeaveRoom); ROUTE(RouteRoomState); ROUTE(RouteRoomMembers); ROUTE(RouteRoomMembership); ROUTE(RouteRedact); ROUTE(RouteReceipt); ROUTE(RouteReadMarkers); ROUTE(RouteTyping); ROUTE(RoutePushRules); ROUTE(RouteNotifications); ROUTE(RouteKeyBackupVersion); ROUTE(RouteRoomKeys); ROUTE(RouteJoinedRooms); ROUTE(RoutePublicRooms); ROUTE(RouteAppservicePing); ROUTE(RouteAppserviceUser); ROUTE(RouteAppserviceRoom); #undef ROUTE #endif