nmbd/nmbd_mynames.c

ソースコードを見る。

関数

static void my_name_register_failed (struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *nmbname)
void register_my_workgroup_one_subnet (struct subnet_record *subrec)
static void insert_refresh_name_into_unicast (struct subnet_record *subrec, struct nmb_name *nmbname, uint16 nb_type)
BOOL register_my_workgroup_and_names (void)
void release_wins_names (void)
void refresh_my_names (time_t t)

変数

uint16 samba_nb_type


関数

static void my_name_register_failed ( struct subnet_record subrec,
struct response_record rrec,
struct nmb_name nmbname 
) [static]

nmbd_mynames.c32 行で定義されています。

参照先 nmb_namestr()subnet_record::subnet_name.

参照元 register_my_workgroup_one_subnet().

00034 {
00035         DEBUG(0,("my_name_register_failed: Failed to register my name %s on subnet %s.\n",
00036                 nmb_namestr(nmbname), subrec->subnet_name));
00037 }

void register_my_workgroup_one_subnet ( struct subnet_record subrec  ) 

nmbd_mynames.c45 行で定義されています。

参照先 add_samba_names_to_subnet()create_workgroup_on_subnet()initiate_myworkgroup_startup()lp_workgroup()my_name_register_failed()my_netbios_names()register_name()samba_nb_typesubnet_record::subnet_name.

参照元 register_my_workgroup_and_names()reload_interfaces().

00046 {
00047         int i;
00048 
00049         struct work_record *work;
00050 
00051         /* Create the workgroup on the subnet. */
00052         if((work = create_workgroup_on_subnet(subrec, lp_workgroup(), 
00053                                               PERMANENT_TTL)) == NULL) {
00054                 DEBUG(0,("register_my_workgroup_and_names: Failed to create my workgroup %s on subnet %s. \
00055 Exiting.\n", lp_workgroup(), subrec->subnet_name));
00056                 return;
00057         }
00058 
00059         /* Each subnet entry, except for the wins_server_subnet has
00060            the magic Samba names. */
00061         add_samba_names_to_subnet(subrec);
00062 
00063         /* Register all our names including aliases. */
00064         for (i=0; my_netbios_names(i); i++) {
00065                 register_name(subrec, my_netbios_names(i),0x20,samba_nb_type,
00066                               NULL,
00067                               my_name_register_failed, NULL);
00068                 register_name(subrec, my_netbios_names(i),0x03,samba_nb_type,
00069                               NULL,
00070                               my_name_register_failed, NULL);
00071                 register_name(subrec, my_netbios_names(i),0x00,samba_nb_type,
00072                               NULL,
00073                               my_name_register_failed, NULL);
00074         }
00075         
00076         /* Initiate election processing, register the workgroup names etc. */
00077         initiate_myworkgroup_startup(subrec, work);
00078 }

static void insert_refresh_name_into_unicast ( struct subnet_record subrec,
struct nmb_name nmbname,
uint16  nb_type 
) [static]

nmbd_mynames.c85 行で定義されています。

参照先 add_ip_to_name_record()add_name_to_subnet()find_name_on_subnet()insert_permanent_name_into_unicast()subnet_record::myipnmb_name::namenamenmb_name::name_typepull_ascii_nstring()SELF_NAMEunicast_subnetwe_are_a_wins_client().

参照元 register_my_workgroup_and_names().

00087 {
00088         struct name_record *namerec;
00089 
00090         if (!we_are_a_wins_client()) {
00091                 insert_permanent_name_into_unicast(subrec, nmbname, nb_type);
00092                 return;
00093         }
00094 
00095         if((namerec = find_name_on_subnet(unicast_subnet, nmbname, FIND_SELF_NAME)) == NULL) {
00096                 unstring name;
00097                 pull_ascii_nstring(name, sizeof(name), nmbname->name);
00098                 /* The name needs to be created on the unicast subnet. */
00099                 (void)add_name_to_subnet( unicast_subnet, name,
00100                                 nmbname->name_type, nb_type,
00101                                 MIN(lp_max_ttl(), MAX_REFRESH_TIME), SELF_NAME, 1, &subrec->myip);
00102         } else {
00103                 /* The name already exists on the unicast subnet. Add our local
00104                         IP for the given broadcast subnet to the name. */
00105                 add_ip_to_name_record( namerec, subrec->myip);
00106         }
00107 }

BOOL register_my_workgroup_and_names ( void   ) 

nmbd_mynames.c114 行で定義されています。

参照先 add_samba_names_to_subnet()insert_refresh_name_into_unicast()lp_workgroup()make_nmb_name()my_netbios_names()register_my_workgroup_one_subnet()remote_broadcast_subnetsamba_nb_typeunicast_subnet.

参照元 main().

00115 {
00116         struct subnet_record *subrec;
00117         int i;
00118 
00119         for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) {
00120                 register_my_workgroup_one_subnet(subrec);
00121         }
00122 
00123         /* We still need to add the magic Samba
00124                 names and the netbios names to the unicast subnet directly. This is
00125                 to allow unicast node status requests and queries to still work
00126                 in a broadcast only environment. */
00127 
00128         add_samba_names_to_subnet(unicast_subnet);
00129 
00130         for (i=0; my_netbios_names(i); i++) {
00131                 for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
00132                         /*
00133                          * Ensure all the IP addresses are added if we are multihomed.
00134                          */
00135                         struct nmb_name nmbname;
00136 
00137                         make_nmb_name(&nmbname, my_netbios_names(i),0x20);
00138                         insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
00139 
00140                         make_nmb_name(&nmbname, my_netbios_names(i),0x3);
00141                         insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
00142 
00143                         make_nmb_name(&nmbname, my_netbios_names(i),0x0);
00144                         insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
00145                 }
00146         }
00147 
00148         /*
00149          * Add the WORKGROUP<0> and WORKGROUP<1e> group names to the unicast subnet
00150          * also for the same reasons.
00151          */
00152 
00153         for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
00154                 /*
00155                  * Ensure all the IP addresses are added if we are multihomed.
00156                  */
00157                 struct nmb_name nmbname;
00158 
00159                 make_nmb_name(&nmbname, lp_workgroup(), 0x0);
00160                 insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
00161 
00162                 make_nmb_name(&nmbname, lp_workgroup(), 0x1e);
00163                 insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
00164         }
00165 
00166         /*
00167          * We need to add the Samba names to the remote broadcast subnet,
00168          * as NT 4.x does directed broadcast requests to the *<0x0> name.
00169          */
00170 
00171         add_samba_names_to_subnet(remote_broadcast_subnet);
00172 
00173         return True;
00174 }

void release_wins_names ( void   ) 

nmbd_mynames.c180 行で定義されています。

参照先 name_record::datasubnet_record::namelistname_record::nextrelease_name()SELF_NAMEnmb_data::sourcestandard_success_release()unicast_subnet.

参照元 terminate().

00181 {
00182         struct subnet_record *subrec = unicast_subnet;
00183         struct name_record *namerec, *nextnamerec;
00184 
00185         for (namerec = subrec->namelist; namerec; namerec = nextnamerec) {
00186                 nextnamerec = namerec->next;
00187                 if( (namerec->data.source == SELF_NAME)
00188                     && !NAME_IS_DEREGISTERING(namerec) )
00189                         release_name( subrec, namerec, standard_success_release,
00190                                       NULL, NULL);
00191         }
00192 }

void refresh_my_names ( time_t  t  ) 

nmbd_mynames.c198 行で定義されています。

参照先 name_record::datanmb_data::death_timeis_refresh_already_queued()subnet_record::namelistname_record::nextnmb_data::refresh_timeSELF_NAMEnmb_data::sourceunicast_subnetwins_refresh_name()wins_srv_count().

参照元 process().

00199 {
00200         struct name_record *namerec;
00201 
00202         if (wins_srv_count() < 1)
00203                 return;
00204 
00205         for (namerec = unicast_subnet->namelist; namerec; namerec = namerec->next) {
00206                 /* Each SELF name has an individual time to be refreshed. */
00207                 if ((namerec->data.source == SELF_NAME) &&
00208                     (namerec->data.refresh_time < t) &&
00209                     (namerec->data.death_time != PERMANENT_TTL)) {
00210                         /* We cheat here and pretend the refresh is going to be
00211                            successful & update the refresh times. This stops
00212                            multiple refresh calls being done. We actually
00213                            deal with refresh failure in the fail_fn.
00214                         */
00215                         if (!is_refresh_already_queued(unicast_subnet, namerec)) {
00216                                 wins_refresh_name(namerec);
00217                         }
00218                         namerec->data.death_time = t + lp_max_ttl();
00219                         namerec->data.refresh_time = t + MIN(lp_max_ttl()/2, MAX_REFRESH_TIME);
00220                 }
00221         }
00222 }


変数

uint16 samba_nb_type

nmbd_namelistdb.c26 行で定義されています。


Sambaに対してSat Aug 29 21:23:53 2009に生成されました。  doxygen 1.4.7