Class: DNSSD::Flags
- Inherits:
-
Object
- Object
- DNSSD::Flags
- Defined in:
- ext/rdnssd_structs.c,
ext/rdnssd_structs.c
Overview
Flags used in DNSSD Ruby API.
Constant Summary collapse
- MoreComing =
MoreComing indicates that at least one more result is queued and will be delivered following immediately after this one. Applications should not update their UI to display browse results when the MoreComing flag is set, because this would result in a great deal of ugly flickering on the screen. Applications should instead wait until until MoreComing is not set, and then update their UI. When MoreComing is not set, that doesn’t mean there will be no more answers EVER, just that there are no more answers immediately available right now at this instant. If more answers become available in the future they will be delivered as usual.
ULONG2NUM(kDNSServiceFlagsMoreComing)
- Add =
:Flags::Default applies only to enumeration and is only valid in conjuction with DNSSD::Flags::Add. An enumeration callback with the DNSSD::Flags::Add flag NOT set indicates a DNSSD::Flags::Remove, i.e. the domain is no longer valid.
Flags for domain enumeration and DNSSD.browse() reply callbacks. DNSSD
- Default =
ULONG2NUM(kDNSServiceFlagsDefault)
- NoAutoRename =
:Flags::NoAutoRename overrides this behavior - with this flag set, name conflicts will result in a callback. The NoAutoRename flag is only valid if a name is explicitly specified when registering a service (ie the default name is not used.)
Flag for specifying renaming behavior on name conflict when registering non-shared records. By default, name conflicts are automatically handled by renaming the service. DNSSD
Flag for registering individual records on a connected DNSServiceRef. DNSSD
- Unique =
ULONG2NUM(kDNSServiceFlagsUnique)
- BrowseDomains =
:Flags::BrowseDomains enumerates domains recommended for browsing, DNSSD::Flags::RegistrationDomains enumerates domains recommended for registration.
Flags for specifying domain enumeration type in DNSSD.enumerate_domains() (currently not part of the Ruby API). DNSSD
- RegistrationDomains =
ULONG2NUM(kDNSServiceFlagsRegistrationDomains)
- LongLivedQuery =
Flag for creating a long-lived unicast query for the DNSDS.query_record() (currently not part of the Ruby API).
ULONG2NUM(kDNSServiceFlagsLongLivedQuery)
Instance Method Summary collapse
-
#&(flags2) ⇒ Object
Returns the set of flags included in flags1 and flags2.
-
#==(obj) ⇒ Boolean
Equality–Two sets of flags are equal if they contain the same flags.
-
#clear_flag(f) ⇒ Object
Clear the flag f in flags.
-
#initialize(*args) ⇒ Object
constructor
Returns a new set of flags.
-
#inspect ⇒ String
Create a printable version of flags.
-
#set_flag(f) ⇒ Object
Set the flag f in flags.
-
#to_i ⇒ Integer
Get the integer representation of flags by bitwise or’ing each of the set flags.
-
#|(flags2) ⇒ Object
Returns the set of flags included in flags1 or flags2.
-
#~ ⇒ Object
Returns the set of flags not included in flags.
Constructor Details
#DNSSD::Flags.new ⇒ Object #DNSSD::Flags.new(flag1, flag2, ...) ⇒ Object
Returns a new set of flags. In the first form an empty set of flags is created. In the second a set of flags containing the union of each flag (or set of flags) given is created.
flags = Flags.new()
flags.more_coming = true
flags.to_i #=> DNSSD::Flags::MoreComing
f.shared = true
flags.to_i #=> Flags::MoreComing | Flags::Shared
same_flags = Flags.new(Flags::MoreComing | Flags::Shared)
flags == same_flags #=> true
same_flags_again = Flags.new(Flags::MoreComing, Flags::Shared)
flags == same_flags_again #=> true
155 156 157 158 159 160 161 162 163 164 165 |
# File 'ext/rdnssd_structs.c', line 155
static VALUE
dnssd_flags_initialize(int argc, VALUE *argv, VALUE self)
{
int i;
DNSServiceFlags flags = 0;
for (i=0; i<argc; i++) {
flags |= dnssd_to_flags(argv[i]);
}
return dnssd_flags_init(self, flags);
}
|
Instance Method Details
#&(flags2) ⇒ Object
Returns the set of flags included in flags1 and flags2.
232 233 234 235 236 |
# File 'ext/rdnssd_structs.c', line 232
static VALUE
dnssd_flags_and(VALUE self, VALUE num)
{
return dnssd_flags_new2(CLASS_OF(self), dnssd_get_flags(self) & dnssd_to_flags(num));
}
|
#==(obj) ⇒ Boolean
349 350 351 352 353 354 355 356 |
# File 'ext/rdnssd_structs.c', line 349
static VALUE
dnssd_flags_equal(VALUE self, VALUE obj)
{
DNSServiceFlags flags = dnssd_get_flags(self);
DNSServiceFlags obj_flags = dnssd_to_flags(obj);
return flags == obj_flags ? Qtrue : Qfalse;
}
|
#clear_flag(f) ⇒ Object
Clear the flag f in flags.
flags = Flags.new(Flags::MoreComing) #=> #<DNSSD::Flags more_coming>
flags.clear_flag(Flags::MoreComing) #=> #<DNSSD::Flags>
212 213 214 215 216 217 218 219 220 221 222 |
# File 'ext/rdnssd_structs.c', line 212
static VALUE
dnssd_flags_clear(VALUE self, VALUE num)
{
DNSServiceFlags flags;
VerifyDNSSDFlags(self);
/* flags should stay masked here (see DNSSD_FLAGS_MASK() macro) */
flags = (DNSServiceFlags)RDATA(self)->data;
flags &= ~dnssd_to_flags(num);
RDATA(self)->data = (void*)flags;
return self;
}
|
#inspect ⇒ String
330 331 332 333 334 |
# File 'ext/rdnssd_structs.c', line 330
static VALUE
dnssd_flags_inspect(VALUE self)
{
return dnssd_struct_inspect(self, dnssd_flags_list(self));
}
|
#set_flag(f) ⇒ Object
Set the flag f in flags.
flags = Flags.new() #=> #<DNSSD::Flags>
flags.set_flag(Flags::MoreComing) #=> #<DNSSD::Flags more_coming>
190 191 192 193 194 195 196 197 198 199 |
# File 'ext/rdnssd_structs.c', line 190
static VALUE
dnssd_flags_set(VALUE self, VALUE num)
{
DNSServiceFlags flags;
VerifyDNSSDFlags(self);
flags = (DNSServiceFlags)RDATA(self)->data;
flags |= dnssd_to_flags(num);
RDATA(self)->data = (void*)flags;
return self;
}
|
#to_i ⇒ Integer
Get the integer representation of flags by bitwise or’ing each of the set flags.
276 277 278 279 280 |
# File 'ext/rdnssd_structs.c', line 276
static VALUE
dnssd_flags_to_i(VALUE self)
{
return ULONG2NUM(dnssd_get_flags(self));
}
|
#|(flags2) ⇒ Object
Returns the set of flags included in flags1 or flags2.
246 247 248 249 250 |
# File 'ext/rdnssd_structs.c', line 246
static VALUE
dnssd_flags_or(VALUE self, VALUE num)
{
return dnssd_flags_new2(CLASS_OF(self), dnssd_get_flags(self) | dnssd_to_flags(num));
}
|
#~ ⇒ Object
Returns the set of flags not included in flags.
260 261 262 263 264 265 |
# File 'ext/rdnssd_structs.c', line 260
static VALUE
dnssd_flags_not(VALUE self)
{
/* doesn't totally make sence to return a set of flags here... */
return dnssd_flags_new2(CLASS_OF(self), ~dnssd_get_flags(self));
}
|