`Page 1/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`+++++¬
`…
`¬2
`Copyright (c) 2001 BeComm Corporation¬
`3
`¬4
`Filename:¬
`5
`¬6
` fanout.c¬
`7
`¬8
`Group Name:¬
`9
`¬10
` todo¬
`11
`¬12
`Group Overview:¬
`13
`¬14
` Input variables:¬
`15
`¬16
` Fanout/Count : int specifies the number of output paths.¬
`17
`if not set uses length of Fanout/KeyList¬
`18
`¬
`19
` Fanout/KeyList : array specifies a list of values to be used as keys¬
`20
`if not set no keys will be set.¬
`21
`¬
`22
` Fanout/KeyName : string specifies the path context name to set the key
`23
`at.¬
`…
`24
`¬25
` Output variables:¬
`26
`¬27
` Fanout/Index : int 0-based index of path¬
`28
` ¬
`29
` Fanout/Key¬
`30
` or value of¬
`31
` Fanout/KeyName : object from Fanout/KeyList array¬
`32
`¬33
` Caller must set at least one of Fanout/Count and Fanout/KeyList.¬
`34
` ¬
`35
`Owner:¬
`36
`¬37
` Guy Carpenter (guyc) 28-Sep-2001¬
`38
`¬39
`--------------------------------------------------------------------------
`40
`---*/¬
`…
`¬41
`#define SOS_DEBUG_ZONE "/beads/fanout"¬
`42
`
`If not set, defaults to "Fanout/Key"¬
`
`Page 1 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 2/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`¬43
`#include <sosstrings.h>¬
`44
`#include <sosmultimedia.h>¬
`45
`¬46
`SOS_SOURCE_VERSION (¬
`47
` "$Id: fanout.c,v 1.4 2001/11/10 00:51:14 guyc Exp $"¬
`48
`);¬
`49
`¬50
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`51
`+++++¬
`…
`Named Constants¬
`52
`--------------------------------------------------------------------------
`53
`---*/¬
`…
`¬54
`/*¬
`55
` * Name of bead¬
`56
` */¬
`57
`static const char BEAD_NAME[] = "fanout";¬
`58
`static const char INPUT_COUNT[] = "Fanout/Count";¬
`59
`static const char INPUT_KEYARRAY[] = "Fanout/KeyList";¬
`60
`static const char INPUT_KEYNAME[] = "Fanout/KeyName";¬
`61
`static const char OUTPUT_INDEX[] = "Fanout/Index";¬
`62
`static const char DEFAULT_KEYNAME[] = "Fanout/Key";¬
`63
`¬64
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`65
`+++++¬
`…
`Structs¬
`66
`--------------------------------------------------------------------------
`67
`---*/¬
`…
`¬68
`typedef struct {¬
`69
` SOS_UINT32 PathCount;¬
`70
` SOS_PATH ** PathList;¬
`71
`} FANOUT_CONTEXT;¬
`72
`¬73
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`74
`+++++¬
`…
`Context Stuff¬
`75
`--------------------------------------------------------------------------
`76
`---*/¬
`…
`¬77
`static¬
`78
`void¬
`79
`FanOut_ContextDestroy(¬
`80
` FANOUT_CONTEXT * Context¬
`81
`
`Page 2 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 3/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`)¬
`82
`{¬
`83
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_ContextDestroy\n");¬
`84
`¬85
` if (Context) {¬
`86
` if (Context->PathList) {¬
`87
` SOS_UINT32 i;¬
`88
` for (i=0;i<Context->PathCount;i++) {¬
`89
` SOS_Path_Destroy(Context->PathList[i]);¬
`90
` }¬
`91
` SOS_Mem_Free(Context->PathList);¬
`92
` }¬
`93
` SOS_Mem_Free(Context);¬
`94
` }¬
`95
`}¬
`96
`¬97
`static¬
`98
`FANOUT_CONTEXT *¬
`99
`FanOut_ContextCreate(¬
`100
` void¬
`101
`)¬
`102
`{¬
`103
` FANOUT_CONTEXT *context;¬
`104
`¬
`105
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_ContextCreate\n");¬
`106
`¬
`107
` context = SOS_Mem_Alloc(sizeof(*context));¬
`108
` if (context) {¬
`109
` SOS_memset(context, 0, sizeof(*context));¬
`110
` }¬
`111
`¬
`112
` return context;¬
`113
`}¬
`114
`¬
`115
`static¬
`116
`SOS_STATUS¬
`117
`FanOut_ContextInit(¬
`118
` FANOUT_CONTEXT * Context,¬
`119
` SOS_PATH * ParentPath,¬
`120
` SOS_UINT32 PathCount,¬
`121
` SOS_IARRAY * KeyArray,¬
`122
` const char * KeyName¬
`123
`)¬
`124
`{¬
`125
` SOS_STATUS status = SOS_Success;¬
`126
`
`Page 3 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 4/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`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
`169
`170
`
` SOS_UINT32 i;¬
`¬
` Context->PathCount = PathCount;¬
` Context->PathList = SOS_Mem_Alloc(sizeof(SOS_PATH*)*PathCount);¬
`¬
` if (Context->PathList) {¬
` SOS_memset(Context->PathList, 0, sizeof(SOS_PATH*)*PathCount);¬
` for (i=0;i<PathCount && SOS_SUCCEEDED(status);i++) {¬
` Context->PathList[i]=SOS_Path_Create(ParentPath);¬
` if (Context->PathList[i]) {¬
`¬
` SOS_REGOBJECT *indexObject = SOS_UInt32_Create(i);¬
` SOS_REGOBJECT *key;¬
`¬
` if (indexObject) {¬
` SOS_Path_AttributeSet(¬
` Context->PathList[i],¬
` OUTPUT_INDEX,¬
` indexObject¬
` );¬
` SOS_RegObject_Release(indexObject);¬
` }¬
` ¬
` if (KeyArray &&
`SOS_SUCCEEDED(KeyArray->Get(KeyArray,i,&key))) {¬
` SOS_Path_AttributeSet(¬
` Context->PathList[i],¬
` KeyName,¬
` key¬
` );¬
` SOS_RegObject_Release(key);¬
` }¬
` } else {¬
` status = SOS_Error;¬
` }¬
` }¬
` } else {¬
` /* no pathlist */¬
` status = SOS_Error;¬
` }¬
`¬
` return status;¬
`}¬
`¬
`static¬
`
`Page 4 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 5/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`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
`212
`
`SOS_STATUS¬
`FanOut_MessageSend(¬
` FANOUT_CONTEXT * Context,¬
` SOS_MESSAGE * Message¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` ¬
` if (Context->PathList) {¬
` SOS_UINT32 i;¬
` for (i=0;i<Context->PathCount && SOS_SUCCEEDED(status);i++) {¬
` SOS_MESSAGE *copy;¬
` SOS_Message_HeadMessageCopyFrom(Message,SOS_UINT32_MAX,
`©);¬
` status = SOS_Path_MessageSend(Context->PathList[i], copy);¬
` }¬
` } else {¬
` status = SOS_Error;¬
` }¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`FanOut_KeyCreate(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` static SOS_UINT32 s_UniqueId = 0;¬
` SOS_REGOBJECT* uniqueSessionKey;¬
` ¬
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_KeyCreate\n");¬
`¬
` uniqueSessionKey = SOS_UInt32_Create(s_UniqueId++);¬
` SOS_Path_SessionKeySet(Path, uniqueSessionKey);¬
` SOS_RegObject_Release(uniqueSessionKey);¬
`¬
`
`Page 5 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 6/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`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
`
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Bead Definition¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`static¬
`SOS_STATUS¬
`FanOut_MessageHandler(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` FANOUT_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_MessageHandler\n");¬
`¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` status = FanOut_MessageSend(context, Message);¬
`¬
` SOS_Message_Destroy(Message);¬
`¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Session Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`FanOut_SessionInit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` FANOUT_CONTEXT *context = FanOut_ContextCreate();¬
`¬
`
`Page 6 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 7/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`254
`255
`256
`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
`
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_SessionInit\n");¬
`¬
` if (context) {¬
` SOS_IARRAY *keyArray = NULL;¬
` SOS_UINT32 pathCount = 0;¬
` char * keyName = NULL;¬
`¬
` SOS_Path_SessionContextPut(Path, context);¬
`¬
` /*¬
` * Get IArray index if KeyList if it exists¬
` */¬
` {¬
` SOS_REGOBJECT *object = NULL;¬
` if (SOS_SUCCEEDED(¬
` SOS_Path_AttributeGet(¬
` Path,¬
` INPUT_KEYARRAY,¬
` &object))) {¬
` SOS_RegObject_InterfaceGet(¬
` object,¬
` SOS_IARRAY_ID,¬
` (void**)&keyArray¬
` );¬
` SOS_ASSERT_ASSUMPTION(¬
` keyArray,¬
` "KeyArray does not support array interface"¬
` );¬
` SOS_RegObject_Release(object);¬
` }¬
` }¬
`¬
` /*¬
` * Get key name¬
` */¬
` {¬
` SOS_REGOBJECT *object = NULL;¬
` if (SOS_SUCCEEDED(¬
` SOS_Path_AttributeGet(¬
` Path,¬
` INPUT_KEYNAME,¬
` &object))) {¬
` SOS_RegObject_ToString(¬
` object,¬
` &keyName¬
`
`Page 7 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 8/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`299
`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
`343
`
` );¬
` SOS_RegObject_Release(object);¬
` }¬
` }¬
` ¬
` /*¬
` * Get count or use array length¬
` */¬
` {¬
` SOS_REGOBJECT *object = NULL;¬
` if (SOS_FAILED(¬
` SOS_Path_AttributeGet(¬
` Path,¬
` INPUT_COUNT,¬
` &object)) ||¬
` SOS_FAILED(¬
` SOS_RegObject_Int32ValueGet(¬
` object,¬
` &pathCount))) {¬
` if (keyArray) {¬
` pathCount = keyArray->LengthGet(keyArray);¬
` }¬
` }¬
` SOS_RegObject_Release(object);¬
` }¬
`¬
` status = FanOut_ContextInit(¬
` context,¬
` Path,¬
` pathCount,¬
` keyArray,¬
` keyName ? keyName : DEFAULT_KEYNAME¬
` );¬
`¬
` SOS_Interface_Release(keyArray);¬
` SOS_Mem_Free(keyName);¬
` ¬
` } else {¬
` status = SOS_Error;¬
` }¬
` ¬
` return status;¬
`}¬
`¬
`static¬
`
`Page 8 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/beads/f…/main/fanout.c
`Page 9/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`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
`
`SOS_STATUS¬
`FanOut_SessionUninit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` FANOUT_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_SessionUninit\n");¬
`¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` if (context) {¬
` FanOut_ContextDestroy(context);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Bead Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`FanOut_BeadInit(¬
` SOS_BEAD *Bead,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("FanOut_BeadInit\n");¬
` ¬
` /* register Decode Edge */¬
` status = SOS_Edge_Register(¬
` Bead,¬
` "decode",¬
` NULL,¬
` NULL,¬
` NULL,¬
` FanOut_KeyCreate,¬
` FanOut_MessageHandler,¬
`
`Page 9 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/bea…/…/main/fanout.c
`Page 10/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
`387
`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
`
` NULL,¬
` NULL,¬
` NULL,¬
` NULL);¬
`¬
` if (SOS_FAILED(status)) {¬
` SOS_DEBUGOUT_MAJOR_EVENT( "Could not register decode edge\n");¬
` }¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`FanOut_BeadUninit(¬
` void *BeadContext¬
`)¬
`{¬
` return SOS_Success;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Module Setup¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`SOS_STATUS¬
`SOS_ModuleInit (¬
` SOS_OBJECTFILE *ObjectFile,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` /* register the Bead */¬
` status = SOS_Bead_Register(¬
` ObjectFile,¬
` BEAD_NAME,¬
` NULL, /* Bead context */¬
` FanOut_BeadInit,¬
` FanOut_BeadUninit,¬
` FanOut_SessionInit,¬
` FanOut_SessionUninit¬
` );¬
` ¬
`
`Page 10 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.15/bea…/…/main/fanout.c
`Page 11/11
`Saved: 11/9/01, 6:51:14 PM
`Printed for: Implicit
`
` return status;¬
`}¬
`¬
`¬
`void¬
`SOS_ModuleUninit (¬
` SOS_OBJECTFILE *ObjectFile¬
`)¬
`{¬
`¬
`}¬
`
`430
`431
`432
`433
`434
`435
`436
`437
`438
`439
`440
`441
`
`Page 11 of 11
`
`Implicit Exhibit 2085
`Sonos v. Implicit, IPR2018-0766, -0767
`
`