📄 nameserv.h
字号:
typedef void (*response_function)(struct subnet_record *, struct response_record *, struct packet_struct *);/* typedef to define the function called when this response record times out. */typedef void (*timeout_response_function)(struct subnet_record *, struct response_record *);/* typedef to define the function called when the request that caused this response record to be created is successful. */typedef void (*success_function)(struct subnet_record *, struct userdata_struct *, ...);/* typedef to define the function called when the request that caused this response record to be created is unsuccessful. */typedef void (*fail_function)(struct subnet_record *, struct response_record *, ...);/* List of typedefs for success and fail functions of the different query types. Used to catch any compile time prototype errors. */typedef void (*register_name_success_function)( struct subnet_record *, struct userdata_struct *, struct nmb_name *, uint16, int, struct in_addr);typedef void (*register_name_fail_function)( struct subnet_record *, struct response_record *, struct nmb_name *);typedef void (*release_name_success_function)( struct subnet_record *, struct userdata_struct *, struct nmb_name *, struct in_addr);typedef void (*release_name_fail_function)( struct subnet_record *, struct response_record *, struct nmb_name *);typedef void (*refresh_name_success_function)( struct subnet_record *, struct userdata_struct *, struct nmb_name *, uint16, int, struct in_addr);typedef void (*refresh_name_fail_function)( struct subnet_record *, struct response_record *, struct nmb_name *);typedef void (*query_name_success_function)( struct subnet_record *, struct userdata_struct *, struct nmb_name *, struct in_addr, struct res_rec *answers);typedef void (*query_name_fail_function)( struct subnet_record *, struct response_record *, struct nmb_name *, int); typedef void (*node_status_success_function)( struct subnet_record *, struct userdata_struct *, struct res_rec *, struct in_addr);typedef void (*node_status_fail_function)( struct subnet_record *, struct response_record *);/* Initiated name queries are recorded in this list to track any responses. */struct response_record{ struct response_record *next; struct response_record *prev; uint16 response_id; /* Callbacks for packets received or not. */ response_function resp_fn; timeout_response_function timeout_fn; /* Callbacks for the request succeeding or not. */ success_function success_fn; fail_function fail_fn; struct packet_struct *packet; struct userdata_struct *userdata; int num_msgs; time_t repeat_time; time_t repeat_interval; int repeat_count; /* Recursion protection. */ BOOL in_expiration_processing;};/* A subnet structure. It contains a list of workgroups and netbios names. *//* B nodes will have their own, totally separate subnet record, with their own netbios name set. These do NOT interact with other subnet records' netbios names.*/enum subnet_type { NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */ UNICAST_SUBNET = 1, /* Subnet for unicast packets. */ REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */ WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */};/* A resource record. */struct res_rec { struct nmb_name rr_name; int rr_type; int rr_class; int ttl; int rdlength; char rdata[MAX_DGRAM_SIZE];};/* An nmb packet. */struct nmb_packet{ struct { int name_trn_id; int opcode; BOOL response; struct { BOOL bcast; BOOL recursion_available; BOOL recursion_desired; BOOL trunc; BOOL authoritative; } nm_flags; int rcode; int qdcount; int ancount; int nscount; int arcount; } header; struct { struct nmb_name question_name; int question_type; int question_class; } question; struct res_rec *answers; struct res_rec *nsrecs; struct res_rec *additional;};/* A datagram - this normally contains SMB data in the data[] array. */struct dgram_packet { struct { int msg_type; struct { enum node_type node_type; BOOL first; BOOL more; } flags; int dgm_id; struct in_addr source_ip; int source_port; int dgm_length; int packet_offset; } header; struct nmb_name source_name; struct nmb_name dest_name; int datasize; char data[MAX_DGRAM_SIZE];};/* Define a structure used to queue packets. This will be a linked list of nmb packets. */struct packet_struct{ struct packet_struct *next; struct packet_struct *prev; BOOL locked; struct in_addr ip; int port; int fd; time_t timestamp; enum packet_type packet_type; union { struct nmb_packet nmb; struct dgram_packet dgram; } packet;};/* NETLOGON opcodes */#define QUERYFORPDC 7 /* Query for PDC. */#define QUERYFORPDC_R 12 /* Response to Query for PDC. */#define SAMLOGON 18#define SAMLOGON_R 19/* Ids for netbios packet types. */#define ANN_HostAnnouncement 1#define ANN_AnnouncementRequest 2#define ANN_Election 8#define ANN_GetBackupListReq 9#define ANN_GetBackupListResp 10#define ANN_BecomeBackup 11#define ANN_DomainAnnouncement 12#define ANN_MasterAnnouncement 13#define ANN_ResetBrowserState 14#define ANN_LocalMasterAnnouncement 15/* Broadcast packet announcement intervals, in minutes. *//* Attempt to add domain logon and domain master names. */#define CHECK_TIME_ADD_DOM_NAMES 5 /* Search for master browsers of workgroups samba knows about, except default. */#define CHECK_TIME_MST_BROWSE 5 /* Request backup browser announcements from other servers. */#define CHECK_TIME_ANNOUNCE_BACKUP 15/* Request host announcements from other servers: min and max of interval. */#define CHECK_TIME_MIN_HOST_ANNCE 3#define CHECK_TIME_MAX_HOST_ANNCE 12/* Announce as master to WINS server and any Primary Domain Controllers. */#define CHECK_TIME_MST_ANNOUNCE 15/* Time between syncs from domain master browser to local master browsers. */#define CHECK_TIME_DMB_TO_LMB_SYNC 15/* Do all remote announcements this often. */#define REMOTE_ANNOUNCE_INTERVAL 180/* what is the maximum period between name refreshes. Note that this only affects non-permanent self names (in seconds) */#define MAX_REFRESH_TIME (60*20)/* Macro's to enumerate subnets either with or without the UNICAST subnet. */extern struct subnet_record *subnetlist;extern struct subnet_record *unicast_subnet;extern struct subnet_record *wins_server_subnet;extern struct subnet_record *remote_broadcast_subnet;#define FIRST_SUBNET subnetlist#define NEXT_SUBNET_EXCLUDING_UNICAST(x) ((x)->next)#define NEXT_SUBNET_INCLUDING_UNICAST(x) (get_next_subnet_maybe_unicast((x)))/* To be removed. */enum state_type { TEST };#endif /* _NAMESERV_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -