Browse Source

compile with latest library versions, escpecialy the new socket code.

next
Georg Hopp 12 years ago
parent
commit
a62879f735
  1. 1
      include/application/adapter/http.h
  2. 1
      include/application/application.h
  3. 1
      include/asset.h
  4. 1
      include/auth/auth.h
  5. 1
      include/auth/credential.h
  6. 1
      include/auth/ldap.h
  7. 1
      include/auth/storage.h
  8. 1
      include/config/config.h
  9. 1
      include/config/value.h
  10. 1
      include/http/cookie.h
  11. 1
      include/http/header.h
  12. 1
      include/http/message.h
  13. 1
      include/http/parser.h
  14. 1
      include/http/request.h
  15. 1
      include/http/response.h
  16. 3
      include/http/worker.h
  17. 1
      include/http/writer.h
  18. 1
      include/permission.h
  19. 1
      include/rbac/object.h
  20. 1
      include/rbac/operation.h
  21. 1
      include/rbac/user.h
  22. 2
      include/role.h
  23. 1
      include/router.h
  24. 7
      include/server.h
  25. 1
      include/session.h
  26. 1
      include/storage/storage.h
  27. 1
      include/user.h
  28. 9
      src/server/handle_accept.c
  29. 9
      src/server/server.c

1
include/application/adapter/http.h

@ -32,6 +32,7 @@ TR_CLASS(ApplicationAdapterHttp) {
Application application;
Router router;
};
TR_INSTANCE_INIT(ApplicationAdapterHttp);
#endif // __APPLICATION_ADAPTER_HTTP_H__

1
include/application/application.h

@ -67,6 +67,7 @@ TR_CLASS(Application) {
const char * version;
const char * loc;
};
TR_INSTANCE_INIT(Application);
int applicationLogin(Application, Credential, Session);
void applicationLogout(Application, Session);

1
include/asset.h

@ -49,6 +49,7 @@ TR_CLASS(Asset) {
size_t ref_count;
};
TR_INSTANCE_INIT(Asset);
Asset assetPoolGet(const char *, size_t);
size_t assetPoolRelease(Asset);

1
include/auth/auth.h

@ -58,6 +58,7 @@ typedef enum e_AuthModule {
TR_CLASS(Auth) {
void * auth[MAX_AUTH + 1];
};
TR_INSTANCE_INIT(Auth);
int authCreate(Auth, AuthModule, ...);

1
include/auth/credential.h

@ -48,6 +48,7 @@ TR_CLASS(Credential) {
} cred;
};
TR_INSTANCE_INIT(Credential);
#endif // __AUTH_CREDENTIAL_H__

1
include/auth/ldap.h

@ -35,6 +35,7 @@ TR_CLASS(AuthLdap) {
int version;
size_t nbase_dn;
};
TR_INSTANCE_INIT(AuthLdap);
#endif // __AUTH_LDAP_H__

1
include/auth/storage.h

@ -38,6 +38,7 @@
TR_CLASS(AuthStorage) {
Storage store;
};
TR_INSTANCE_INIT(AuthStorage);
/**
* \todo In future this should use a more general purpose hash

1
include/config/config.h

@ -34,6 +34,7 @@ TR_CLASS(Config) {
char * cnf_file;
TR_Hash config;
};
TR_INSTANCE_INIT(Config);
ConfigValue configGet(Config, const char *, size_t);

1
include/config/value.h

@ -48,6 +48,7 @@ TR_CLASS(ConfigValue) {
unsigned long hash;
};
TR_INSTANCE_INIT(ConfigValue);
#endif // __CONFIG_VALUE_H__

1
include/http/cookie.h

@ -42,6 +42,7 @@ TR_CLASS(HttpCookie) {
size_t nkey;
size_t nvalue;
};
TR_INSTANCE_INIT(HttpCookie);
char * httpCookieToString(HttpCookie);
HttpCookie httpStringToCookie(const char *);

1
include/http/header.h

@ -40,6 +40,7 @@ TR_CLASS(HttpHeader) {
size_t cvalue; //!< count of values up to N_VALUE
size_t size; //!< full size of this header
};
TR_INSTANCE_INIT(HttpHeader);
size_t httpHeaderToString(HttpHeader, char *);

1
include/http/message.h

@ -39,6 +39,7 @@ TR_CLASS(HttpMessage) {
int nbody;
int dbody;
};
TR_INSTANCE_INIT(HttpMessage);
char httpMessageHasKeepAlive(HttpMessage);
size_t httpMessageHeaderSizeGet(HttpMessage);

1
include/http/parser.h

@ -54,6 +54,7 @@ TR_CLASS(HttpParser) {
HttpMessageState state;
};
TR_INSTANCE_INIT(HttpParser);
ssize_t httpParserParse(void *, TR_Stream);
void httpParserRequestVars(HttpParser);

1
include/http/request.h

@ -56,6 +56,7 @@ TR_CLASS(HttpRequest) {
TR_Hash post;
TR_Hash cookies;
};
TR_INSTANCE_INIT(HttpRequest);
HttpMethod httpRequestGetMethodId(HttpRequest);

1
include/http/response.h

@ -40,6 +40,7 @@ TR_CLASS(HttpResponse) {
unsigned int status;
char * reason;
};
TR_INSTANCE_INIT(HttpResponse);
HttpResponse httpResponse304(
const char *, size_t,

3
include/http/worker.h

@ -40,7 +40,7 @@
TR_CLASS(HttpWorker) {
char * id;
TR_Sock socket;
TR_Socket socket;
TR_Cbuf pbuf;
TR_Hash asset_pool;
@ -55,6 +55,7 @@ TR_CLASS(HttpWorker) {
HttpParser parser;
HttpWriter writer;
};
TR_INSTANCE_INIT(HttpWorker);
#endif // __HTTP_WORKER_H__

1
include/http/writer.h

@ -89,6 +89,7 @@ TR_CLASS(HttpWriter) {
HttpWriterState state;
};
TR_INSTANCE_INIT(HttpWriter);
ssize_t httpWriterWrite(void *, TR_Stream);

1
include/permission.h

@ -52,6 +52,7 @@ TR_CLASS(Permission) {
char * resource;
ResourceAction action;
};
TR_INSTANCE_INIT(Permission);
#endif // __PERMISSION_H__

1
include/rbac/object.h

@ -33,6 +33,7 @@ TR_CLASS(RbacObject) {
char * name;
size_t nname;
};
TR_INSTANCE_INIT(RbacObject);
#endif // __RBAC_OBJECT_H__

1
include/rbac/operation.h

@ -32,6 +32,7 @@ TR_CLASS(RbacOperation) {
char * name;
size_t nname;
};
TR_INSTANCE_INIT(RbacOperation);
#endif // __RBAC_OPERATION_H__

1
include/rbac/user.h

@ -41,6 +41,7 @@ TR_CLASS(RbacUser) {
char * name;
size_t nname;
};
TR_INSTANCE_INIT(RbacUser);
// void userSerialize(User, void **, size_t *);
// void userDeserialize(User, void *, size_t);

2
include/role.h

@ -95,7 +95,9 @@ TR_CLASS(Role) {
User * users;
Hash users_idx;
// end og ROLE definition.
};
TR_INSTANCE_INIT(Role);
#endif // __ROLE_H__

1
include/router.h

@ -51,6 +51,7 @@ TR_CLASS(Router) {
char * prefix;
size_t nprefix;
};
TR_INSTANCE_INIT(Router);
HttpResponse routerRoute(Router, HttpRequest, Session);

7
include/server.h

@ -35,15 +35,15 @@
#include "trio.h"
struct conns {
TR_Sock sock;
TR_Socket sock;
TR_Stream stream;
void * worker;
};
TR_CLASS(Server) {
TR_Logger logger;
TR_Sock sock;
TR_Sock sockSSL;
TR_Socket sock;
TR_Socket sockSSL;
SSL_CTX * ctx;
void * worker;
@ -53,6 +53,7 @@ TR_CLASS(Server) {
struct conns * conns;
};
TR_INSTANCE_INIT(Server);
void serverRun(Server this);

1
include/session.h

@ -70,6 +70,7 @@ TR_CLASS(Session) {
time_t livetime;
User user;
};
TR_INSTANCE_INIT(Session);
#endif // __SESSION_H__

1
include/storage/storage.h

@ -41,6 +41,7 @@ TR_CLASS(Storage) {
GDBM_FILE gdbm;
char * db_name;
};
TR_INSTANCE_INIT(Storage);
StoragePutResult storagePut(Storage, char *, size_t, char *, size_t);
StoragePutResult storageUpdate(Storage, char *, size_t, char *, size_t);

1
include/user.h

@ -53,6 +53,7 @@ TR_CLASS(User) {
size_t * nfirstname;
size_t * nsurname;
};
TR_INSTANCE_INIT(User);
#endif // __USER_H__

9
src/server/handle_accept.c

@ -34,15 +34,16 @@
int
serverHandleAccept(Server this, unsigned int i)
{
char remoteAddr[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
TR_Sock acc = NULL;
TR_Stream st;
TR_Socket acc = NULL;
TR_Stream st;
if (this->nfds >= this->max_fds) {
return -1;
}
acc = TR_socketAccept((0 == i)? this->sock : this->sockSSL, &remoteAddr);
acc = (TR_Socket)TR_socketAccept((0 == i)
? (TR_TcpSocket)this->sock
: (TR_TcpSocket)this->sockSSL);
if (NULL != acc && -1 != acc->handle) {
TR_socketNonblock(acc);

9
src/server/server.c

@ -65,11 +65,13 @@ serverCtor(void * _this, va_list * params)
this->fds = TR_calloc(sizeof(struct pollfd), this->max_fds);
this->conns = TR_calloc(sizeof(struct conns), this->max_fds);
this->sock = TR_new(TR_Sock, this->logger, port);
this->sock = TR_new(TR_TcpSocket, this->logger, "0.0.0.0", port, 0);
TR_socketNonblock(this->sock);
TR_socketBind((TR_Socket)this->sock);
this->sockSSL = TR_new(TR_Sock, this->logger, port+1);
this->sockSSL = TR_new(TR_TcpSocket, this->logger, "0.0.0.0", port+1, 0);
TR_socketNonblock(this->sockSSL);
TR_socketBind((TR_Socket)this->sockSSL);
SSL_library_init();
OpenSSL_add_all_algorithms();
@ -88,9 +90,6 @@ serverCtor(void * _this, va_list * params)
CONFIGDIR "/taskrambler.pem",
SSL_FILETYPE_PEM);
TR_socketListen(this->sock, backlog);
TR_socketListen(this->sockSSL, backlog);
(this->fds)[0].fd = this->sock->handle;
(this->fds)[0].events = POLLIN;
(this->fds)[1].fd = this->sockSSL->handle;

Loading…
Cancel
Save