Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-7drxs Total loading time: 0 Render date: 2024-07-24T05:00:14.447Z Has data issue: false hasContentIssue false

7 - Modeling with high-level wrapper APIs

from Part II - Modeling Custom Networks and Protocols

Published online by Cambridge University Press:  05 February 2012

Zheng Lu
Affiliation:
University of Essex
Hongji Yang
Affiliation:
De Montfort University, Leicester
Get access

Summary

This chapter first revisits the cases described in Chapter 5 but utilizing high-level wrapper APIs instead. Then, another case is demonstrated to illustrate how to create connectionoriented communications. To follow this chapter, it is assumed that a reader understands the content covered in Chapter 5 and Chapter 6.

Revisit of previous case

In this section, Case 6 in Chapter 5 is revisited but this time with wrapper APIs.

Open “pk_switch” process model in Process Editor. Save it as “pk_switch_v2”. Now, you can edit “pk_switch_v2” and replace relevant code with wrapper APIs. In SV block, replace the declarations of state variables, as shown in Figure 7.1.

In TV block, replace the declarations of temporary variables, as shown in Figure 7.2.

In HB block, include header files: “routing.h” and “geo_topo.h”, as shown in Figure 7.3. These two files include relevant wrapper APIs for performing routing and topology related operations.

In “init” state, replace previous code for building the graph and routing table with the new code that utilizes wrapper APIs, as shown in Figures 7.4 and 7.5.

From Figures 7.4 and 7.5, it is seen that after applying the wrapper APIs, the processing of vertices and edges in the routing graph is performed by dealing with W_Vertex_Info andW_Edge_Info objects. The steps for implementing routing algorithm can be represented by the corresponding wrapper APIs in the following way:

  • Initialize graph – w_init_graph().

  • Set vertices of the graph – w_set_graph_vertices().

  • […]

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2012

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×