## 4 Design of SocialCode
### SLNC-Based Cooperative Content Distribution of SocialCode  
Social Code is based on the linear SLNC scheme, which operates as follows [18]. Whenever the sender node wants to distribute a multimedia content, it first encodes the content by splitting it into several generations, which includes g symbols. Then SLNC considers an original symbol as a vector over a base field and lets the sender apply a linear transformation on g symbols in a given generation to form a SLNC-coded packet, which is finally broadcast to nearby nodes. After receiving at least g linearly independent packets, the receiver can solve them to reconstruct original symbols. As the vehicular node enters the area covered by the RSU wireless signal, it accepts the SLNC-coded packets from RSU alone. Whenever it exits this area, it begins the SLNC-based CCD operations with nearby vehicles to share their received SLNC-coded packets. There are two types of wireless channels, that is, the control channel (CCH) and the service channel (SCH), in VANET. SocialCode proposes three kinds of messages, that is, the beacon, the ACK and SLNC-coded one, for its SLNC-based CCD process. Figure 2 illustrates the flow of SocialCode, which alternates the control time slot with the service one. Figure 1: Credit values of node A, B, C and D after node C broadcasts a SLNC-coded content piece. 1. In every 50 ms time slot of CCH, all destination and intermediate nodes will broadcast their beacon messages to neighbors such that they will know numbers of destination and intermediate nodes in their proximities. All beacon messages contain the sender's ID and selfishness/interest levels for distinct contents. SocialCode adopts in the content bitmap, which will be mentioned in Section 4.2, to record those SLNC content pieces received by the destination node during a preceding CCH time slot. In this way, the destination node, for example, nodes A and B in Figure 2, attaches its content bitmap in the beacon message to notify its neighbors of this information. Oppositely, the intermediate node includes its output queue information in its beacon message such that the intermediate node, for example, node C in Figure 2, could compute its dynamic forwarding priority, which will be mentioned in Section 4.3. However, the overhearing and  
Figure 2: SLNC-based cooperative content distribution flow of SocialCode. irrelevant nodes, for example, overhearing node D in Figure 2, will not broadcast any beacon message for this content data, because they do not forward receive SLNC pieces to neighbors. 2. After the time slot of CCH has expired, SCH starts its 50 ms service time slot. Among four types of vehicular nodes in SocialCode, only the destination node computes all three parameters, that is, the utility, the number of re-encoded content pieces and the backoff delay. As defined in Section 4.2, \(C(v)\) represents the number of re-encoded content pieces for the destination node to forward during a service time slot. Further, \(\Delta t_{ds}(v)\) denotes the backoff delay of the destination node before it decides when to access channel. This value depends to the utility and the reception status, which is aggregated from the content bitmap, of the destination node. Whenever the backoff delay \(\Delta t_{ds}(v)\) of the destination node has expired, it, for example, node A, will broadcast \(C(v)\) re-encoded content pieces as it senses an idle channel. Similarly, the intermediate node calculates its backoff delay \(\Delta t_{int}(v)\), which will be discussed in Section 4.3. Since SocialCode gives the intermediate node the larger backoff delay, that is, \(\Delta t_{int}(v)\), than \(\Delta t_{ds}(v)\), the intermediate node, for example, node C, can broadcast the content pieces it received to its neighbors only after every destination node has completed broadcasting its re-encoded content pieces, as shown in Figure 2. Please note that all destination and overhearing nodes will store received SLNC pieces and attempts to decode them due to their high interests on these pieces.