/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2023 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQH_HTTP_REQUEST_P_H
#define AQH_HTTP_REQUEST_P_H


#include "aqhome/http/httprequest.h"



typedef struct AQH_HTTP_REQUEST AQH_HTTP_REQUEST;
struct AQH_HTTP_REQUEST {
  GWEN_TREE2_ELEMENT(AQH_HTTP_REQUEST)

  GWEN_MSG_ENDPOINT *endpoint;

  /* received stuff */
  const GWEN_MSG *receivedMsg;  /* don't free */

  const char *command;          /* don't free */
  const char *protocol;         /* don't free */
  const char *urlPath;          /* don't free */
  GWEN_URL *url;

  GWEN_STRINGLIST *urlPathMembers;

  GWEN_DB_NODE *dbCommand;      /* don't free */
  GWEN_DB_NODE *dbHeader;       /* don't free */
  GWEN_DB_NODE *dbCookies;      /* don't free */

  uint32_t recvdBodySize;
  const uint8_t *recvdBodyPtr;

  /* derived stuff */
  char *sessionId;
  char *moduleName;

  AQH_SESSION *session;         /* don't free */
  AQH_MODULE *module;           /* don't free */
  uint32_t modulePerms;

  GWEN_DB_NODE *dbPostBody;


  /* response stuff */
  int responseCode;
  char *responseText;
  GWEN_MSG *responseMsg;
};



#endif



