データ構造 | |
struct | unexpected_key |
関数 | |
void | unexpected_packet (struct packet_struct *p) |
static int | traverse_fn (TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) |
void | clear_unexpected (time_t t) |
static int | traverse_match (TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) |
packet_struct * | receive_unexpected (enum packet_type packet_type, int id, const char *mailslot_name) |
変数 | |
static TDB_CONTEXT * | tdbd = NULL |
static time_t | lastt |
static struct packet_struct * | matched_packet |
static int | match_id |
static enum packet_type | match_type |
static const char * | match_name |
void unexpected_packet | ( | struct packet_struct * | p | ) |
unexpected.c の 40 行で定義されています。
参照先 buf・build_packet()・unexpected_key::count・TDB_DATA::dptr・TDB_DATA::dsize・len・lock_path()・packet_struct::packet_type・unexpected_key::packet_type・tdb_open_log()・tdb_store()・tdbd・packet_struct::timestamp・unexpected_key::timestamp.
参照元 find_subnet_for_nmb_packet()・process_dgram().
00041 { 00042 static int count; 00043 TDB_DATA kbuf, dbuf; 00044 struct unexpected_key key; 00045 char buf[1024]; 00046 int len=0; 00047 00048 if (!tdbd) { 00049 tdbd = tdb_open_log(lock_path("unexpected.tdb"), 0, 00050 TDB_CLEAR_IF_FIRST|TDB_DEFAULT, 00051 O_RDWR | O_CREAT, 0644); 00052 if (!tdbd) { 00053 DEBUG(0,("Failed to open unexpected.tdb\n")); 00054 return; 00055 } 00056 } 00057 00058 memset(buf,'\0',sizeof(buf)); 00059 00060 len = build_packet(buf, p); 00061 00062 ZERO_STRUCT(key); /* needed for potential alignment */ 00063 00064 key.packet_type = p->packet_type; 00065 key.timestamp = p->timestamp; 00066 key.count = count++; 00067 00068 kbuf.dptr = (char *)&key; 00069 kbuf.dsize = sizeof(key); 00070 dbuf.dptr = buf; 00071 dbuf.dsize = len; 00072 00073 tdb_store(tdbd, kbuf, dbuf, TDB_REPLACE); 00074 }
static int traverse_fn | ( | TDB_CONTEXT * | ttdb, | |
TDB_DATA | kbuf, | |||
TDB_DATA | dbuf, | |||
void * | state | |||
) | [static] |
unexpected.c の 82 行で定義されています。
参照先 TDB_DATA::dptr・TDB_DATA::dsize・lastt・tdb_delete().
00083 { 00084 struct unexpected_key key; 00085 00086 if (kbuf.dsize != sizeof(key)) { 00087 tdb_delete(ttdb, kbuf); 00088 } 00089 00090 memcpy(&key, kbuf.dptr, sizeof(key)); 00091 00092 if (lastt - key.timestamp > NMBD_UNEXPECTED_TIMEOUT) { 00093 tdb_delete(ttdb, kbuf); 00094 } 00095 00096 return 0; 00097 }
void clear_unexpected | ( | time_t | t | ) |
unexpected.c の 103 行で定義されています。
参照先 lastt・tdb_traverse()・tdbd・traverse_fn().
参照元 process().
00104 { 00105 if (!tdbd) return; 00106 00107 if ((lastt != 0) && (t < lastt + NMBD_UNEXPECTED_TIMEOUT)) 00108 return; 00109 00110 lastt = t; 00111 00112 tdb_traverse(tdbd, traverse_fn, NULL); 00113 }
static int traverse_match | ( | TDB_CONTEXT * | ttdb, | |
TDB_DATA | kbuf, | |||
TDB_DATA | dbuf, | |||
void * | state | |||
) | [static] |
unexpected.c の 124 行で定義されています。
参照先 DGRAM_PACKET・TDB_DATA::dptr・TDB_DATA::dsize・free_packet()・nmb_packet::header・match_id・match_mailslot_name()・match_name・match_type・matched_packet・nmb_packet::name_trn_id・packet_struct::nmb・NMB_PACKET・packet_struct::packet・parse_packet().
参照元 receive_unexpected().
00125 { 00126 struct unexpected_key key; 00127 struct packet_struct *p; 00128 00129 if (kbuf.dsize != sizeof(key)) { 00130 return 0; 00131 } 00132 00133 memcpy(&key, kbuf.dptr, sizeof(key)); 00134 00135 if (key.packet_type != match_type) return 0; 00136 00137 p = parse_packet(dbuf.dptr, dbuf.dsize, match_type); 00138 00139 if ((match_type == NMB_PACKET && 00140 p->packet.nmb.header.name_trn_id == match_id) || 00141 (match_type == DGRAM_PACKET && 00142 match_mailslot_name(p, match_name))) { 00143 matched_packet = p; 00144 return -1; 00145 } 00146 00147 free_packet(p); 00148 00149 return 0; 00150 }
struct packet_struct* receive_unexpected | ( | enum packet_type | packet_type, | |
int | id, | |||
const char * | mailslot_name | |||
) |
unexpected.c の 156 行で定義されています。
参照先 lock_path()・match_id・match_name・match_type・matched_packet・tdb_close()・tdb_open_log()・tdb_traverse()・traverse_match().
参照元 cli_get_response()・receive_dgram_packet()・receive_getdc_response()・receive_nmb_packet().
00158 { 00159 TDB_CONTEXT *tdb2; 00160 00161 tdb2 = tdb_open_log(lock_path("unexpected.tdb"), 0, 0, O_RDONLY, 0); 00162 if (!tdb2) return NULL; 00163 00164 matched_packet = NULL; 00165 match_id = id; 00166 match_type = packet_type; 00167 match_name = mailslot_name; 00168 00169 tdb_traverse(tdb2, traverse_match, NULL); 00170 00171 tdb_close(tdb2); 00172 00173 return matched_packet; 00174 }
TDB_CONTEXT* tdbd = NULL [static] |
time_t lastt [static] |
struct packet_struct* matched_packet [static] |
int match_id [static] |
enum packet_type match_type [static] |
const char* match_name [static] |