summaryrefslogtreecommitdiffstats
path: root/src/rest.h
Commit message (Collapse)AuthorAgeFilesLines
* rest: support DELETE HTTP request methodJose M. Guisado2023-08-231-0/+1
| | | | | | | | | | | | | | Reuse endpoints in order to add deletion operation such as "/server". This way there is no need to declare a different if/else block in order to parse a new URI for the new "*/delete" endpoint. Current deletion operations are implemented using a different endpoint name such as "/client/delete", "/center/delete" with POST request method. Endpoints using "/delete" suffix may not be removed for backwards compatibility. Adding HTTP method DELETE support for endpoints such as "/center" or "/client" can use the already existing *_post_delete* functions.
* core: add X-Sequence header supportv1.2.2Jose M. Guisado2023-06-131-0/+1
| | | | | | | | | | | | | | | Add non-standard HTTP header "X-Sequence" to the header section of requests (og_send_request) sent to a connected client. Define a starting sequence number when creating a new instance of struct og_client inside og_server_accept_cb. This sequence number is incremented by one for each outgoing request from ogServer. This sequence number is checked when receiving a response from a connected client, if they do not match the connection is dropped. Use sequence 0 for out-of-band commands (reboot, poweroff, stop). Any client response with header "X-Sequence: 0" bypasses sequence check.
* #915 Add last_cmd to GET /clients APIJavier Sánchez Parra2022-05-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "last_cmd" json object contains information of the last command executed by the correspondent client. For now, it only includes "result" string property, which stores "success" if the last command finished correctly or "failure" on the contrary. To populate "result" property, this commit also adds "last_cmd_result" enum attribute to og_client struct. Client response processing fills this attribute according to its success. Clients in WOL_SENT state always have last_cmd->result = "unknown". Request: GET /clients Response: 200 OK { "clients": [ { "addr": "10.141.10.102", "state": "WOL_SENT", "last_cmd": { "result": "unknown" } }, { "addr": "10.141.10.101", "state": "OPG", "speed": 1000, "last_cmd": { "result": "success" } }, { "addr": "10.141.10.100", "state": "OPG", "speed": 1000, "last_cmd": { "result": "failure" } } ] }
* #915 release existing client on reconnectionsOpenGnSys Support Team2022-01-211-0/+1
| | | | | Trasient network problems might result in duplicated clients, drop client object if it already exists before creating a new one.
* #915 remove temporary file to store shell outputOpenGnSys Support Team2022-01-181-0/+1
| | | | | Remove legacy behaviour, store it in the client object instead of a temporary file.
* #1065 Add support for client eventsJose M. Guisado2021-12-011-0/+2
| | | | | | | | ogServer supports events from clients in an agent mode (linux/windows). Client sends event information (eg. user login/logout) via a 103 Early Hints http response message.
* #1065 client: add support for ogclient win stateJose M. Guisado2021-11-171-0/+1
| | | | | | | | | ogClient can be run in windows mode, enabling connection with ogServer when running on a Windows machine. Don't expect the same payload in windows mode as a in live or virtual. Client in windows mode does not send partition setup information, only the status/state. (same case for linux mode)
* #1065 client: add support for ogclient linux stateJose M. Guisado2021-11-171-0/+1
| | | | | | | | | | ogClient can be run in linux mode, intended for exposing some ogServer commands when running in a linux distribution. When connecting with a client in linux mode, do not expect a full partition setup response. Just expect a 'status', and then accept the connection without updating any partition information in the database.
* #1061 add timeout to pending scheduled commandsJose M. Guisado2021-09-061-0/+2
| | | | | | | | | | | Pending schedule commands can deny ogLive boot of clients due to filling of pending cmd queue with commands such as "Iniciar Sesión". For example: Using RemotePC to serve clients that do not boot into ogLive will fill up the pending command queue with "Iniciar Sesión". Introduce a safety timeout for pending (scheduled) commands to avoid this situation.
* move json function declarations to json.hOpenGnSys Support Team2021-06-101-4/+0
| | | | | | | | These function declarations belong to json.h: int og_json_parse_partition_setup(json_t *element, struct og_msg_params *params); int og_json_parse_create_image(json_t *element, struct og_msg_params *params); int og_json_parse_restore_image(json_t *element, struct og_msg_params *params);
* #915 Add schedule/commandJose M. Guisado2021-06-091-0/+4
| | | | | | | | | Enables ogserver to schedule commands (also referred as actions in legacy web console jargon). This feature enables ogserver to write in the "acciones" table in order to have full capabilities for command scheduling purposes, thus not depending in the legacy web console to insert into "acciones" table.
* #995 Add link speed parsing to client probe responseJose M. Guisado2021-05-041-0/+1
| | | | | | If a probe response contains speedinformation, parse and store it inside the client struct. Speed is interpreted as an unsigned integer representing Mbit/s.
* #915 only API REST is supportedOpenGnSys Support Team2021-05-041-1/+0
| | | | Socket hidra API has been removed, all connections use a REST API.
* #580 remove old keepalive codeOpenGnSys Support Team2021-05-041-1/+0
| | | | Needed by the old socket Hydra that does not exist anymore
* #1022 increase maximum API REST request sizeOpenGnSys Support Team2021-02-041-1/+1
| | | | | Software inventory generates a request larger that 64 Kbytes. Rise the maximum API REST request size to 128 Kbytes.
* #1004 Add GET /imagesJavier Sánchez Parra2020-09-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds GET /images to the ogServer REST API. This call returns information of all the images in ogServer. Example response: { "images": [ { "filename": "ubuntu.img", "datasize": 2150400000, "size": 613476223, "modified": "Wed Sep 23 10:37:36 2020", "permissions": "744" }, { "filename": "test.img", "datasize": 2150400000, "size": 613236475, "modified": "Tue Sep 29 08:57:47 2020", "permissions": "744" } ], "disk": { "total": 52573995008, "free": 39624544256 } }
* #971 rename sources folder to srcOpenGnSys Support Team2020-06-261-0/+97
Use the same folder as in ogClient.