Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename SessionManager to SessionTable
  • Loading branch information
cjdelisle committed Feb 14, 2015
1 parent 98814fd commit 50d8c44
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 126 deletions.
4 changes: 2 additions & 2 deletions admin/angel/Core.c
Expand Up @@ -75,7 +75,7 @@
#include "util/Security_admin.h"
#include "util/Security.h"
#include "util/version/Version.h"
#include "interface/SessionManager_admin.h"
#include "net/SessionTable_admin.h"
#include "wire/SwitchHeader.h"
#include "wire/CryptoHeader.h"

Expand Down Expand Up @@ -472,7 +472,7 @@ void Core_init(struct Allocator* alloc,
// Core_admin_register(myAddr, dtAAAAAAAAAAAAAA, logger, ipTun, alloc, admin, eventBase);
Security_admin_register(alloc, logger, admin);
IpTunnel_admin_register(ipTun, admin, alloc);
// SessionManager_admin_register(dtAAAAAAAAAAAAAA->sessionManager, admin, alloc);
// SessionTable_admin_register(dtAAAAAAAAAAAAAA->sessionTable, admin, alloc);
RainflyClient_admin_register(rainfly, admin, alloc);
Allocator_admin_register(alloc, admin);

Expand Down
28 changes: 14 additions & 14 deletions net/BalingWire.c
Expand Up @@ -49,7 +49,7 @@ struct BalingWire_pvt
struct EventBase* eventBase;

/** global crap about the "active message" (Passing data around cryptoAuth) */
struct SessionManager_Session* currentSession;
struct SessionTable_Session* currentSession;
bool currentMessageSetup;
struct SwitchHeader* currentSwitchHeader;

Expand Down Expand Up @@ -80,7 +80,7 @@ static uint8_t incomingFromSwitchPostCryptoAuth(struct Message* msg, struct Inte
{
struct BalingWire_pvt* bw = Identity_check((struct BalingWire_pvt*) iface->receiverContext);

struct SessionManager_Session* session = bw->currentSession;
struct SessionTable_Session* session = bw->currentSession;
struct SwitchHeader* sh = bw->currentSwitchHeader;
bw->currentSession = NULL;
bw->currentSwitchHeader = NULL;
Expand Down Expand Up @@ -135,11 +135,11 @@ static int incomingFromSwitchIf(struct Interface_Two* iface, struct Message* msg
struct SwitchHeader* switchHeader = (struct SwitchHeader*) msg->bytes;
Message_shift(msg, -SwitchHeader_SIZE, NULL);

struct SessionManager_Session* session;
struct SessionTable_Session* session;
uint32_t nonceOrHandle = Endian_bigEndianToHost32(((uint32_t*)msg->bytes)[0]);
if (nonceOrHandle > 3) {
// > 3 it's a handle.
session = SessionManager_sessionForHandle(nonceOrHandle, bw->pub.sessionManager);
session = SessionTable_sessionForHandle(nonceOrHandle, bw->pub.sessionTable);
if (!session) {
Log_debug(bw->log, "DROP message with unrecognized handle");
return 0;
Expand All @@ -165,7 +165,7 @@ static int incomingFromSwitchIf(struct Interface_Two* iface, struct Message* msg
return 0;
}

session = SessionManager_getSession(ip6, herKey, bw->pub.sessionManager);
session = SessionTable_getSession(ip6, herKey, bw->pub.sessionTable);

debugHandlesAndLabel(bw->log, session,
Endian_bigEndianToHost64(switchHeader->label_be),
Expand Down Expand Up @@ -257,7 +257,7 @@ static uint8_t readyToSendPostCryptoAuth(struct Message* msg, struct Interface*
{
struct BalingWire_pvt* bw = Identity_check((struct BalingWire_pvt*) iface->senderContext);
struct SwitchHeader* sh = bw->currentSwitchHeader;
struct SessionManager_Session* sess = bw->currentSession;
struct SessionTable_Session* sess = bw->currentSession;
bw->currentSession = NULL;
bw->currentSwitchHeader = NULL;
if (CryptoAuth_getState(sess->internal) >= CryptoAuth_HANDSHAKE3) {
Expand All @@ -283,7 +283,7 @@ static uint8_t readyToSendPostCryptoAuth(struct Message* msg, struct Interface*
}

static int readyToSend(struct BalingWire_pvt* bw,
struct SessionManager_Session* sess,
struct SessionTable_Session* sess,
struct Message* msg)
{
struct BalingWire_InsideHeader* header = (struct BalingWire_InsideHeader*) msg->bytes;
Expand Down Expand Up @@ -320,12 +320,12 @@ static int incomingFromInsideIf(struct Interface_Two* iface, struct Message* msg
Assert_true(msg->length >= BalingWire_InsideHeader_SIZE);
struct BalingWire_InsideHeader* header = (struct BalingWire_InsideHeader*) msg->bytes;

struct SessionManager_Session* sess =
SessionManager_sessionForIp6(header->ip6, bw->pub.sessionManager);
struct SessionTable_Session* sess =
SessionTable_sessionForIp6(header->ip6, bw->pub.sessionTable);
if (!sess) {
if (!Bits_isZero(header->publicKey, 32)) {
sess =
SessionManager_getSession(header->ip6, header->publicKey, bw->pub.sessionManager);
SessionTable_getSession(header->ip6, header->publicKey, bw->pub.sessionTable);
} else {
return needsLookup(bw, msg);
}
Expand Down Expand Up @@ -382,16 +382,16 @@ static int incomingFromEventIf(struct Interface_Two* iface, struct Message* msg)
int index = Map_BufferedMessages_indexForKey(&ip6, &bw->bufMap);

if (ev == Event_DISCOVERY) {
struct SessionManager_Session* sess;
struct SessionTable_Session* sess;
if (index == -1) {
sess = SessionManager_sessionForIp6(ip6.bytes, bw->pub.sessionManager);
sess = SessionTable_sessionForIp6(ip6.bytes, bw->pub.sessionTable);
// If we discovered a node we're not interested in ...
if (!sess) { return 0; }
Message_pop(msg, NULL, 32, NULL);
} else {
uint8_t publicKey[32];
Message_pop(msg, publicKey, 32, NULL);
sess = SessionManager_getSession(ip6.bytes, publicKey, bw->pub.sessionManager);
sess = SessionTable_getSession(ip6.bytes, publicKey, bw->pub.sessionTable);
}

uint64_t path = Message_pop64(msg, NULL);
Expand Down Expand Up @@ -472,7 +472,7 @@ struct BalingWire* BalingWire_new(struct Allocator* alloc,
EventEmitter_regIface(ee, &bw->eventIf, Event_SEARCH_BEGIN);
EventEmitter_regIface(ee, &bw->eventIf, Event_SEARCH_END);

bw->pub.sessionManager = SessionManager_new(incomingFromSwitchPostCryptoAuth,
bw->pub.sessionTable = SessionTable_new(incomingFromSwitchPostCryptoAuth,
readyToSendPostCryptoAuth,
bw,
eventBase,
Expand Down
4 changes: 2 additions & 2 deletions net/BalingWire.h
Expand Up @@ -16,7 +16,7 @@
#define BalingWire_H

#include "interface/Interface.h"
#include "interface/SessionManager.h"
#include "net/SessionTable.h"
#include "memory/Allocator.h"
#include "net/Event.h"
#include "net/EventEmitter.h"
Expand Down Expand Up @@ -51,7 +51,7 @@ struct BalingWire
*/
struct Interface_Two insideIf;

struct SessionManager* sessionManager;
struct SessionTable* sessionTable;

/**
* Maximum number of packets to hold in buffer before summarily dropping...
Expand Down
6 changes: 3 additions & 3 deletions net/ConverterV15.c
Expand Up @@ -28,7 +28,7 @@
struct ConverterV15_pvt
{
struct ConverterV15 pub;
struct SessionManager* sm;
struct SessionTable* sm;
uint8_t myIp6[16];
struct Log* log;
Identity
Expand All @@ -47,7 +47,7 @@ static int incomingFromUpperDistributorIf(struct Interface_Two* upperDistributor
Assert_true(msg->length >= DataHeader_SIZE + BalingWire_InsideHeader_SIZE);

struct BalingWire_InsideHeader* hdr = (struct BalingWire_InsideHeader*) msg->bytes;
struct SessionManager_Session* sess = SessionManager_sessionForIp6(hdr->ip6, conv->sm);
struct SessionTable_Session* sess = SessionTable_sessionForIp6(hdr->ip6, conv->sm);
if (!hdr->version && (!sess->version || sess->version > 15)) {
// If nothing is known about a node, fuckit, assume it's new !
return Interface_send(&conv->pub.balingWireIf, msg);
Expand Down Expand Up @@ -206,7 +206,7 @@ static int incomingFromBalingWireIf(struct Interface_Two* balingWireIf, struct M

struct ConverterV15* ConverterV15_new(struct Allocator* alloc,
struct Log* log,
struct SessionManager* sm,
struct SessionTable* sm,
uint8_t myIp6[16])
{
struct ConverterV15_pvt* out = Allocator_calloc(alloc, sizeof(struct ConverterV15_pvt), 1);
Expand Down
4 changes: 2 additions & 2 deletions net/ConverterV15.h
Expand Up @@ -17,7 +17,7 @@

#include "interface/Interface.h"
#include "memory/Allocator.h"
#include "interface/SessionManager.h"
#include "net/SessionTable.h"
#include "util/log/Log.h"
#include "util/Linker.h"
Linker_require("net/ConverterV15.c")
Expand All @@ -37,7 +37,7 @@ struct ConverterV15

struct ConverterV15* ConverterV15_new(struct Allocator* alloc,
struct Log* log,
struct SessionManager* sm,
struct SessionTable* sm,
uint8_t myIp6[16]);

#endif

0 comments on commit 50d8c44

Please sign in to comment.