"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "go/pkg/pass1/print-code.go" between
Netspoc-6.025.tar.gz and Netspoc-6.026.tar.gz

About: NetSPoC is a network security policy compiler (using its own description language) to manage all the packet filter devices inside your network topology.

print-code.go  (Netspoc-6.025):print-code.go  (Netspoc-6.026)
package pass1 package pass1
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/hknutzen/Netspoc/go/pkg/conf" "github.com/hknutzen/Netspoc/go/pkg/conf"
"github.com/hknutzen/Netspoc/go/pkg/fileop" "github.com/hknutzen/Netspoc/go/pkg/fileop"
"github.com/hknutzen/Netspoc/go/pkg/jcode" "github.com/hknutzen/Netspoc/go/pkg/jcode"
"github.com/hknutzen/Netspoc/go/pkg/pass2"
"net" "net"
"os" "os"
"os/exec" "os/exec"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"unicode" "unicode"
) )
func getIntf(router *router) []*routerIntf { func getIntf(router *router) []*routerIntf {
skipping to change at line 2316 skipping to change at line 2317
} }
} }
} }
} }
} }
// Print generated code for each managed router. // Print generated code for each managed router.
func (c *spoc) printCode1(dir string) { func (c *spoc) printCode1(dir string) {
c.progress("Printing intermediate code") c.progress("Printing intermediate code")
var toPass2 *os.File toPass2 := make(chan string, 1000)
if conf.Conf.Pipe { pass2Ready := make(chan bool)
toPass2 = os.Stdout go pass2.Compile(dir, toPass2, pass2Ready)
} else {
devlist := dir + "/.devlist"
var err error
toPass2, err = os.Create(devlist)
if err != nil {
c.abort("Can't %v", err)
}
}
checkedV6Dir := false checkedV6Dir := false
seen := make(map[*router]bool) seen := make(map[*router]bool)
printRouter := func(routers []*router) { printRouter := func(routers []*router) {
for _, r := range routers { for _, r := range routers {
if seen[r] { if seen[r] {
continue continue
} }
// Ignore split part of crypto router. // Ignore split part of crypto router.
skipping to change at line 2428 skipping to change at line 2421
if err != nil { if err != nil {
c.abort("Can't %v", err) c.abort("Can't %v", err)
} }
printAcls(aclFd, vrfMembers) printAcls(aclFd, vrfMembers)
if err := aclFd.Close(); err != nil { if err := aclFd.Close(); err != nil {
c.abort("Can't %v", err) c.abort("Can't %v", err)
} }
// Send device name to pass 2, showing that processing fo r this // Send device name to pass 2, showing that processing fo r this
// device can be started. // device can be started.
fmt.Fprintln(toPass2, path) toPass2 <- path
} }
} }
printRouter(c.managedRouters) printRouter(c.managedRouters)
printRouter(c.routingOnlyRouters) printRouter(c.routingOnlyRouters)
// Send "." to indicate end of transmission. close(toPass2)
fmt.Fprintln(toPass2, ".") c.progress("Finished pass1")
<-pass2Ready
} }
func (c *spoc) printCode(dir string) { func (c *spoc) printCode(dir string) {
c.checkOutputDir(dir) c.checkOutputDir(dir)
c.printCode1(dir) c.printCode1(dir)
} }
 End of changes. 4 change blocks. 
14 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)