Browse Source

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

next
Georg Hopp 12 years ago
parent
commit
8d41a5707b
  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. 7
      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; Application application;
Router router; Router router;
}; };
TR_INSTANCE_INIT(ApplicationAdapterHttp);
#endif // __APPLICATION_ADAPTER_HTTP_H__ #endif // __APPLICATION_ADAPTER_HTTP_H__

1
include/application/application.h

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

1
include/asset.h

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

1
include/auth/auth.h

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

1
include/auth/credential.h

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

1
include/auth/ldap.h

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

1
include/auth/storage.h

@ -38,6 +38,7 @@
TR_CLASS(AuthStorage) { TR_CLASS(AuthStorage) {
Storage store; Storage store;
}; };
TR_INSTANCE_INIT(AuthStorage);
/** /**
* \todo In future this should use a more general purpose hash * \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; char * cnf_file;
TR_Hash config; TR_Hash config;
}; };
TR_INSTANCE_INIT(Config);
ConfigValue configGet(Config, const char *, size_t); ConfigValue configGet(Config, const char *, size_t);

1
include/config/value.h

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

1
include/http/cookie.h

@ -42,6 +42,7 @@ TR_CLASS(HttpCookie) {
size_t nkey; size_t nkey;
size_t nvalue; size_t nvalue;
}; };
TR_INSTANCE_INIT(HttpCookie);
char * httpCookieToString(HttpCookie); char * httpCookieToString(HttpCookie);
HttpCookie httpStringToCookie(const char *); 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 cvalue; //!< count of values up to N_VALUE
size_t size; //!< full size of this header size_t size; //!< full size of this header
}; };
TR_INSTANCE_INIT(HttpHeader);
size_t httpHeaderToString(HttpHeader, char *); size_t httpHeaderToString(HttpHeader, char *);

1
include/http/message.h

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

1
include/http/parser.h

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

1
include/http/request.h

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

1
include/http/response.h

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

3
include/http/worker.h

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

1
include/http/writer.h

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

1
include/permission.h

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

1
include/rbac/object.h

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

1
include/rbac/operation.h

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

1
include/rbac/user.h

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

2
include/role.h

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

1
include/router.h

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

7
include/server.h

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

1
include/session.h

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

1
include/storage/storage.h

@ -41,6 +41,7 @@ TR_CLASS(Storage) {
GDBM_FILE gdbm; GDBM_FILE gdbm;
char * db_name; char * db_name;
}; };
TR_INSTANCE_INIT(Storage);
StoragePutResult storagePut(Storage, char *, size_t, char *, size_t); StoragePutResult storagePut(Storage, char *, size_t, char *, size_t);
StoragePutResult storageUpdate(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 * nfirstname;
size_t * nsurname; size_t * nsurname;
}; };
TR_INSTANCE_INIT(User);
#endif // __USER_H__ #endif // __USER_H__

7
src/server/handle_accept.c

@ -34,15 +34,16 @@
int int
serverHandleAccept(Server this, unsigned int i) 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_Socket acc = NULL;
TR_Stream st; TR_Stream st;
if (this->nfds >= this->max_fds) { if (this->nfds >= this->max_fds) {
return -1; 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) { if (NULL != acc && -1 != acc->handle) {
TR_socketNonblock(acc); 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->fds = TR_calloc(sizeof(struct pollfd), this->max_fds);
this->conns = TR_calloc(sizeof(struct conns), 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_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_socketNonblock(this->sockSSL);
TR_socketBind((TR_Socket)this->sockSSL);
SSL_library_init(); SSL_library_init();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
@ -88,9 +90,6 @@ serverCtor(void * _this, va_list * params)
CONFIGDIR "/taskrambler.pem", CONFIGDIR "/taskrambler.pem",
SSL_FILETYPE_PEM); SSL_FILETYPE_PEM);
TR_socketListen(this->sock, backlog);
TR_socketListen(this->sockSSL, backlog);
(this->fds)[0].fd = this->sock->handle; (this->fds)[0].fd = this->sock->handle;
(this->fds)[0].events = POLLIN; (this->fds)[0].events = POLLIN;
(this->fds)[1].fd = this->sockSSL->handle; (this->fds)[1].fd = this->sockSSL->handle;

Loading…
Cancel
Save