Refactored rhizome.c into several smaller files.

Manifests are now gleaned from advertisements, and the ones that
are interesting are scheduled for importing into database.
(actual importing is not yet done -- requires fetching of file).
This commit is contained in:
gardners 2012-01-12 14:05:05 +10:30
parent 670f7c51c7
commit 42b5c08321
4 changed files with 24 additions and 1377 deletions

View File

@ -2,14 +2,16 @@ SRCS= dna.c server.c client.c peers.c ciphers.c responses.c packetformats.c data
hlrdata.c srandomdev.c simulate.c batman.c export.c gateway.c \ hlrdata.c srandomdev.c simulate.c batman.c export.c gateway.c \
overlay.c overlay_buffer.c overlay_interface.c overlay_payload.c overlay_route.c \ overlay.c overlay_buffer.c overlay_interface.c overlay_payload.c overlay_route.c \
overlay_packetformats.c overlay_abbreviations.c overlay_advertise.c \ overlay_packetformats.c overlay_abbreviations.c overlay_advertise.c \
rhizome.c rhizome_http.c sqlite3.c encode.c sha2.c randombytes.c \ rhizome.c rhizome_http.c rhizome_bundle.c rhizome_database.c rhizome_crypto.c \
rhizome_packetformats.c rhizome_fetch.c sqlite3.c encode.c sha2.c randombytes.c \
overlay_broadcast.c serval_packetvisualise.c overlay_broadcast.c serval_packetvisualise.c
OBJS= dna.o server.o client.o peers.o ciphers.o responses.o packetformats.o dataformats.o \ OBJS= dna.o server.o client.o peers.o ciphers.o responses.o packetformats.o dataformats.o \
hlrdata.o srandomdev.o simulate.o batman.o export.o gateway.o \ hlrdata.o srandomdev.o simulate.o batman.o export.o gateway.o \
overlay.o overlay_buffer.o overlay_interface.o overlay_payload.o overlay_route.o \ overlay.o overlay_buffer.o overlay_interface.o overlay_payload.o overlay_route.o \
overlay_packetformats.o overlay_abbreviations.o overlay_advertise.o \ overlay_packetformats.o overlay_abbreviations.o overlay_advertise.o \
rhizome.o rhizome_http.o sqlite3.o encode.o sha2.o randombytes.o \ rhizome.o rhizome_http.o rhizome_bundle.o rhizome_database.o rhizome_crypto.o \
rhizome_packetformats.o rhizome_fetch.o sqlite3.o encode.o sha2.o randombytes.o \
overlay_broadcast.o serval_packetvisualise.o overlay_broadcast.o serval_packetvisualise.o
HDRS= Makefile mphlr.h sqlite-amalgamation-3070900/sqlite3.h sha2.h rhizome.h HDRS= Makefile mphlr.h sqlite-amalgamation-3070900/sqlite3.h sha2.h rhizome.h

1379
rhizome.c

File diff suppressed because it is too large Load Diff

View File

@ -117,7 +117,7 @@ typedef struct rhizome_manifest {
*/ */
unsigned char signatureTypes[MAX_MANIFEST_VARS]; unsigned char signatureTypes[MAX_MANIFEST_VARS];
int signature_errors; /* if non-zero, then manifest should not be trusted */ int errors; /* if non-zero, then manifest should not be trusted */
/* Absolute path of the file associated with the manifest */ /* Absolute path of the file associated with the manifest */
char *dataFileName; char *dataFileName;
@ -162,9 +162,9 @@ int rhizome_write_manifest_file(rhizome_manifest *m,char *filename);
int rhizome_manifest_sign(rhizome_manifest *m); int rhizome_manifest_sign(rhizome_manifest *m);
int rhizome_drop_stored_file(char *id,int maximum_priority); int rhizome_drop_stored_file(char *id,int maximum_priority);
int rhizome_manifest_priority(char *id); int rhizome_manifest_priority(char *id);
rhizome_manifest *rhizome_read_manifest_file(char *filename); rhizome_manifest *rhizome_read_manifest_file(char *filename,int bufferPAndSize,int flags);
int rhizome_hash_file(char *filename,char *hash_out); int rhizome_hash_file(char *filename,char *hash_out);
int rhizome_manifest_get(rhizome_manifest *m,char *var,char *value_out); char *rhizome_manifest_get(rhizome_manifest *m,char *var,char *value_out,int maxlen);
long long rhizome_manifest_get_ll(rhizome_manifest *m,char *var); long long rhizome_manifest_get_ll(rhizome_manifest *m,char *var);
int rhizome_manifest_set_ll(rhizome_manifest *m,char *var,long long value); int rhizome_manifest_set_ll(rhizome_manifest *m,char *var,long long value);
int rhizome_manifest_set(rhizome_manifest *m,char *var,char *value); int rhizome_manifest_set(rhizome_manifest *m,char *var,char *value);
@ -197,3 +197,11 @@ int rhizome_server_sql_query_fill_buffer(int rn,rhizome_http_request *r);
double rhizome_manifest_get_double(rhizome_manifest *m,char *var,double default_value); double rhizome_manifest_get_double(rhizome_manifest *m,char *var,double default_value);
int chartonybl(int c); int chartonybl(int c);
int rhizome_manifest_extract_signature(rhizome_manifest *m,int *ofs); int rhizome_manifest_extract_signature(rhizome_manifest *m,int *ofs);
long long sqlite_exec_int64(char *sqlformat,...);
int rhizome_update_file_priority(char *fileid);
int rhizome_manifest_to_bar(rhizome_manifest *m,unsigned char *bar);
char nybltochar(int n);
int rhizome_queue_manifest_import(rhizome_manifest *m);
#define RHIZOME_DONTVERIFY 0
#define RHIZOME_VERIFY 1

View File

@ -368,7 +368,7 @@ int isOverlayPacket(FILE *f,unsigned char *packet,int *ofs,int len)
indent(12),frame[i+16],frame[i+16]); indent(12),frame[i+16],frame[i+16]);
unsigned long long file_size=0; unsigned long long file_size=0;
for(j=0;j<6;j++) file_size=(file_size<<8)+frame[i+18+j]; for(j=0;j<6;j++) file_size=(file_size<<8)+frame[i+18+j];
fprintf(f,"%sassociated file size = %lld (0x%llx) bytesov\n", fprintf(f,"%sassociated file size = %lld (0x%llx) bytes\n",
indent(12),file_size,file_size); indent(12),file_size,file_size);
double lat0=((frame[i+24]<<8)+frame[i+25])*180/65535-90; double lat0=((frame[i+24]<<8)+frame[i+25])*180/65535-90;
double long0=((frame[i+26]<<8)+frame[i+27])*360/65535-180; double long0=((frame[i+26]<<8)+frame[i+27])*360/65535-180;