`Page 1/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`+++++¬
`…
`¬2
`$Id: ipv4.c,v 1.1 2001/08/31 00:46:55 davidc Exp $¬
`3
`¬4
`Copyright (c) 2001 BeComm Corporation¬
`5
`¬6
`Filename:¬
`7
`¬8
` ipv4.c¬
`9
`¬10
`Abstract:¬
`11
`¬12
` This file contains an implementation of IP v.4 network address¬
`13
` class.¬
`14
`¬15
`Owner:¬
`16
`¬17
` David Costanzo (davidc)¬
`18
`¬19
`--------------------------------------------------------------------------
`20
`---*/¬
`…
`¬21
`#define SOS_DEBUG_ZONE "/classes/ipv4"¬
`22
`#include <sosstrings.h>¬
`23
`¬24
`#include <sosinamespace.h>¬
`25
`#include <sosicompare.h>¬
`26
`¬27
`SOS_SOURCE_VERSION("$Id: ipv4.c,v 1.1 2001/08/31 00:46:55 davidc Exp $");¬
`28
`¬29
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`30
`+++++¬
`…
`Macros¬
`31
`--------------------------------------------------------------------------
`32
`---*/¬
`…
`#define IPV4_CLASS_NAME "ipv4"¬
`33
`#define IP_SCHEME_NAME "ip"¬
`34
`#define IPV4_SCHEME_NAME "ipv4"¬
`35
`¬36
`#define RESOLVE(O) SOS_REGOBJECT_RESOLVE(O,g_IpV4Class)¬
`37
`#define VALIDATE(O) SOS_REGOBJECT_VALIDATE(O,g_IpV4Class)¬
`38
`#define ISVALID(O) SOS_REGOBJECT_ISVALID(O,g_IpV4Class)¬
`39
`#define IRESOLVE(I) SOS_INTERFACE_RESOLVE(I,g_IpV4Class)¬
`40
`#define IISVALID(I) SOS_INTERFACE_ISVALID(I,g_IpV4Class)¬
`41
`
`Page 1 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 2/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`¬42
`#define ASSERT_IPV4_CONTEXT_INVARIANT(CONTEXT) \¬
`43
` SOS_ASSERT_ASSUMPTION( \¬
`44
` IpV4_ContextInvariant(CONTEXT), \¬
`45
` "IPv4 context invariant failed\n")¬
`46
`¬47
`¬48
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`49
`+++++¬
`…
`globals¬
`50
`--------------------------------------------------------------------------
`51
`---*/¬
`…
`¬52
`static SOS_REGOBJECTCLASS * g_IpV4Class = NULL;¬
`53
`¬54
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`55
`+++++¬
`…
`types¬
`56
`--------------------------------------------------------------------------
`57
`---*/¬
`…
`¬58
`typedef struct _IPV4_CONTEXT IPV4_CONTEXT;¬
`59
`¬60
`struct _IPV4_CONTEXT {¬
`61
` SOS_UINT32 Address;¬
`62
` SOS_UINT32 SubnetMask;¬
`63
`};¬
`64
`¬65
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`66
`+++++¬
`…
`helpers¬
`67
`--------------------------------------------------------------------------
`68
`---*/¬
`…
`¬69
`#ifdef DEBUG¬
`70
`¬71
`static¬
`72
`SOS_BOOLEAN¬
`73
`IpV4_ContextInvariant(¬
`74
` const IPV4_CONTEXT* IpV4Context¬
`75
`)¬
`76
`{¬
`77
` SOS_BOOLEAN isValid;¬
`78
`¬79
` if (IpV4Context != NULL) {¬
`80
`
`Page 2 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 3/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`¬81
` if ((IpV4Context->Address & ~IpV4Context->SubnetMask) == 0) { ¬
`82
` isValid = SOS_True;¬
`83
` }¬
`84
` else {¬
`85
` isValid = SOS_False;¬
`86
` }¬
`87
` }¬
`88
` else {¬
`89
` isValid = SOS_False;¬
`90
` }¬
`91
`¬92
` return isValid;¬
`93
`}¬
`94
`#endif¬
`95
`¬96
`¬97
`static¬
`98
`void¬
`99
`IpV4_ContextDestroy(¬
`100
` IPV4_CONTEXT* IpV4Context¬
`101
`)¬
`102
`{¬
`103
` SOS_ASSERT_ASSUMPTION(¬
`104
` IpV4Context == NULL || IpV4_ContextInvariant(IpV4Context),¬
`105
` "Destroying invalid IpV4Context");¬
`106
`¬
`107
` SOS_Mem_Free(IpV4Context);¬
`108
`}¬
`109
`¬
`110
`¬
`111
`static¬
`112
`SOS_STATUS¬
`113
`IpV4_ContextInitialize(¬
`114
` IPV4_CONTEXT* IpV4Context,¬
`115
` SOS_UINT32 Address,¬
`116
` SOS_UINT32 MaskExponent¬
`117
`)¬
`118
`{¬
`119
` SOS_STATUS status;¬
`120
`¬
`121
` if (MaskExponent <= 32) {¬
`122
`¬
`123
` IpV4Context->SubnetMask = (SOS_UINT32) 0xFFFFFFFF << (32 -
`124
`MaskExponent);¬
`…
`
`Page 3 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 4/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`125
`126
`127
`128
`129
`130
`131
`132
`133
`134
`135
`136
`137
`138
`139
`140
`141
`142
`143
`144
`145
`146
`147
`148
`149
`150
`151
`152
`153
`154
`155
`156
`157
`…
`158
`159
`160
`161
`162
`163
`164
`165
`166
`167
`168
`
` IpV4Context->Address = IpV4Context->SubnetMask & Address;¬
`¬
` ASSERT_IPV4_CONTEXT_INVARIANT(IpV4Context);¬
`¬
` status = SOS_Success; ¬
` }¬
` else {¬
` status = SOS_ErrorParameter;¬
` }¬
`¬
` return status;¬
`}¬
`¬
`¬
`static¬
`IPV4_CONTEXT*¬
`IpV4_ContextCreate(¬
` SOS_UINT32 Address,¬
` SOS_UINT32 MaskExponent¬
`)¬
`{¬
` IPV4_CONTEXT* ipV4Context;¬
`¬
` SOS_ASSERT_ASSUMPTION(¬
` MaskExponent != 0 && MaskExponent <= 32,¬
` "IpV4_ContextCreate: Invalid Parameter");¬
`¬
` ipV4Context = SOS_Mem_Alloc(sizeof(*ipV4Context));¬
` if (ipV4Context != NULL) {¬
`¬
` SOS_STATUS status;¬
`¬
` status = IpV4_ContextInitialize(ipV4Context, Address,
`MaskExponent);¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` ASSERT_IPV4_CONTEXT_INVARIANT(ipV4Context);¬
` }¬
` else {¬
` IpV4_ContextDestroy(ipV4Context);¬
` ipV4Context = NULL;¬
` }¬
` }¬
`¬
` return ipV4Context;¬
`
`Page 4 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 5/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`169
`170
`171
`172
`…
`173
`174
`…
`175
`176
`177
`178
`179
`180
`181
`182
`183
`184
`185
`186
`187
`188
`189
`190
`191
`192
`193
`194
`195
`196
`197
`198
`199
`200
`201
`202
`203
`204
`205
`206
`207
`208
`209
`210
`211
`
`}¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`NameSpace Interface¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_NameSpaceGet(¬
` SOS_INAMESPACE * Interface,¬
` const char * Name,¬
` SOS_REGOBJECT ** ChildObject¬
`)¬
`{¬
` SOS_STATUS status = SOS_ErrorParameter; ¬
` SOS_REGOBJECT* childObject = NULL;¬
`¬
` if (IISVALID(Interface)) {¬
`¬
` if (0 == SOS_strcmp(Name, "class")) {¬
` status = SOS_RegObject_CreateFromScheme(¬
` SOS_REGISTRY_SCHEME_String,¬
` IPV4_CLASS_NAME,¬
` &childObject);¬
` }¬
` else if (0 == SOS_strcmp(Name, "address")) {¬
`¬
` char addressString[SOS_UINT32_MAX_STRING_LENGTH];¬
`¬
` IPV4_CONTEXT* context = IRESOLVE(Interface);¬
` ¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context);¬
`¬
` SOS_sprintf(addressString, "%ld", context->Address);¬
`¬
` status = SOS_RegObject_CreateFromScheme(¬
` SOS_REGISTRY_SCHEME_Int,¬
` addressString,¬
` &childObject);¬
` }¬
` else if (0 == SOS_strcmp(Name, "mask")) {¬
`¬
`
`Page 5 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 6/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`212
`213
`214
`215
`216
`217
`218
`219
`220
`221
`222
`223
`224
`225
`226
`227
`228
`229
`230
`231
`232
`233
`234
`235
`236
`237
`238
`239
`240
`241
`242
`243
`244
`245
`246
`247
`248
`249
`250
`251
`252
`253
`254
`255
`256
`
` char maskString[SOS_UINT32_MAX_STRING_LENGTH];¬
`¬
` IPV4_CONTEXT* context = IRESOLVE(Interface);¬
` ¬
` SOS_sprintf(maskString, "%ld", context->SubnetMask);¬
`¬
` status = SOS_RegObject_CreateFromScheme(¬
` SOS_REGISTRY_SCHEME_Int,¬
` maskString,¬
` &childObject);¬
` }¬
` else {¬
` status = SOS_ErrorNotFound;¬
` }¬
` }¬
`¬
`¬
` if (ChildObject) {¬
` *ChildObject = childObject;¬
` }¬
` else {¬
` SOS_RegObject_Release(childObject);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_NameSpaceSet(¬
` SOS_INAMESPACE * Interface,¬
` const char * Name,¬
` SOS_REGOBJECT * ChildObject¬
`)¬
`{¬
` return SOS_ErrorNotSupported;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_NameSpaceRemove(¬
` SOS_INAMESPACE * Interface,¬
` const char * Name,¬
` SOS_REGOBJECT ** RemovedObject¬
`)¬
`
`Page 6 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 7/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`257
`258
`259
`260
`261
`262
`…
`263
`264
`…
`265
`266
`267
`268
`269
`270
`271
`272
`273
`274
`275
`276
`277
`278
`279
`280
`281
`282
`283
`284
`285
`286
`287
`288
`289
`290
`291
`292
`293
`294
`295
`296
`297
`298
`299
`
`{¬
` return SOS_ErrorNotSupported;¬
`}¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Compare Interface¬
`--------------------------------------------------------------------------
`---*/¬
`static¬
`SOS_STATUS¬
`IpV4_IsEqual (¬
` SOS_ICOMPARE * Interface,¬
` SOS_REGOBJECT * Object2¬
`)¬
`{¬
` SOS_STATUS status = SOS_ErrorParameter;¬
` ¬
` if (IISVALID(Interface)) {¬
`¬
` SOS_REGOBJECT* object1; ¬
` const SOS_REGOBJECTCLASS* class1;¬
` const SOS_REGOBJECTCLASS* class2;¬
`¬
` object1 = SOS_Interface_ObjectPeek(Interface);¬
` class1 = SOS_RegObject_ClassPeek(object1);¬
` class2 = SOS_RegObject_ClassPeek(Object2);¬
`¬
` if (class1 == class2) {¬
`¬
` IPV4_CONTEXT* context1 = RESOLVE(object1); ¬
` IPV4_CONTEXT* context2 = RESOLVE(Object2);¬
`¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context1);¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context2);¬
`¬
` if (context1->Address == context2->Address &&¬
` context1->SubnetMask == context2->SubnetMask) {¬
` status = SOS_True;¬
` }¬
` else {¬
` status = SOS_False;¬
` }¬
` }¬
`
`Page 7 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 8/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`300
`301
`302
`303
`304
`305
`306
`307
`308
`309
`310
`311
`312
`313
`314
`315
`316
`317
`318
`319
`320
`321
`322
`323
`324
`325
`326
`327
`328
`329
`330
`331
`332
`333
`334
`335
`336
`337
`…
`338
`339
`340
`…
`341
`342
`
` else {¬
` status = SOS_False;¬
` } ¬
` }¬
`¬
` return status;¬
`}¬
` ¬
`¬
`/* This is not transitive */ ¬
`static¬
`int¬
`IpV4_Compare (¬
` SOS_ICOMPARE * Interface,¬
` SOS_REGOBJECT * Object2¬
`)¬
`{¬
` int compare;¬
` ¬
` if (IISVALID(Interface)) {¬
`¬
` SOS_REGOBJECT* object1; ¬
` const SOS_REGOBJECTCLASS* class1;¬
` const SOS_REGOBJECTCLASS* class2;¬
`¬
` object1 = SOS_Interface_ObjectPeek(Interface);¬
` class1 = SOS_RegObject_ClassPeek(object1);¬
` class2 = SOS_RegObject_ClassPeek(Object2);¬
`¬
` if (class1 == class2) {¬
`¬
` IPV4_CONTEXT* context1 = IRESOLVE(Interface);¬
` IPV4_CONTEXT* context2 = RESOLVE(Object2);¬
`¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context1);¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context2);¬
`¬
` if ((context1->Address & context2->SubnetMask) <
`(context2->Address & context1->SubnetMask)) {¬
` compare = -1;¬
` }¬
` else if ((context2->Address & context1->SubnetMask) <
`(context1->Address & context2->SubnetMask)) {¬
` compare = 1;¬
` }¬
`
`Page 8 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ipv4/main/ipv4.c
`Page 9/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`343
`344
`345
`346
`347
`348
`349
`350
`351
`352
`353
`354
`355
`356
`357
`358
`359
`360
`361
`362
`363
`364
`365
`366
`367
`368
`369
`370
`371
`372
`373
`374
`375
`376
`377
`378
`379
`380
`381
`382
`383
`384
`385
`386
`387
`
` else {¬
` compare = 0;¬
` }¬
`¬
` }¬
` else if (class1 < class2) {¬
` compare = -1;¬
` }¬
` else {¬
` compare = 1;¬
` }¬
` }¬
` else {¬
` compare = -1;¬
` }¬
`¬
` return compare;¬
`}¬
`¬
`static¬
`SOS_UINT32¬
`IpV4_Hash(¬
` SOS_ICOMPARE * Interface¬
`)¬
`{¬
` SOS_UINT32 hash;¬
` ¬
` if (IISVALID(Interface)) {¬
`¬
` IPV4_CONTEXT* ipV4Context = IRESOLVE(Interface);¬
`¬
` hash = ipV4Context->Address;¬
` }¬
` else {¬
` hash = 0;¬
` }¬
`¬
` return hash;¬
`}¬
`¬
`¬
`static¬
`SOS_UINT32¬
`IpV4_Matches(¬
` SOS_ICOMPARE * Interface,¬
`
`Page 9 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 10/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`388
`389
`390
`391
`392
`393
`394
`395
`396
`397
`398
`399
`400
`401
`402
`403
`404
`405
`406
`407
`408
`409
`410
`411
`…
`412
`413
`414
`415
`416
`417
`418
`419
`420
`421
`422
`423
`424
`425
`…
`426
`427
`…
`428
`429
`
` SOS_REGOBJECT * Object2¬
`)¬
`{¬
` SOS_UINT32 strength = 0;¬
`¬
` if (IISVALID(Interface)) {¬
`¬
` SOS_REGOBJECT* object1; ¬
` const SOS_REGOBJECTCLASS* class1;¬
` const SOS_REGOBJECTCLASS* class2;¬
`¬
` object1 = SOS_Interface_ObjectPeek(Interface);¬
` class1 = SOS_RegObject_ClassPeek(object1);¬
` class2 = SOS_RegObject_ClassPeek(Object2);¬
`¬
` if (class1 == class2) {¬
`¬
` IPV4_CONTEXT* context1 = IRESOLVE(Interface);¬
` IPV4_CONTEXT* context2 = RESOLVE(Object2);¬
`¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context1);¬
` ASSERT_IPV4_CONTEXT_INVARIANT(context2);¬
`¬
` if ((context2->Address & context1->SubnetMask) ==
`context1->Address) {¬
`¬
` /* CONSIDER:¬
` The exponent of the subnet mask would give a better¬
` feel for the strength of the match.¬
` */¬
` strength = 1;¬
` }¬
` }¬
` }¬
`¬
` return strength;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Int Value interface¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`static¬
`
`Page 10 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 11/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`430
`431
`432
`433
`434
`435
`436
`437
`438
`439
`440
`441
`442
`443
`444
`445
`446
`447
`448
`449
`450
`451
`452
`453
`454
`455
`456
`457
`458
`459
`460
`461
`462
`463
`464
`465
`466
`467
`468
`469
`470
`471
`472
`473
`474
`
`SOS_STATUS¬
`IpV4_Int32ValueGet(¬
` SOS_IINTVALUE * Interface,¬
` SOS_INT32 * Value¬
`)¬
`{¬
` return SOS_ErrorNotSupported;¬
`}¬
`¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_Int32ValueSet(¬
` SOS_IINTVALUE * Interface,¬
` SOS_INT32 Value¬
`)¬
`{¬
` return SOS_ErrorNotSupported;¬
`}¬
`¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_UInt32ValueGet(¬
` SOS_IINTVALUE * Interface,¬
` SOS_UINT32 * Value¬
`)¬
`{¬
` SOS_STATUS status = SOS_ErrorParameter;¬
` SOS_UINT32 value = 0;¬
` ¬
` if (IISVALID(Interface)) {¬
`¬
` IPV4_CONTEXT* ipV4Context = IRESOLVE(Interface);¬
`¬
` ASSERT_IPV4_CONTEXT_INVARIANT(ipV4Context);¬
`¬
` value = ipV4Context->Address;¬
` status = SOS_Success;¬
` }¬
` else {¬
` status = SOS_ErrorParameter;¬
` value = 0;¬
` }¬
`¬
`
`Page 11 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 12/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`475
`476
`477
`478
`479
`480
`481
`482
`483
`484
`485
`486
`487
`488
`489
`490
`491
`492
`493
`…
`494
`495
`…
`496
`497
`498
`499
`500
`501
`502
`503
`504
`505
`506
`507
`508
`509
`510
`511
`512
`513
`514
`515
`516
`517
`
` if (Value) {¬
` *Value = value;¬
` }¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_UInt32ValueSet(¬
` SOS_IINTVALUE * Interface,¬
` SOS_UINT32 Value¬
`)¬
`{¬
` return SOS_ErrorNotSupported;¬
`}¬
`¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Create From String Interface¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`/*++¬
`Routine Name:¬
`¬
` IpV4_CreateFromString¬
`¬
`Routine Description:¬
`¬
` This routine ceates an IPv4 object from a string.¬
`¬
` It accepts strings of of two forms:¬
` ¬
` ###.###.###.###¬
`¬
` ###.###.###.###/<subnet_mask>¬
`¬
` This routine some some minimal error recovery on malformed strings.¬
`¬
`¬
`Parameters:¬
`¬
` SOS_ICREATEFROMSTRING* ICreateFromString - [in]¬
`
`Page 12 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 13/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`518
`519
`520
`521
`522
`523
`524
`525
`526
`527
`528
`529
`530
`531
`532
`533
`534
`535
`536
`537
`538
`539
`540
`541
`542
`543
`544
`545
`546
`547
`548
`549
`550
`551
`552
`553
`554
`555
`556
`557
`558
`559
`560
`561
`562
`
` The registry class interface.¬
`¬
` const char* String - [in]¬
` The string from which to create the IP object.¬
`¬
` SOS_REGOBJECT** Object - [out]¬
` The newly created object.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS -¬
` SOS_Success, on success.¬
`¬
` an error code on error.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`IpV4_CreateFromString (¬
` SOS_ICREATEFROMSTRING * ICreateFromString,¬
` const char * String,¬
` SOS_REGOBJECT ** Object¬
`)¬
`{¬
` SOS_STATUS status = SOS_ErrorParameter;¬
` SOS_REGOBJECT* newObject = NULL;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("CreateFromString '%s'\n", String);¬
`¬
` if (String != NULL) {¬
`¬
` newObject = SOS_RegObject_Create(g_IpV4Class);¬
` if (newObject != NULL) {¬
`¬
` IPV4_CONTEXT* ipV4Context = RESOLVE(newObject);¬
` const char * firstSlash;¬
` SOS_UINT32 address;¬
` SOS_UINT32 subnetMaskExponent;¬
`¬
` status = SOS_Success;¬
`¬
` /* get the subnet mask, if any exists */¬
` firstSlash = SOS_strchr(String, '/');¬
` if (firstSlash != NULL) {¬
` subnetMaskExponent = SOS_strtoul(firstSlash + 1, NULL,
`
`Page 13 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 14/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`562…
`563
`564
`565
`566
`567
`568
`569
`570
`571
`572
`573
`574
`575
`576
`577
`578
`579
`580
`581
`582
`583
`584
`585
`586
`587
`588
`589
`590
`591
`592
`593
`594
`595
`596
`597
`598
`599
`600
`601
`…
`602
`603
`…
`604
`
`10);¬
` }¬
` else {¬
` subnetMaskExponent = 32;¬
` }¬
` ¬
`¬
` /* get the IP address, which should be in dotted notation */¬
` status = SOS_inet_aton(String, &address);¬
` if (SOS_SUCCEEDED(status)) {¬
`¬
` status = IpV4_ContextInitialize(¬
` ipV4Context, ¬
` SOS_ntohl(address), ¬
` subnetMaskExponent);¬
` }¬
`¬
` if (SOS_FAILED(status)) {¬
` SOS_RegObject_Release(newObject);¬
` newObject = NULL;¬
` }¬
` }¬
` else {¬
` status = SOS_ErrorResourceAllocation;¬
` }¬
` }¬
`¬
` if (Object) {¬
` *Object = newObject;¬
` }¬
` else {¬
` SOS_RegObject_Release(newObject);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Basic Object Methods¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`
`Page 14 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 15/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`605
`606
`607
`608
`609
`610
`611
`612
`613
`614
`615
`616
`617
`618
`619
`620
`621
`622
`623
`624
`625
`626
`627
`628
`629
`630
`631
`632
`633
`634
`635
`636
`637
`638
`639
`640
`641
`…
`642
`643
`…
`644
`645
`646
`647
`
`static¬
`SOS_STATUS¬
`IpV4_Init(¬
` SOS_REGOBJECT * Object¬
`)¬
`{¬
` SOS_STATUS status;¬
` IPV4_CONTEXT * uriContext;¬
` ¬
` uriContext = IpV4_ContextCreate(0x00000000,32);¬
` if (uriContext) {¬
` SOS_RegObject_DataPut(Object, uriContext);¬
` status = SOS_Success;¬
` }¬
` else {¬
` status = SOS_ErrorResourceAllocation;¬
` }¬
` ¬
` return status;¬
`}¬
`¬
`¬
`static¬
`void¬
`IpV4_Uninit(¬
` SOS_REGOBJECT * Object¬
`)¬
`{¬
` IPV4_CONTEXT * ipV4Context;¬
` ¬
` ipV4Context = RESOLVE(Object);¬
` IpV4_ContextDestroy(ipV4Context);¬
`}¬
`¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Global initialization¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_ClassInit (¬
`
`Page 15 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 16/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`648
`649
`650
`651
`652
`653
`654
`655
`656
`657
`658
`659
`660
`661
`662
`663
`664
`665
`666
`667
`668
`669
`670
`671
`672
`673
`674
`675
`676
`677
`678
`679
`680
`681
`682
`683
`684
`685
`686
`687
`688
`689
`690
`691
`692
`
` SOS_REGOBJECTCLASS *RegObjectClass,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
`¬
` static const SOS_INAMESPACE iNamespace = {¬
` SOS_INTERFACE_INIT,¬
` IpV4_NameSpaceSet,¬
` IpV4_NameSpaceGet,¬
` IpV4_NameSpaceRemove,¬
` };¬
`¬
` static const SOS_ICOMPARE iCompare = {¬
` SOS_INTERFACE_INIT,¬
` IpV4_IsEqual,¬
` IpV4_Compare,¬
` IpV4_Matches,¬
` IpV4_Hash,¬
` };¬
`¬
` static const SOS_IINTVALUE iIntValue = {¬
` SOS_INTERFACE_INIT,¬
` IpV4_Int32ValueGet,¬
` IpV4_UInt32ValueGet,¬
` IpV4_Int32ValueSet,¬
` IpV4_UInt32ValueSet,¬
` };¬
` ¬
` static const SOS_ICREATEFROMSTRING iCreateFromString = {¬
` SOS_INTERFACE_INIT,¬
` IpV4_CreateFromString¬
` };¬
`¬
`¬
` status = SOS_RegObjectClass_InterfaceAdd(¬
` RegObjectClass,¬
` SOS_INAMESPACE_ID,¬
` &iNamespace,¬
` sizeof(iNamespace)¬
` );¬
`¬
` status = SOS_RegObjectClass_InterfaceAdd(¬
` RegObjectClass,¬
` SOS_ICOMPARE_ID,¬
`
`Page 16 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 17/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
`693
`694
`695
`696
`697
`698
`699
`700
`701
`702
`703
`704
`705
`706
`707
`708
`709
`710
`711
`712
`713
`714
`715
`716
`717
`718
`719
`720
`721
`722
`723
`724
`725
`726
`727
`728
`729
`730
`731
`732
`733
`734
`735
`736
`737
`
` &iCompare,¬
` sizeof(iCompare)¬
` );¬
`¬
` status = SOS_RegObjectClass_InterfaceAdd(¬
` RegObjectClass,¬
` SOS_IINTVALUE_ID,¬
` &iIntValue,¬
` sizeof(iIntValue)¬
` );¬
`¬
` SOS_RegObjectClass_ClassInterfaceAdd (¬
` RegObjectClass,¬
` SOS_ICREATEFROMSTRING_ID,¬
` &iCreateFromString,¬
` sizeof(iCreateFromString)¬
` );¬
`¬
` SOS_Registry_SchemeRegister(RegObjectClass, IPV4_SCHEME_NAME);¬
` SOS_Registry_SchemeRegister(RegObjectClass, IP_SCHEME_NAME);¬
`¬
` g_IpV4Class = SOS_RegObjectClass_Reference(RegObjectClass);¬
`¬
` return status;¬
`}¬
`¬
`¬
`static¬
`SOS_STATUS¬
`IpV4_ClassUninit(¬
` SOS_REGOBJECTCLASS *RegObjectClass¬
`)¬
`{¬
` SOS_Registry_SchemeUnregister(g_IpV4Class, IPV4_SCHEME_NAME);¬
` SOS_Registry_SchemeUnregister(g_IpV4Class, IP_SCHEME_NAME);¬
`¬
` SOS_RegObjectClass_Release(g_IpV4Class);¬
`¬
` return SOS_Success;¬
`}¬
`¬
`¬
`¬
`SOS_STATUS¬
`SOS_ModuleInit(¬
`
`Page 17 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/beads/ip…/main/ipv4.c
`Page 18/18
`Saved: 8/30/01, 7:46:55 PM
`Printed for: Implicit
`
` SOS_OBJECTFILE* ObjectFile,¬
` SOS_REGOBJECT* RegistryHandle¬
`)¬
`{¬
` SOS_REGOBJECTCLASS *uriClass;¬
` ¬
` uriClass = SOS_RegObjectClass_Register(¬
` ObjectFile,¬
` IPV4_CLASS_NAME,¬
` NULL, /* class context */¬
` IpV4_ClassInit,¬
` IpV4_ClassUninit,¬
` IpV4_Init,¬
` IpV4_Uninit¬
` );¬
`¬
` /*¬
` * Immediately release this class.¬
` * It may not be returned in future versions.¬
` */¬
` SOS_RegObjectClass_Release(uriClass);¬
`¬
` return SOS_Success;¬
`}¬
`¬
`void¬
`SOS_ModuleUninit(¬
` SOS_OBJECTFILE* ObjectFile¬
`)¬
`{¬
`}¬
`
`738
`739
`740
`741
`742
`743
`744
`745
`746
`747
`748
`749
`750
`751
`752
`753
`754
`755
`756
`757
`758
`759
`760
`761
`762
`763
`764
`765
`766
`767
`768
`769
`
`Page 18 of 18
`
`Implicit Exhibit 2048
`Sonos v. Implicit, IPR2018-0766, -0767
`
`